Initial release of Maemo 5 port of gnuplot
[gnuplot] / src / os2 / gnupmdrv.h
1 /*
2 ** static char RCSid[]="$Id: gnupmdrv.h,v 1.8 2005/07/28 07:46:06 mikulik Exp $" ;
3 */
4
5 /* PM driver for GNUPLOT */
6
7 /*[
8  * Copyright 1992, 1993, 1998, 2004 Roger Fearick
9  *
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.
15  *
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,
20  * provided you
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
28  *    software.
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.
32  *
33  * This software is provided "as is" without express or implied warranty
34  * to the extent permitted by applicable law.
35 ]*/
36
37
38 /*
39  * AUTHOR
40  *
41  *   Gnuplot driver for OS/2:  Roger Fearick
42  */
43
44 #include "config.h"
45 /* include resource defines */
46
47 #ifndef DISPDEFS_H
48 /*#include "dispdefs.h"*/
49 #include "dialogs.h"
50 #endif
51
52 /*==== own window messages  =================================================*/
53
54 #define WM_GNUPLOT          (WM_USER+20)
55 #define WM_PAUSEPLOT        (WM_USER+21)
56 #define WM_PAUSEEND         (WM_USER+22)
57 #define WM_GPSTART          (WM_USER+23)
58 #define WM_USER_SET_DATA    (WM_USER+90)
59 #define WM_USER_GET_DATA    (WM_USER+91)
60 #define WM_USER_CHGFONT     (WM_USER+10)
61 #define WM_USER_PRINT_BEGIN (WM_USER+200)
62 #define WM_USER_PRINT_OK    (WM_USER+201)
63 #define WM_USER_PRINT_ERROR (WM_USER+202)
64 #define WM_USER_DEV_ERROR   (WM_USER+203)
65 #define WM_USER_PRINT_QBUSY (WM_USER+204)
66 #define WM_USER_PRINT_CANCEL (WM_USER+205)
67
68 /*==== various names ========================================================*/
69
70 #define GNUPIPE     "\\pipe\\gnuplot"       /* named pipe to gnuplot */
71 #define GNUQUEUE    "\\queues\\gnuplot"     /* queue for gnuplot termination */
72 #define GNUSEM      "\\sem32\\gnuplot.sem"  /* synch gnuplot and gnupmdrv */
73 #define GNUINI      "GNUPMDRV.INI"          /* ini filename */
74 #define GNUEXEFILE  "gnuplot.exe"           /* exe file name */
75 #define GNUHELPFILE "gnuplot.gih"           /* help file name */
76 #define GNUTERMINIT "GNUTERM=pm"            /* terminal setup string */
77 #define INITIAL_FONT "14.Helvetica"         /* initial font for plots */
78 #define APP_NAME     "GnuplotPM"            /* application name */
79 #define CHILD_NAME   "GnupltChild"          /* child window name */
80
81         /* profile (ini file) names  */
82 #define INISHELLPOS  "PosShell"
83 #define INIPAUSEPOS  "PosPause"
84 #define INIPLOTPOS   "PosPlot"
85 #define INIFONT      "DefFont"
86 #define INIFRAC      "PageFrac"
87 #define INIPRDRIV    "DrivData"
88 #define INIPRPR      "Printer"
89 #define INIOPTS      "DefOpts"
90 #define INICHAR      "Fontdata"
91 #define INIKEEPRATIO "KeepRatio"        /* PM */
92 #define INIUSEMOUSE  "UseMouse" /* PM */
93 #define INIMOUSECOORD "MouseCoord"      /* PM */
94
95
96 /*==== global data  ==========================================================*/
97
98 HAB         hab ;               /* application anchor block handle */
99 HWND        hApp ;          /* application window handle */
100 HWND        hwndFrame ;         /* frame window handle */
101
102 #define   FONTBUF   256         /* buffer for dropped font namesize */
103 #define     GNUXPAGE  19500     /* width of plot area in 0.01 cm */
104 #define     GNUYPAGE  12500     /* height of plot area in 0.01 cm */
105
106 extern char szIPCName[];       /* name used in IPC with gnuplot */
107 extern char szIniFile[256];    /* full path of ini file */
108 extern int  bServer;
109 extern int  bPersist;
110 extern int  bWideLines;
111 #ifdef PM_KEEP_OLD_ENHANCED_TEXT
112 extern int  bEnhanced;
113 #endif
114
115 /*==== stuff for querying printer capability =================================*/
116
117 typedef struct {  /* query data for printer setup */
118     int   cbStruct ;       /* size of struct */
119     float xsize ;
120     float ysize ;
121     float xfrac ;
122     float yfrac ;
123     short caps ;
124     char  szFilename[CCHMAXPATHCOMP] ;
125     char  szPrinterName[128] ;
126     PPRQINFO3 piPrinter ;
127     int   cbpdriv ;
128     PDRIVDATA pdriv ;
129     } QPRINT, *PQPRINT ;
130
131 #define QP_CAPS_NORMAL 0
132 #define QP_CAPS_FILE   1   /* can print to file */
133
134 /*==== stuff for pause dialogs =================================*/
135
136 typedef struct {  /* pause data for dialog box */
137     int   cbStruct ;       /* size of struct */
138     char  *pszMessage ;    /* pause message */
139     PSWP  pswp ;           /* dialog box position */
140     } PAUSEDATA, *PPAUSEDATA ;
141
142 /*==== function declarations =================================================*/
143
144 short            ScalePS( HPS ) ;
145 int              SetupPrinter( HWND, PQPRINT ) ;
146 HDC              OpenPrinterDC( HAB, PQPRINT, LONG, char* ) ;
147 int              SetPrinterMode( HWND, PQPRINT ) ;
148 MPARAM           PrintCmdProc( HWND, ULONG, MPARAM, MPARAM ) ;
149 MRESULT EXPENTRY PrintDlgProc( HWND, ULONG, MPARAM, MPARAM ) ;
150 MRESULT EXPENTRY PauseMsgDlgProc( HWND, ULONG, MPARAM, MPARAM ) ;
151 MRESULT EXPENTRY QFontDlgProc( HWND ,ULONG, MPARAM, MPARAM ) ;
152 MRESULT EXPENTRY QPrintDlgProc (HWND, ULONG, MPARAM, MPARAM) ;
153 MRESULT EXPENTRY QPrintersDlgProc ( HWND, ULONG, MPARAM, MPARAM ) ;
154 MRESULT EXPENTRY DisplayClientWndProc(HWND, ULONG, MPARAM, MPARAM);
155 MRESULT EXPENTRY NewFrameWndProc(HWND, ULONG, MPARAM, MPARAM) ;
156 MRESULT EXPENTRY About(HWND, ULONG, MPARAM, MPARAM);
157 MRESULT EXPENTRY CancelPrintDlgProc ( HWND, ULONG, MPARAM, MPARAM ) ;
158 MRESULT EXPENTRY SendCommandDlgProc( HWND, ULONG, MPARAM, MPARAM ) ;
159
160         /* own window functions... */
161 void WinSetDlgItemFloat( HWND, USHORT, float ) ;
162 void WinSetDlgItemFloatF( HWND, USHORT, int, float ) ;
163 void WinQueryDlgItemFloat( HWND, USHORT, float* ) ;