plot window handling

This commit is contained in:
h_vogt 2009-01-10 20:29:17 +00:00
parent bea58219e7
commit 95a68aae48
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,6 @@
2009-01-10 Holger Vogt
* windisp.c: improve plot window handling, still not yet perfect
2009-01-09 Dietmar Warning 2009-01-09 Dietmar Warning
* src/misc/alloc.c, src/frontend/outitf.c: heap only needed under windows for zoom * src/misc/alloc.c, src/frontend/outitf.c: heap only needed under windows for zoom

View File

@ -392,7 +392,7 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd,
if (!eq(plot_cur->pl_typename, buf2)) { if (!eq(plot_cur->pl_typename, buf2)) {
(void) sprintf(buf, (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); buf2, gr->commandline, fx0, fxe, fy0, fye);
} else { } else {
(void) sprintf(buf, "%s xlimit %e %e ylimit %e %e\n", (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 */ case WM_CLOSE: /* close window */
{ {
GRAPH * g = pGraph( hwnd); 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); DestroyGraph(g->graphid);
} }
}
goto WIN_DEFAULT; goto WIN_DEFAULT;
case WM_PAINT: /* replot window (e.g. after Resize) */ case WM_PAINT: /* replot window (e.g. after Resize) */
@ -436,7 +442,9 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd,
/* switch DC */ /* switch DC */
saveDC = wd->hDC; saveDC = wd->hDC;
wd->hDC = newDC; wd->hDC = newDC;
/* plot anew */ // currentgraph = g;
/* plot anew */
gr_resize(g); gr_resize(g);
/* switch DC */ /* switch DC */
wd->hDC = saveDC; wd->hDC = saveDC;