From dc7d2d01a25bfe41f6b5d28c15b599b437dbe1d1 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Wed, 6 Jan 2010 22:48:21 +0000 Subject: [PATCH] hardcopy button error removed --- ChangeLog | 5 ++++- src/frontend/plotting/x11.c | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index eb9ccb649..f9638dc64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -2010-01-01 Holger Vogt +2010-01-02 Holger Vogt + * x11.c: hardcopy by button click, error removed + +2010-01-02 Holger Vogt * winmain.c: internal system() no longer needed, its available in mingw and MS Visual Studio. gnuplot.c: small update, call to gnuplot tested up to ver. 4.2.6, diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 1d14f3255..904e1ac30 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -410,7 +410,7 @@ X11_NewViewport(GRAPH *graph) XtAddCallback(DEVDEP(graph).buttons[1], XtNcallback, (XtCallbackProc) hardcopy, graph); /* set up fonts */ - if (!cp_getvar("xfont", VT_STRING, fontname)) { + if (!cp_getvar("font", VT_STRING, fontname)) { (void) strcpy(fontname, DEF_FONT); } @@ -830,10 +830,25 @@ zoomin(GRAPH *graph) void hardcopy(Widget w, caddr_t client_data, caddr_t call_data) { - + X11devdep tempdevdep; + Bool hasdevdep = FALSE; + /* com_hardcopy() -> gr_resize() -> setcolor() dirung postscript + printing will act on currentgraph with a DEVDEP inherited from PSdevdep. + But currentgraph had not changed its devdep, which was derived from + incompatible X11devdep, thus overwriting some variables. Here you find a + temporary remedy, until there will be a cleanup of graph handling. E.g. + CopyGraph() does not make a copy of its devdep, but just copies the pointer, + so keeping the old devdep. */ + if (currentgraph->devdep) { + tempdevdep = DEVDEP(currentgraph); + hasdevdep = TRUE; + } lasthardcopy = (GRAPH *) client_data; com_hardcopy(NULL); - + if (hasdevdep) + DEVDEP(currentgraph) = tempdevdep; + else + currentgraph->devdep = NULL; } void