From 1f54a6add39d8bef7dadcc1937bfdd53f40c24ca Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 2 Mar 2021 12:15:23 +0100 Subject: [PATCH] WinGUI: Make the text output from com_hardcopy available immediately by call to function UpdateMainText. Enable color for postscript output. --- src/frontend/wdisp/windisp.c | 10 ++++++++++ src/winmain.c | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index ae86fcaf8..e7147246d 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -69,6 +69,7 @@ extern int DevSwitch(char *devname); extern int NewViewport(GRAPH *pgraph); extern void com_hardcopy(wordlist *wl); extern void wincolor_graph(COLORREF* ColorTable, int noc, GRAPH* graph); +extern void UpdateMainText(void); /* defines */ #define RAD_TO_DEG (180.0 / M_PI) @@ -280,8 +281,14 @@ static int LType(int ColorIndex) static LRESULT HcpyPlotPS(HWND hwnd) { NG_IGNORE(hwnd); + int i = 1; cp_vset("hcopydevtype", CP_STRING, "postscript"); + /* If not set, the color will be b&w, i = 1 is white background */ + cp_vset("hcopypscolor", CP_NUM, &i); com_hardcopy(NULL); + /* update the text in the main window */ + UpdateMainText(); + SetFocus(swString); return 0; } @@ -292,6 +299,9 @@ static LRESULT HcpyPlotSVG(HWND hwnd) NG_IGNORE(hwnd); cp_vset("hcopydevtype", CP_STRING, "svg"); com_hardcopy(NULL); + /* update the text in the main window */ + UpdateMainText(); + SetFocus(swString); return 0; } diff --git a/src/winmain.c b/src/winmain.c index e9d49fdab..94fb25c7d 100644 --- a/src/winmain.c +++ b/src/winmain.c @@ -137,6 +137,8 @@ extern void cp_doquit(void); static struct History_info *init_history(void); +void UpdateMainText(void); + // ---------------------------------------------------------- // Warte, bis keine Messages mehr zu bearbeiten sind @@ -1915,7 +1917,10 @@ winmessage(char *new_msg) MessageBox(NULL, new_msg, "Ngspice Info", MB_OK | MB_ICONERROR); } - +void +UpdateMainText(void) { + DisplayText(); +} #else /* HAS_WINGUI not defined */ /* Prevent warning regarding empty translation unit */