From 95a68aae48450f5d4fe053266a01813f5a9c6a43 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 10 Jan 2009 20:29:17 +0000 Subject: [PATCH] plot window handling --- ChangeLog | 3 +++ src/frontend/wdisp/windisp.c | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ffe61c9d2..8c4a7b8a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2009-01-10 Holger Vogt + * windisp.c: improve plot window handling, still not yet perfect + 2009-01-09 Dietmar Warning * src/misc/alloc.c, src/frontend/outitf.c: heap only needed under windows for zoom diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index 7f6e6b81d..3bae789a5 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -392,7 +392,7 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd, if (!eq(plot_cur->pl_typename, buf2)) { (void) sprintf(buf, - "setplot %s; %s xlimit %1.20e %1.20e ylimit %1.20e %1.20e; setplot $curplot\n", + "setplot %s; %s xlimit %e %e ylimit %e %e; setplot $curplot\n", buf2, gr->commandline, fx0, fxe, fy0, fye); } else { (void) sprintf(buf, "%s xlimit %e %e ylimit %e %e\n", @@ -407,9 +407,15 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd, case WM_CLOSE: /* close window */ { GRAPH * g = pGraph( hwnd); - if (g) + + if (g) { + /* if g equals currentgraph, set a new currentgraph. + Otherwise gr_resize(g) might fail. */ + if (g == currentgraph) + currentgraph = FindGraph(g->graphid - 1); DestroyGraph(g->graphid); - } + } + } goto WIN_DEFAULT; case WM_PAINT: /* replot window (e.g. after Resize) */ @@ -436,7 +442,9 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd, /* switch DC */ saveDC = wd->hDC; wd->hDC = newDC; - /* plot anew */ +// currentgraph = g; + + /* plot anew */ gr_resize(g); /* switch DC */ wd->hDC = saveDC;