|
From: Shigeharu T. <sh...@ie...> - 2008-05-15 01:56:03
|
shige 05/15 2008 ---------------- I send a patch to modify the graph window's title of the wgnuplot, which is a request on the Japanese BBS "gnuplot QandA". But, I am sorry that the following patch is for gnuplot-4.0.0 since I cannot build the wgnuplot for gnuplot-4.3.0 and gnuplot-4.2.X by VC++ Toolkit 2003 in my computer. ----- From Here ----- diff -uN term/win.trm.ORG term/win.trm --- term/win.trm.ORG Thu May 15 10:24:52 2008 +++ term/win.trm Thu May 15 10:36:29 2008 @@ -118,7 +118,10 @@ /* Interface routines - create list of actions for Windows */ -enum WIN_id { WIN_DEFAULT, WIN_MONOCHROME, WIN_COLOR, WIN_OTHER }; +enum WIN_id { WIN_DEFAULT, WIN_MONOCHROME, WIN_COLOR, + /* shige */ + WIN_GTITLE, + WIN_OTHER }; static struct gen_table WIN_opts[] = { @@ -126,15 +129,25 @@ { "m$onochrome", WIN_MONOCHROME }, { "c$olor", WIN_COLOR }, { "c$olour", WIN_COLOR }, + /* shige */ + { "ti$tle", WIN_GTITLE }, { NULL, WIN_OTHER } }; +/* shige */ +static char WIN_gtitle[MAXTITLELEN] = WINGRAPHTITLE; + static int WIN_last_linetype = -3; /* HBB 20000813: linetype caching */ TERM_PUBLIC void WIN_options() { struct value a; + /* shige */ + TBOOLEAN set_title=FALSE; + + /* shige */ + graphwin.Title = WIN_gtitle; while (!END_OF_COMMAND) { switch(lookup_table(&WIN_opts[0],c_token)) { @@ -142,6 +155,9 @@ graphwin.color = TRUE; strcpy(graphwin.fontname, WINFONT); graphwin.fontsize = WINFONTSIZE; + /* shige */ + graphwin.Title = WINGRAPHTITLE; + set_title = TRUE; c_token++; break; case WIN_MONOCHROME: @@ -152,6 +168,19 @@ graphwin.color = TRUE; c_token++; break; + /* shige */ + case WIN_GTITLE: + c_token++; + if (END_OF_COMMAND) + int_error(c_token, "expecting title text"); + if (isstring(c_token)) + quote_str( WIN_gtitle, c_token, MAXTITLELEN ); + else + copy_str( WIN_gtitle, c_token, MAXTITLELEN ); + c_token++; + set_title = TRUE; + graphwin.Title = WIN_gtitle; + break; case WIN_OTHER: default: if (isstring(c_token)) { @@ -174,6 +203,8 @@ if (IsWindow(graphwin.hWndGraph) && IsIconic(graphwin.hWndGraph)) ShowWindow(graphwin.hWndGraph, SW_SHOWNORMAL); + /* shige */ + if (set_title) GraphChangeTitle(&graphwin); GraphRedraw(&graphwin); } diff -uN src/win/wgnuplib.h.ORG src/win/wgnuplib.h --- src/win/wgnuplib.h.ORG Thu May 15 10:23:46 2008 +++ src/win/wgnuplib.h Thu May 15 10:31:16 2008 @@ -344,6 +344,10 @@ #define WIN30FONT "Courier" #define WINFONT "Arial" +/* shige */ +#define MAXTITLELEN 120 +#define WINGRAPHTITLE "gnuplot graph" + #if 0 enum JUSTIFY { LEFT, CENTRE, RIGHT @@ -354,6 +358,8 @@ void WDPROC GraphClose(LPGW lpgw); void WDPROC GraphStart(LPGW lpgw, double pointsize); void WDPROC GraphEnd(LPGW lpgw); +/* shige */ +void WDPROC GraphChangeTitle(LPGW lpgw); void WDPROC GraphResume(LPGW lpgw); void WDPROC GraphOp(LPGW lpgw, WORD op, WORD x, WORD y, LPCSTR str); void WDPROC GraphPrint(LPGW lpgw); diff -uN src/win/wgraph.c.ORG src/win/wgraph.c --- src/win/wgraph.c.ORG Thu May 15 10:23:46 2008 +++ src/win/wgraph.c Thu May 15 10:32:01 2008 @@ -443,6 +443,13 @@ #endif } +/* shige */ +void WDPROC +GraphChangeTitle(LPGW lpgw) +{ + SetWindowText(lpgw->hWndGraph,lpgw->Title); +} + void WDPROC GraphResume(LPGW lpgw) { diff -uN src/win/winmain.c.ORG src/win/winmain.c --- src/win/winmain.c.ORG Thu May 15 10:23:46 2008 +++ src/win/winmain.c Thu May 15 10:33:12 2008 @@ -241,7 +241,12 @@ graphwin.hInstance = hInstance; graphwin.hPrevInstance = hPrevInstance; + /* shige */ +#if 0 graphwin.Title = "gnuplot graph"; +#else + graphwin.Title = WINGRAPHTITLE; +#endif graphwin.lptw = &textwin; graphwin.IniFile = textwin.IniFile; graphwin.IniSection = textwin.IniSection; ----- To Here ----- +========================================================+ Shigeharu TAKENO NIigata Institute of Technology kashiwazaki,Niigata 945-1195 JAPAN sh...@ie... TEL(&FAX): +81-257-22-8161 +========================================================+ |