1 /*
2  * Ghostview.h -- Public header file for Ghostview widget.
3  * Copyright (C) 1992  Timothy O. Theisen
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with GNU gv; see the file COPYING.  If not, write to
17  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA. *
19  *
20  *   Author: Tim Theisen           Systems Programmer
21  * Internet: tim@cs.wisc.edu       Department of Computer Sciences
22  *     UUCP: uwvax!tim             University of Wisconsin-Madison
23  *    Phone: (608)262-0438         1210 West Dayton Street
24  *      FAX: (608)262-9777         Madison, WI   53706
25  *
26  *   Author: Jose E. Marchesi (jemarch@gnu.org)
27  *           GNU Project
28 */
29 
30 #ifndef _Ghostview_h
31 #define _Ghostview_h
32 /* Be sure that FILE* is defined */
33 #include <stdio.h>
34 
35 /****************************************************************
36  *
37  * Ghostview widget
38  *
39  ****************************************************************/
40 
41 /* Resources:
42 
43  Name		     Class		RepType		Default Value
44  ----		     -----		-------		-------------
45  arguments	     Arguments		String		NULL
46  background	     Background		Pixel		XtDefaultBackground
47  border		     BorderColor	Pixel		XtDefaultForeground
48  borderWidth	     BorderWidth	Dimension	1
49  bottomMargin	     Margin		int		0
50  busyCursor	     Cursor		Cursor		watch
51  callback	     Callback		Pointer		NULL
52  cursor		     Cursor		Cursor		crosshair
53  destroyCallback     Callback		Pointer		NULL
54  filename	     Filename		String		"-"
55  foreground	     Foreground 	Pixel		XtDefaultForeground
56  height		     Height		Dimension	0
57  infoVerbose         InfoVerbose        InfoVerbose     0
58  interpreter	     Interpreter	String		"gs"
59  leftMargin	     Margin		int		0
60  llx		     BoundingBox	Int		0
61  lly		     BoundingBox	Int		0
62  mappedWhenManaged   MappedWhenManaged	Boolean		True
63  messageCallback     Callback		Pointer		NULL
64  orientation	     Orientation	PageOrientation	Portrait
65  outputCallback      Callback		Pointer		NULL
66  palette	     Palette		Palette		Color
67  quiet		     Quiet		Boolean		True
68  rightMargin	     Margin		int		0
69  safeDir	     SafeDir		Boolean		True
70  safer		     Safer		Boolean		True
71  topMargin	     Margin		int		0
72  urx		     BoundingBox	Int		612
73  ury		     BoundingBox	Int		792
74  useBackingPixmap    UseBackingPixmap	Boolean		True
75  width		     Width		Dimension	0
76  x		     Position		Position	0
77  y		     Position		Position	0
78 
79 */
80 
81 /* define any special resource names here that are not in INC_X11(StringDefs.h) */
82 
83 #define XtNbusyCursor "busyCursor"
84 #define XtNscrollCursor "scrollCursor"
85 #define XtNcursor "cursor"
86 #define XtNfilename "filename"
87 #define XtNmessageCallback "messageCallback"
88 #define XtNoutputCallback "outputCallback"
89 #define XtNpalette "palette"
90 #define XtNarguments "arguments"
91 #define XtNquiet "quiet"
92 #define XtNinfoVerbose "infoVerbose"
93 #define XtNxinerama "xinerama"
94 #define XtNllx "llx"
95 #define XtNlly "lly"
96 #define XtNurx "urx"
97 #define XtNury "ury"
98 #define XtNuseBackingPixmap "useBackingPixmap"
99 #define XtNlxdpi "lxdpi"
100 #define XtNlydpi "lydpi"
101 #define XtNrightMargin "rightMargin"
102 #define XtNleftMargin "leftMargin"
103 #define XtNbottomMargin "bottomMargin"
104 #define XtNtopMargin "topMargin"
105 #define XtNpreferredWidth  "preferredWidth"
106 #define XtNpreferredHeight "preferredHeight"
107 #define XtNsafeDir "safeDir"
108 #define XtNsafer "safer"
109 #define XtNinterpreter "interpreter"
110 
111 #define XtCBoundingBox "BoundingBox"
112 #define XtCFilename "Filename"
113 #define XtCPalette "Palette"
114 #define XtCArguments "Arguments"
115 #define XtCQuiet "Quiet"
116 #define XtCinfoVerbose "infoVerbose"
117 #define XtCxinerama "Xinerama"
118 #define XtCLResolution "LResolution"
119 #define XtCUseBackingPixmap "UseBackingPixmap"
120 #define XtCPreferredWidth  "PreferredWidth"
121 #define XtCPreferredHeight "PreferredHeight"
122 #define XtCSafer "Safer"
123 #define XtCSafeDir "SafeDir"
124 #define XtCInterpreter "Interpreter"
125 
126 #if 0
127 #define XtNhighlightPixel "highlightPixel"
128 #define XtCHighlightPixel "HighlightPixel"
129 #endif
130 
131 /******************************************************************************
132  * XmuCvtStringToPageOrientation
133  */
134 /* Number represents clockwise rotation of the paper in degrees */
135 typedef enum {
136     XtPageOrientationUnspecified =  -1,	/* Unspecified orientation */
137     XtPageOrientationPortrait	 =   0,	/* Normal portrait orientation */
138     XtPageOrientationLandscape	 =  90,	/* Normal landscape orientation */
139     XtPageOrientationUpsideDown  = 180,	/* Don't think this will be used much */
140     XtPageOrientationSeascape	 = 270	/* Landscape rotated the other way */
141 } XtPageOrientation;
142 
143 #ifndef GV_CODE
144 #   define XtEportrait "portrait"
145 #   define XtElandscape "landscape"
146 #   define XtEupsideDown "upside-down"
147 #   define XtEseascape "seascape"
148    extern Boolean XmuCvtStringToPageOrientation();
149 #endif /* GV_CODE */
150 #define XtRPageOrientation "PageOrientation"
151 #define XtRinfoVerbose "InfoVerbose"
152 #define XtRxinerama "xinerama"
153 
154 /******************************************************************************
155  * XmuCvtStringToPalette
156  */
157 typedef enum {
158     XtPaletteMonochrome,
159     XtPaletteGrayscale,
160     XtPaletteColor
161 } XtPalette;
162 #define XtEmonochrome "monochrome"
163 #define XtEgrayscale "grayscale"
164 #define XtEcolor "color"
165 #define XtRPalette "Palette"
166 extern Boolean XmuCvtStringToPalette(Display*,XrmValue*,Cardinal*,XrmValue*,XrmValue*,XtPointer*);
167 
168 /* declare specific GhostviewWidget class and instance datatypes */
169 
170 typedef struct _GhostviewClassRec*	GhostviewWidgetClass;
171 typedef struct _GhostviewRec*		GhostviewWidget;
172 
173 /* declare the class constant */
174 
175 extern WidgetClass ghostviewWidgetClass;
176 
177 /*###################################################################################*/
178 /* Public routines */
179 /*###################################################################################*/
180 
181 extern void			GhostviewDrawRectangle (
182     Widget,
183     int,
184     int,
185     int,
186     int
187 );
188 
189 /* The structure returned by the regular callback */
190 
191 typedef struct _GhostviewReturnStruct {
192     int width, height;
193     int	psx, psy;
194     float xdpi, ydpi;
195 } GhostviewReturnStruct;
196 
197 extern void			GhostviewCoordsPStoX (
198     Widget,
199     int,
200     int,
201     int*,
202     int*
203 );
204 
205 extern void			GhostviewCoordsXtoPS (
206     Widget,
207     int,
208     int,
209     int*,
210     int*
211 );
212 
213 extern void			GhostviewGetBBofArea (
214    Widget                 /* w  */ ,
215    int                    /* x1 */ ,
216    int                    /* y1 */ ,
217    int                    /* x2 */ ,
218    int                    /* y2 */ ,
219    GhostviewReturnStruct* /* p  */
220 );
221 
222 extern void			GhostviewGetAreaOfBB (
223    Widget                /* w    */  ,
224    int                   /* psx1 */  ,
225    int                   /* psy1 */  ,
226    int                   /* psx2 */  ,
227    int                   /* psy2 */  ,
228    GhostviewReturnStruct* p
229 );
230 
231 
232 extern void			GhostviewEnableInterpreter (
233     Widget	/* w */
234 );
235 
236 extern void			GhostviewDisableInterpreter (
237     Widget	/* w */
238 );
239 
240 extern void			GhostviewState (
241     Widget	/* w */           ,
242     Boolean* /* processflag_p */  ,
243     Boolean* /* busyflag_p */     ,
244     Boolean* /* inputflag_p */
245 );
246 
247 extern Boolean			GhostviewIsInterpreterReady (
248     Widget	/* w */
249 );
250 
251 extern Boolean			GhostviewIsBusy (
252     Widget	/* w */
253 );
254 
255 extern Boolean			GhostviewIsInterpreterRunning (
256     Widget	/* w */
257 );
258 
259 extern Boolean			GhostviewSendPS (
260     Widget	/* widget */,
261     FILE*	/* fp */,
262     gv_off_t	/* begin */,
263     gv_off_t	/* len */,
264     Bool	/* close */
265 );
266 
267 extern Boolean			GhostviewNextPage (
268     Widget	/* w */
269 );
270 
271 extern void			GhostviewClearBackground (
272     Widget	/* w */
273 );
274 
275 extern void			GhostviewSetup (
276     Widget	/* w */
277 );
278 
279 #endif /* _Ghostview_h */
280 
281 
282 
283 
284