2 * $Id: wgnuplib.h,v 1.24 2006/03/05 01:15:56 broeker Exp $
5 /* GNUPLOT - win/wgnuplib.h */
8 * Copyright 1982 - 1993, 1998, 2004 Russell Lang
10 * Permission to use, copy, and distribute this software and its
11 * documentation for any purpose with or without fee is hereby granted,
12 * provided that the above copyright notice appear in all copies and
13 * that both that copyright notice and this permission notice appear
14 * in supporting documentation.
16 * Permission to modify the software is granted, but not the right to
17 * distribute the complete modified source code. Modifications are to
18 * be distributed as patches to the released version. Permission to
19 * distribute binaries produced by compiling modified sources is granted,
21 * 1. distribute the corresponding source modifications from the
22 * released version in the form of a patch file along with the binaries,
23 * 2. add special version identification to distinguish your version
24 * in addition to the base release version number,
25 * 3. provide your name and address as the primary contact for the
26 * support of your modified version, and
27 * 4. retain our contact information in regard to use of the base
29 * Permission to distribute the released version of the source code along
30 * with corresponding source modifications in the form of a patch file is
31 * granted with same provisions 2 through 4 for binary distributions.
33 * This software is provided "as is" without express or implied warranty
34 * to the extent permitted by applicable law.
43 /* this file contains items to be visible outside wgnuplot.dll */
51 /* HBB 19990506: The following used to be #ifdef __DLL__.
52 * But _export is needed outside the DLL, as well. The long-standing
53 * bug crashing 16bit wgnuplot on Alt-F4 or pressing the 'close' button
56 #define WINEXPORT _export
61 /* Functions flagged WDPROC are to be export by the DLL, so they can be called
62 * directly from win.trm or the gnuplot core */
63 #define WDPROC WINAPI WINEXPORT
65 /* HBB: bumped version for pointsize, linewidth and PM3D implementation */
66 /* HBB: bumped version for massive changes due to mouse-ing and removal of
67 * variables no longer needed, in struct GW */
68 /* HBB: bumped version because of changes in PM3D interface and pointtypes */
69 /* HBB: bumped version for filledboxes support */
70 /* HBB: bumped version for larger NUMMENU in wresourc.h */
71 #define WGNUPLOTVERSION "1.6 2003-01-23"
72 BOOL WDPROC CheckWGNUPLOTVersion(LPSTR str);
74 /* ================================== */
75 /* symbols for the two icons */
79 /* ================================== */
82 /* #define DEFAULT_CHARSET ANSI_CHARSET */
83 # define OFFSETOF(x) (x)
84 # define SELECTOROF(x) (x)
85 # define MoveTo(hdc,x,y) MoveToEx(hdc,x,y,(LPPOINT)NULL);
86 # if !defined(__TURBOC__) || (__TURBOC__>=0x410) /* Borland C has these defines, already... */
87 # define farmalloc(x) malloc(x)
88 # define farrealloc(s,n) realloc(s,n)
89 # define farfree(s) free(s)
90 # endif /* __TURBOC__ */
93 #if defined(__MINGW32__) && (__GNUC__ < 3) && !defined(CYGWIN)
94 /* windowsx.h in MinGW32 2.x doesn't define some of the more traditional
95 * things gnuplot expects in every Windows C compiler, it seems: */
96 #define _fstrstr(s1,s2) (strstr(s1,s2))
97 #define _fstrchr(s,c) (strchr(s,c))
98 #define _fstrrchr(s,c) (strrchr(s,c))
99 #define _fstrlen(s) (strlen(s))
100 #define _fstrcpy(d,s) (strcpy(d,s))
101 #define _fstrncpy(d,s,n) (strncpy(d,s,n))
102 #define _fstrcat(s1,s2) (strcat(s1,s2))
103 #endif /* __MINGW32__ */
105 /* ================================== */
106 /* wprinter.c - windows printer routines */
107 void WDPROC DumpPrinter(HWND hwnd, LPSTR szAppName, LPSTR szFileName);
110 typedef struct tagPRINT {
117 struct tagPRINT FAR *next;
119 typedef GP_PRINT FAR* GP_LPPRINT;
122 /* ================================== */
123 /* wpause.c - pause window structure */
126 HINSTANCE hInstance; /* required */
127 HINSTANCE hPrevInstance; /* required */
128 LPSTR Title; /* required */
129 LPSTR Message; /* required */
130 POINT Origin; /* optional */
131 HWND hWndParent; /* optional */
140 WNDPROC lpfnPauseButtonProc;
142 typedef PW FAR* LPPW;
144 int WDPROC PauseBox(LPPW lppw);
146 /* ================================== */
147 /* wmenu.c - menu structure */
151 LPSTR szMenuName; /* required */
153 BYTE FAR * FAR *macro;
161 HWND hButton[BUTTONMAX];
162 int hButtonID[BUTTONMAX];
163 WNDPROC lpfnMenuButtonProc;
164 WNDPROC lpfnButtonProc[BUTTONMAX];
166 typedef MW FAR * LPMW;
168 /* ================================== */
169 /* wtext.c text window structure */
170 /* If an optional item is not specified it must be zero */
171 #define MAXFONTNAME 80
174 GP_LPPRINT lpr; /* must be first */
175 HINSTANCE hInstance; /* required */
176 HINSTANCE hPrevInstance; /* required */
177 LPSTR Title; /* required */
178 LPMW lpmw; /* optional */
179 POINT ScreenSize; /* optional */
180 unsigned int KeyBufSize; /* optional */
181 LPSTR IniFile; /* optional */
182 LPSTR IniSection; /* optional */
183 LPSTR DragPre; /* optional */
184 LPSTR DragPost; /* optional */
185 int nCmdShow; /* optional */
186 FARPROC shutdown; /* optional */
187 HICON hIcon; /* optional */
188 LPSTR AboutText; /* optional */
194 BYTE FAR *ScreenBuffer;
195 BYTE FAR *AttrBuffer;
203 HBRUSH hbrBackground;
204 char fontname[MAXFONTNAME]; /* font name */
205 int fontsize; /* font size in pts */
220 typedef TW FAR* LPTW;
223 /* ================================== */
224 /* wtext.c - Text Window */
225 void WDPROC TextMessage(void);
226 int WDPROC TextInit(LPTW lptw);
227 void WDPROC TextClose(LPTW lptw);
228 void WDPROC TextToCursor(LPTW lptw);
229 int WDPROC TextKBHit(LPTW);
230 int WDPROC TextGetCh(LPTW);
231 int WDPROC TextGetChE(LPTW);
232 LPSTR WDPROC TextGetS(LPTW lptw, LPSTR str, unsigned int size);
233 int WDPROC TextPutCh(LPTW, BYTE);
234 int WDPROC TextPutS(LPTW lptw, LPSTR str);
235 void WDPROC TextGotoXY(LPTW lptw, int x, int y);
236 int WDPROC TextWhereX(LPTW lptw);
237 int WDPROC TextWhereY(LPTW lptw);
238 void WDPROC TextCursorHeight(LPTW lptw, int height);
239 void WDPROC TextClearEOL(LPTW lptw);
240 void WDPROC TextClearEOS(LPTW lptw);
241 void WDPROC TextInsertLine(LPTW lptw);
242 void WDPROC TextDeleteLine(LPTW lptw);
243 void WDPROC TextScrollReverse(LPTW lptw);
244 void WDPROC TextAttr(LPTW lptw, BYTE attr);
245 void WDPROC AboutBox(HWND hwnd, LPSTR str);
247 /* ================================== */
248 /* wgraph.c - graphics window */
252 /* number of different 'basic' pens supported (the ones you can modify
253 * by the 'Line styles...' dialog, and save to/from wgnuplot.ini). */
256 /* Information about one graphical operation to be stored by the
257 * driver for the sake of redraws. Array of GWOP kept in global block */
264 /* memory block for graph operations */
265 struct GWOPBLK { /* kept in local memory */
266 struct GWOPBLK *next;
267 HGLOBAL hblk; /* handle to a global block */
268 struct GWOP FAR *gwop; /* pointer to global block if locked */
269 UINT used; /* number of GWOP's used */
273 #define W_endoflist 0
283 #define W_itriangle 18
284 #define W_fitriangle 19
285 #define W_triangle 20
286 #define W_ftriangle 21
288 #define W_fdiamond 23
289 #define W_pentagon 24
290 #define W_fpentagon 25
294 #define W_line_type 32
295 #define W_put_text 33
297 #define W_text_angle 35
298 #define W_pointsize 36
299 #define W_line_width 37
300 #define W_pm3d_setcolor 38
301 #define W_pm3d_filled_polygon_pt 39
302 #define W_pm3d_filled_polygon_draw 40
304 #define W_fillstyle 42 /* NOTE HBB 20010916: used #if _FILLEDBOXES */
308 typedef struct tagGW {
309 GP_LPPRINT lpr; /* must be first */
310 HINSTANCE hInstance; /* required */
311 HINSTANCE hPrevInstance; /* required */
312 LPSTR Title; /* required */
313 int xmax; /* required */
314 int ymax; /* required */
315 LPTW lptw; /* optional */ /* associated text window */
316 POINT Origin; /* optional */ /* origin of graph window */
317 POINT Size; /* optional */ /* size of graph window */
318 LPSTR IniFile; /* optional */
319 LPSTR IniSection; /* optional */
320 HWND hWndGraph; /* window handle */
321 HMENU hPopMenu; /* popup menu */
322 int pen; /* current pen number */
323 int htic; /* horizontal size of point symbol (xmax units) */
324 int vtic; /* vertical size of point symbol (ymax units)*/
325 int hchar; /* horizontal size of character (xmax units) */
326 int vchar; /* vertical size of character (ymax units)*/
327 int angle; /* text angle */
328 BOOL rotate; /* can text be rotated 90 degrees ? */
329 char fontname[MAXFONTNAME]; /* font name */
330 int fontsize; /* font size in pts */
331 char deffontname[MAXFONTNAME]; /* default font name */
332 int deffontsize; /* default font size */
333 HFONT hfonth; /* horizonal font */
334 HFONT hfontv; /* rotated font (arbitrary angle) */
335 LOGFONT lf; /* cached to speed up rotated fonts */
336 BOOL resized; /* has graph window been resized? */
337 BOOL graphtotop; /* bring graph window to top after every plot? */
338 BOOL color; /* color pens? */
339 HPEN hapen; /* stored current pen */
340 LOGPEN colorpen[WGNUMPENS+2]; /* color pen definitions */
341 LOGPEN monopen[WGNUMPENS+2]; /* mono pen definitions */
342 COLORREF background; /* background color */
343 HBRUSH hbrush; /* background brush */
344 HBRUSH colorbrush[WGNUMPENS+2]; /* brushes to fill points */
345 struct GWOPBLK *gwopblk_head;
346 struct GWOPBLK *gwopblk_tail;
348 BOOL locked; /* locked if being written */
349 double org_pointsize; /* Original Pointsize */
351 typedef GW FAR* LPGW;
353 #define WINFONTSIZE 10
354 #define WIN30FONT "Courier"
355 #define WINFONT "Arial"
363 void WDPROC GraphInit(LPGW lpgw);
364 void WDPROC GraphClose(LPGW lpgw);
365 void WDPROC GraphStart(LPGW lpgw, double pointsize);
366 void WDPROC GraphEnd(LPGW lpgw);
367 void WDPROC GraphResume(LPGW lpgw);
368 void WDPROC GraphOp(LPGW lpgw, WORD op, WORD x, WORD y, LPCSTR str);
369 void WDPROC GraphOpSize(LPGW lpgw, WORD op, WORD x, WORD y, LPCSTR str, DWORD size);
370 void WDPROC GraphPrint(LPGW lpgw);
371 void WDPROC GraphRedraw(LPGW lpgw);
372 void WDPROC GraphChangeFont(LPGW lpgw, LPCSTR font, int fontsize, HDC hdc, RECT rect);
373 unsigned int WDPROC GraphGetTextLength(LPGW lpgw, LPCSTR text, LPCSTR fontname, int fontsize);
374 int WDPROC GraphGetFontScaling(LPGW lpgw, LPCSTR font, int fontsize);
377 void WDPROC Graph_set_cursor (LPGW lpgw, int c, int x, int y );
378 void WDPROC Graph_set_ruler (LPGW lpgw, int x, int y );
379 void WDPROC Graph_put_tmptext(LPGW lpgw, int i, LPCSTR str);
380 void WDPROC Graph_set_clipboard (LPGW lpgw, LPCSTR s);
383 /* ================================== */