1 /* globals */
2 /* COPYRIGHT (C) 2000 THE VICTORIA UNIVERSITY OF MANCHESTER and John Levon
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15  * Place - Suite 330, Boston, MA 02111-1307, USA.
16  */
17 /*
18  * $Log: globals.c,v $
19  * Revision 1.3  2000/12/17 00:57:42  moz
20  * examples, filled open splines, highlight_objects
21  *
22  * Revision 1.2  2000/12/06 20:56:01  moz
23  * GPL stuff.
24  *
25  * Revision 1.1.1.1  2000/08/21 01:05:31  moz
26  *
27  *
28  * Revision 1.1.1.1  2000/07/19 22:45:30  moz
29  * CVS Import
30  *
31  * Revision 1.23  2000/03/08 22:04:42  moz
32  * Compile fixes.
33  *
34  * Revision 1.22  2000/02/27 21:27:58  moz
35  * Removed unused variables.
36  *
37  * Revision 1.21  2000/01/21 11:48:02  moz
38  * Removed un-needed gcs.
39  *
40  * Revision 1.20  2000/01/21 11:22:01  moz
41  * last_mouse_movement isn't used.
42  *
43  * Revision 1.19  1999/11/15 02:10:17  moz
44  * Name change.
45  *
46  * Revision 1.18  1999/07/27 01:47:22  moz
47  * Removed useless -title and -bgcolor options.
48  *
49  * Revision 1.17  1999/06/30 15:32:38  moz
50  * Updated the view icons sizes.
51  *
52  * Revision 1.16  1999/05/23 00:27:37  moz
53  * Pedantic changes.
54  *
55  * Revision 1.15  1999/05/22 02:55:06  moz
56  * Added -background, -nocompoundoutlines, and -guidelines options.
57  *
58  * Revision 1.14  1999/05/19 17:10:36  moz
59  * 1.0 Checkin.
60  *
61  * Revision 1.13  1999/05/05 12:28:45  moz
62  * Print dialog.
63  *
64  * Revision 1.12  1999/05/04 22:31:15  moz
65  * Snap to grid given shortcut [i].
66  *
67  * Revision 1.11  1999/05/03 06:21:14  moz
68  * FIG files only for insert and save.
69  *
70  * Revision 1.10  1999/04/29 22:01:34  moz
71  * Redo.
72  *
73  * Revision 1.9  1999/04/29 00:25:57  moz
74  * Removed nodebox_icon.
75  *
76  * Revision 1.8  1999/04/27 21:14:09  moz
77  * Correction to cmdline coredump with -notooltips.
78  *
79  * Revision 1.7  1999/04/27 21:10:39  moz
80  * Hide/show tooltips added.
81  *
82  * Revision 1.6  1999/04/27 16:55:29  moz
83  * Flip object added.
84  *
85  * Revision 1.5  1999/04/23 01:05:33  moz
86  * Show FIG files only window.
87  *
88  * Revision 1.4  1999/04/22 16:16:30  moz
89  * Due to xfig, must be arc *circle*.
90  *
91  * Revision 1.3  1999/04/04 01:49:33  moz
92  * Shortcuts for Export and Print added.
93  *
94  * Revision 1.2  1999/04/03 21:13:06  moz
95  * Show shortcuts on tooltips, export dialog windows.
96  *
97  * Revision 1.1  1999/03/30 00:04:51  moz
98  * Initial revision
99  *
100  */
101 
102 #include "include/figurine.h"
103 #include "include/stk.h"
104 #include "include/icons.h"
105 
106 /* state variables  */
107 State state;
108 List undostack = NULL;
109 List redostack = NULL;
110 int undolevels=10;
111 Boolean compound_outlines=FALSE;
112 Boolean highlight_objects=TRUE;
113 Boolean guide_lines=FALSE;
114 Boolean tooltips = TRUE;
115 /* screen pixels per inch  */
116 double screen_ppi;
117 
118 Atom winproto;
119 /* for WM_DELETE_WINDOW  */
120 Atom windelete;
121 
122 /* things to free() at close down  */
123 List freelist=NULL;
124 
125 /* main initialisation  */
126 WindowStruct toolWindow;
127 XrmDatabase XresourceDatabase;
128 XrmDatabase XcommandLineDatabase;
129 Display *display;
130 int screen;
131 XFontStruct *font;
132 XFontStruct *rulerfont;
133 Boolean quitting=FALSE;
134 
135 /* dialog windows  */
136 Window file_dialog;
137 Window lfile_text;
138 Window rfile_text;
139 Window file_figfiles;
140 Window file_entry;
141 Window file_ok;
142 Window file_cancel;
143 Window savefile_dialog;
144 Window savelfile_text;
145 Window saverfile_text;
146 Window savefile_figfiles;
147 Window savefile_entry;
148 Window savefile_ok;
149 Window savefile_cancel;
150 Window insertfile_dialog;
151 Window insertlfile_text;
152 Window insertrfile_text;
153 Window insertfile_figfiles;
154 Window insertfile_entry;
155 Window insertfile_ok;
156 Window insertfile_cancel;
157 Window exportfile_dialog;
158 Window exportlfile_text;
159 Window exportrfile_text;
160 Window exportformat_text;
161 Window exportfile_entry;
162 Window exportfile_ok;
163 Window exportfile_cancel;
164 Window printfile_dialog;
165 Window printfile_entry;
166 Window printfile_choice;
167 Window printfile_print;
168 Window printfile_cancel;
169 Window view_dialog;
170 Window view_gridx_entry;
171 Window view_gridy_entry;
172 Window view_ok;
173 Window view_apply;
174 Window view_cancel;
175 Window view_mm;
176 Window view_inch;
177 Window view_units;
178 Window view_guides;
179 Window view_compounds;
180 Window view_highlight;
181 Window lw_dialog;
182 Window lw_entry;
183 Window lw_ok;
184 Window lw_apply;
185 Window lw_cancel;
186 Window roundbox_dialog;
187 Window roundbox_choice;
188 Window roundbox_entry;
189 Window roundbox_ok;
190 Window roundbox_apply;
191 Window roundbox_cancel;
192 Window polygon_dialog;
193 Window polygon_choice;
194 Window polygon_entry;
195 Window polygon_ok;
196 Window polygon_apply;
197 Window polygon_cancel;
198 Window spline_dialog;
199 Window spline_choice;
200 Window spline_slider;
201 Window spline_entry;
202 Window spline_ok;
203 Window spline_apply;
204 Window spline_cancel;
205 Window font_dialog;
206 Window font_typeface_text;
207 Window font_size_text;
208 Window font_entry;
209 Window font_close;
210 Window arrow_dialog;
211 Window larrow_choice;
212 Window larrow_fillchoice;
213 Window larrow_type;
214 Window larrow_width;
215 Window larrow_height;
216 Window larrow_thickness;
217 Window rarrow_choice;
218 Window rarrow_fillchoice;
219 Window rarrow_type;
220 Window rarrow_width;
221 Window rarrow_height;
222 Window rarrow_thickness;
223 Window arrow_ok;
224 Window arrow_apply;
225 Window arrow_cancel;
226 
227 /* list of all documents  */
228 List docs=NULL;
229 /* list of all non-STK windows */
230 List wins = NULL;
231 
232 /* stores mouse position  */
233 int mouse_x;
234 int mouse_y;
235 int last_mouse_x;
236 int last_mouse_y;
237 
238 /* this is a numbering for objects  */
239 unsigned long ob_ticket=0;
240 
241 /* GCs we need */
242 
243 GC rulergc;
244 GC dashgc; /* dashed line in black  */
245 GC backgc;
246 GC fillgc; /* used for fill styles  */
247 GC blackxorgc; /* mode XOR for rubber banding  */
248 GC handlegc;
249 GC whitegc;
250 GC ugc; /* this is the one used for normal drawing */
251 
252 
253 /* accepted options */
254 XrmOptionDescRec XcommandLineTable[] =
255 {
256 	/* note the first two cannot be placed in a resource file as they are used  */
257 	/* before XOpenDisplay  */
258 	{"--version",  ".askversion", XrmoptionIsArg,  (caddr_t) NULL },
259 	{"-display",   ".display",    XrmoptionSepArg, (caddr_t) NULL },
260 	/* this is the geometry of the tool window */
261 	{"-geometry",  "*geometry",   XrmoptionSepArg, (caddr_t) NULL },
262 	{"-tlcolor", "*tlcolor", XrmoptionSepArg, (caddr_t) NULL },
263 	{"-background", "*background", XrmoptionSepArg, (caddr_t) NULL },
264 	{"-brcolor", "*brcolor", XrmoptionSepArg, (caddr_t) NULL },
265 	/* colour of object handles (default red)  */
266 	{"-handlecolor", "*handlecolor", XrmoptionSepArg, (caddr_t) NULL },
267 	{"-font",     "*font",   XrmoptionSepArg, (caddr_t) NULL },
268 	{"-rulerfont",     "*rulerfont",   XrmoptionSepArg, (caddr_t) NULL },
269 	{"-screenppi", "*screenppi", XrmoptionSepArg, (caddr_t) NULL },
270 	{"-undolevels", "*undolevels", XrmoptionSepArg, (caddr_t) NULL },
271 	{"-notooltips", "*notooltips", XrmoptionIsArg, (caddr_t) NULL },
272 	{"-compoundoutlines", "*compoundoutlines", XrmoptionIsArg, (caddr_t) NULL },
273 	{"-nohighlightobjects", "*nohighlightobjects", XrmoptionIsArg, (caddr_t) NULL },
274 	{"-guidelines", "*guidelines", XrmoptionIsArg, (caddr_t) NULL },
275 };
276 int XcommandLineTableEntries = (sizeof(XcommandLineTable)/sizeof(XrmOptionDescRec));
277 
278 
279 /* menus  */
280 stkMenuBar main_menu =
281 	{
282 		{ "File", "Help", NULL, NULL, NULL, },
283 	};
284 stkMenu file_menu =
285 	{
286 		{ "New ^N", "Open ... ^O", "-", "Quit ^Q",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, },
287 		{ FILE_NEW,   FILE_OPEN, 0, FILE_QUIT,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
288 
289 	};
290 stkMenu options_menu =
291 	{
292 		{ "Contents ^H","Show tooltips",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, },
293 		{ HELP_CONTENTS, HELP_TOOLTIPS,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, },
294 
295 	};
296 Window hpw;
297 stkMenu view_menu =
298 	{
299 		{ "New ^N", "Open ... ^O", "Insert ... ^I","-", "Save ^S", "Save As ... ^A", "Export ... ^E", "Print ... ^P", "Close ^D", "-", "Undo ^Z", "Redo ^R", "-", "New view ^M", "View Settings ... ^B", "-", "Quit ^Q", NULL,NULL,NULL,},
300 		{ FILE_NEW, FILE_OPEN, FILE_INSERT, 0, FILE_SAVE, FILE_SAVE_AS, FILE_EXPORT, FILE_PRINT, FILE_CLOSE, 0, VIEW_UNDO, VIEW_REDO, 0,NEW_VIEW, VIEW_SETTINGS, 0, FILE_QUIT, 0,0,0, },
301 	};
302 Window vmw;
303 stkMenu edit_menu =
304 	{
305 		{ "Cut ^X", "Copy ^C", "Paste ^V", "Delete [Del]", "-", "Raise ^{", "Lower ^}", "Flip H ^(","Flip V ^)",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,},
306 		{ EDIT_CUT, EDIT_COPY, EDIT_PASTE, EDIT_DELETE, 0, EDIT_RAISE, EDIT_LOWER, FLIP_X,FLIP_Y,0,0,0,0,0,0,0,0,0,0,0,},
307 	};
308 Window emw;
309 
310 /* icons on tool window  */
311 stkIcon icons[] =
312 	{
313 		{ pointer_xpm, (Pixmap)-1, POINTERICON, 0,0, 32, 32, TRUE, FALSE, "Edit objects [Space]" },
314 		{ compound_xpm, (Pixmap)-1, COMPOUNDICON, 0,0, 32, 32, TRUE, FALSE, "Compound object handling [c]" },
315 		{ polyline_xpm, (Pixmap)-1, POLYLINEICON, 0,0,  32, 32, TRUE, FALSE, "Unfilled polyline [l]" },
316 		{ radiuscircle_xpm, (Pixmap)-1, ELLIPSEICON, 0, 0, 32, 32, TRUE, FALSE, "Ellipse [e]" },
317 		{ boxcircle_xpm, (Pixmap)-1, BOXELLIPSEICON, 0, 0, 32, 32, TRUE, FALSE, "Ellipse by box [b]" },
318 		{ ellipsearc_xpm, (Pixmap)-1, ARCELLIPSEICON, 0, 0, 32, 32, TRUE, FALSE, "Arc section of circle [f]" },
319 		{ box_xpm,(Pixmap)-1, RECTANGLEICON, 0, 0, 32, 32, TRUE, FALSE,  "Rectangle [r]"},
320 		{ radiuspolygon_xpm, (Pixmap)-1, POLYGONICON, 0, 0, 32, 32, TRUE, FALSE, "Filled polyline [g]"  },
321 		{ xspline_xpm, (Pixmap)-1, SPLINEICON, 0, 0, 32, 32, TRUE, FALSE, "Spline curve [s]"},
322 		{ text_xpm, (Pixmap)-1, TEXTICON, 0,0,32, 32, TRUE, FALSE, "Text [t]" },
323 		{ node_xpm, (Pixmap)-1, NODEICON, 0,0, 32, 32, TRUE, FALSE, "Labelled node [n]"},
324 		{ arc_xpm, (Pixmap)-1, ARCICON, 0,0, 32, 32, TRUE, FALSE, "Labelled arc [a]"},
325 	};
326 uint icon_number = (int)(sizeof(icons)/sizeof(stkIcon));
327 
328 /* icons on pop-up window  */
329 stkIcon floaticons[] =
330 	{
331 		{ pointer_xpm, (Pixmap)-1, POINTERICON, 0,0, 32, 32, TRUE, FALSE, "Edit objects [Space]" },
332 		{ compound_xpm, (Pixmap)-1, COMPOUNDICON, 0,0, 32, 32, TRUE, FALSE, "Compound object handling [c]" },
333 		{ polyline_xpm, (Pixmap)-1, POLYLINEICON, 0,0,  32, 32, TRUE, FALSE, "Unfilled polyline [l]" },
334 		{ radiuscircle_xpm, (Pixmap)-1, ELLIPSEICON, 0, 0, 32, 32, TRUE, FALSE, "Ellipse [e]" },
335 		{ boxcircle_xpm, (Pixmap)-1, BOXELLIPSEICON, 0, 0, 32, 32, TRUE, FALSE, "Ellipse by box [b]" },
336 		{ ellipsearc_xpm, (Pixmap)-1, ARCELLIPSEICON, 0, 0, 32, 32, TRUE, FALSE, "Arc section of circle [f]" },
337 		{ box_xpm, (Pixmap)-1, RECTANGLEICON, 0, 0, 32, 32, TRUE, FALSE,  "Rectangle [r]" },
338 		{ radiuspolygon_xpm, (Pixmap)-1, POLYGONICON, 0, 0, 32, 32, TRUE, FALSE, "Filled polyline [g]"  },
339 		{ xspline_xpm, (Pixmap)-1, SPLINEICON, 0, 0, 32, 32, TRUE, FALSE, "Spline curve [s]"},
340 		{ text_xpm, (Pixmap)-1, TEXTICON, 0,0,32, 32, TRUE, FALSE, "Text [t]" },
341 		{ node_xpm, (Pixmap)-1, NODEICON, 0,0, 32, 32, TRUE, FALSE, "Labelled node [n]"},
342 		{ arc_xpm, (Pixmap)-1, ARCICON, 0,0, 32, 32, TRUE, FALSE, "Labelled arc [a]"},
343 	};
344 uint floaticon_number = (int)(sizeof(floaticons)/sizeof(stkIcon));
345 
346 /* other icons  */
347 stkIcon eye_icon =
348 	{ eye_xpm, (Pixmap)-1, EYEICON, 0, 0, 22, 22, FALSE, FALSE, "View menu" };
349 stkIcon grid_icon =
350 	{ grid_xpm, (Pixmap)-1, GRIDICON, 0, 1, 25, 25, TRUE, TRUE, "Snap to grid [i]" };
351 stkIcon showgrid_icon =
352 	{ showgrid_xpm, (Pixmap)-1, SHOWGRIDICON, 25, 1, 25, 25, TRUE, TRUE, "Display grid [d]" };
353 stkIcon zoomin_icon =
354 	{ zoomin_xpm, (Pixmap)-1, ZOOMINICON, 50, 1, 25, 25, FALSE, FALSE, "Zoom in [+]" };
355 stkIcon zoomout_icon =
356 	{ zoomout_xpm, (Pixmap)-1, ZOOMOUTICON, 75, 1, 25, 25, FALSE, FALSE, "Zoom out [-]" };
357 stkIcon linestyle_icon =
358 	{ solid_xpm, (Pixmap)-1, LINESTYLEICON, 100, 1, 25, 25, FALSE, FALSE, "Set line style [y]" };
359 stkIcon colour_icon =
360 	{ NULL, (Pixmap)-1, COLOURICON, 125, 1, 25, 25, FALSE, FALSE, "Set pen colour [p]" };
361 stkIcon fillstyle_icon =
362 	{ NULL, (Pixmap)-1, FILLSTYLEICON, 150, 1, 25, 25, FALSE, FALSE, "Set fill style [z]" };
363 stkIcon fillcolour_icon =
364 	{ NULL, (Pixmap)-1, FILLCOLOURICON, 175, 1, 25, 25, FALSE, FALSE, "Set fill colour [q]" };
365 stkIcon arrow_icon =
366 	{ arrow_xpm, (Pixmap)-1, ARROWICON, 0, 1, 25, 25, FALSE, FALSE, "Arrow settings [m]" };
367 stkIcon setpolygon_icon =
368 	{ setpolygon_xpm, (Pixmap)-1, SETPOLYGONICON, 0, 1, 25, 25, FALSE, FALSE, "Polygon settings [h]" };
369 stkIcon endstyle_icon =
370 	{ roundend_xpm, (Pixmap)-1, ENDSTYLEICON, 0, 1, 25, 25, FALSE, FALSE, "Line end style [x]" };
371 stkIcon joinstyle_icon =
372 	{ roundjoin_xpm, (Pixmap)-1, JOINSTYLEICON, 0, 1, 25, 25, FALSE, FALSE, "Line join style [j]" };
373 stkIcon font_icon =
374 	{ font_xpm, (Pixmap)-1, FONTICON, 0, 1, 25, 25, FALSE, FALSE, "Text font settings [u]" };
375 stkIcon linewidth_icon =
376 	{ linewidth_xpm, (Pixmap)-1, LINEWIDTHICON, 0, 1, 25, 25, FALSE, FALSE, "Set line width [w]" };
377 stkIcon setspline_icon =
378 	{ setspline_xpm, (Pixmap)-1, SETSPLINEICON, 0, 1, 25, 25, FALSE, FALSE, "Spline settings [o]" };
379 stkIcon roundbox_icon =
380 	{ roundbox_xpm, (Pixmap)-1, ROUNDBOXICON, 0, 1, 25, 25, FALSE, FALSE, "Set rounded corners [v]" };
381 stkIcon justification_icon =
382 	{ leftjust_xpm, (Pixmap)-1, JUSTIFICATIONICON, 0, 1, 25, 25, FALSE, FALSE, "Set text justification [k]" };
383 stkIcon setarcellipse_icon =
384 	{ closedarcellipse_xpm, (Pixmap)-1, SETARCELLIPSEICON, 0, 1, 25, 25, FALSE, FALSE, "Set open/closed [o]" };
385 
386 /* icon containers  */
387 stkIconPanel icon_panel;
388 stkIconMenu icon_float;
389 Window float_menu;
390 
391 /* mini icon menus  */
392 stkIcon linestyleicons[] =
393 	{
394 		{ solid_xpm, (Pixmap)-1, SOLIDICON, 0, 0, 25, 25, TRUE, FALSE, "Solid" },
395 		{ dashed_xpm, (Pixmap)-1, DASHEDICON, 0, 0, 25, 25, TRUE, FALSE, "Dashes" },
396 		{ dotted_xpm, (Pixmap)-1, DOTTEDICON, 0, 0, 25, 25, TRUE, FALSE, "Dots" },
397 		{ dash_dotted_xpm, (Pixmap)-1, DASHDOTTEDICON, 0, 0, 25, 25, TRUE, FALSE, "Dash dots" },
398 		{ dash_double_dotted_xpm, (Pixmap)-1, DASHDOUBLEDOTTEDICON, 0, 0, 25, 25, TRUE, FALSE, "Dash double dots" },
399 		{ dash_triple_dotted_xpm, (Pixmap)-1, DASHTRIPLEDOTTEDICON, 0, 0, 25, 25, TRUE, FALSE, "Dash triple dots" },
400 	};
401 uint linestyleicon_number = (int)(sizeof(linestyleicons)/sizeof(stkIcon));
402 
403 stkIconMenu linestyle_float;
404 Window linestyle_menu;
405 
406 stkIcon justificationicons[] =
407 	{
408 		{ leftjust_xpm, (Pixmap)-1, LEFTJUSTICON, 0, 0, 25, 25, TRUE, FALSE, "Flush left" },
409 		{ centrejust_xpm, (Pixmap)-1, CENTREJUSTICON, 0, 0, 25, 25, TRUE, FALSE, "Centred" },
410 		{ rightjust_xpm, (Pixmap)-1, RIGHTJUSTICON, 0, 0, 25, 25, TRUE, FALSE, "Flush right" },
411 	};
412 uint justificationicon_number = (int)(sizeof(justificationicons)/sizeof(stkIcon));
413 
414 stkIconMenu justification_float;
415 Window justification_menu;
416 
417 stkIcon endstyleicons[] =
418 	{
419 		{ roundend_xpm, (Pixmap)-1, ROUNDENDICON, 0, 0, 25, 25, TRUE, FALSE, "Round line end" },
420 		{ flatend_xpm, (Pixmap)-1, FLATENDICON, 0, 0, 25, 25, TRUE, FALSE, "Flat line end" },
421 		{ projectingend_xpm, (Pixmap)-1, PROJECTINGENDICON, 0, 0, 25, 25, TRUE, FALSE, "Projecting line end" },
422 	};
423 uint endstyleicon_number = (int)(sizeof(endstyleicons)/sizeof(stkIcon));
424 
425 stkIconMenu endstyle_float;
426 Window endstyle_menu;
427 
428 stkIcon joinstyleicons[] =
429 	{
430 		{ roundjoin_xpm, (Pixmap)-1, ROUNDJOINICON, 0, 0, 25, 25, TRUE, FALSE, "Round join" },
431 		{ sharpjoin_xpm, (Pixmap)-1, SHARPJOINICON, 0, 0, 25, 25, TRUE, FALSE, "Sharp join" },
432 		{ beveljoin_xpm, (Pixmap)-1, BEVELJOINICON, 0, 0, 25, 25, TRUE, FALSE, "Bevelled join" },
433 	};
434 uint joinstyleicon_number = (int)(sizeof(joinstyleicons)/sizeof(stkIcon));
435 
436 stkIconMenu joinstyle_float;
437 Window joinstyle_menu;
438 
439 stkIcon setarcellipseicons[] =
440 	{
441 		{ openarcellipse_xpm, (Pixmap)-1, OPENARCELLIPSEICON, 0, 0, 25, 25, TRUE, FALSE, "Open (no fill)" },
442 		{ closedarcellipse_xpm, (Pixmap)-1, CLOSEDARCELLIPSEICON, 0, 0, 25, 25, TRUE, FALSE, "Closed (filled)" },
443 	};
444 uint setarcellipseicon_number = (int)(sizeof(setarcellipseicons)/sizeof(stkIcon));
445 
446 stkIconMenu setarcellipse_float;
447 Window setarcellipse_menu;
448 
449 /* for fill style menu  */
450 char *filltags[] =
451 	{
452 		"Solid",
453 		"Shade 1", "Shade 2", "Shade 3", "Shade 4", "Shade 5", "Shade 6", "Shade 7", "Shade 8",
454 		"Shade 9", "Shade 10", "Shade 11", "Shade 12", "Shade 13", "Shade 14", "Shade 15", "Shade 16", "Shade 17",
455 		"Shade 18", "Shade 19", "Black", "Left 30' lines", "Right 30' lines", "30' crosshatch", "Left 45' lines",
456 		"Right 45' lines", "45' crosshatch", "Bricks", "Vertical bricks", "Horizontal lines", "Vertical lines",
457 		"Crosshatch", "Right bricks", "Left bricks", "Left vertical bricks", "Right vertical bricks",
458 		"Scales", "Small scales", "Circles", "Hexagons", "Octagons", "Tire treads", "Vertical tire treads",
459 	};
460 
461 /* for colour menu  */
462 VColour cols[] =
463 	{
464 		{ "Blue 4",0, "#000090",CBLUE4 },
465 		{ "Blue 3",0, "#0000b0",CBLUE3 },
466 		{ "Blue 2",0, "#0000d0",CBLUE2 },
467 		{ "Blue",0, "blue",CBLUE },
468 		{ "Green 4",0, "#009000",CGREEN4 },
469 		{ "Green 3",0, "#00b000",CGREEN3 },
470 		{ "Green 2",0, "#00d000",CGREEN2 },
471 		{ "Green", 0, "green",CGREEN },
472 		{ "Cyan 4",0, "#009090",CCYAN4 },
473 		{ "Cyan 3",0, "#00b0b0",CCYAN3 },
474 		{ "Cyan 2",0, "#00d0d0",CCYAN2 },
475 		{ "Cyan",0, "cyan",CCYAN },
476 		{ "Red 4",0, "#900000",CRED4 },
477 		{ "Red 3",0, "#b00000",CRED3 },
478 		{ "Red 2",0, "#d00000",CRED2 },
479 		{ "Red", 0, "red",CRED },
480 		{ "Magenta 4",0, "#900090",CMAGENTA4 },
481 		{ "Magenta 3",0, "#b000b0",CMAGENTA3 },
482 		{ "Magenta 2",0, "#d000d0",CMAGENTA2 },
483 		{ "Magenta", 0, "magenta",CMAGENTA },
484 		{ "Brown 4",0, "#803000",CBROWN4 },
485 		{ "Brown 3",0, "#a04000",CBROWN3 },
486 		{ "Brown 2",0, "#c06000",CBROWN2 },
487 		{ "Gold",0, "gold",CGOLD },
488 		{ "Pink 4",0, "#ff8080",CPINK4 },
489 		{ "Pink 3",0, "#ffa0a0",CPINK3 },
490 		{ "Pink 2",0, "#ffc0c0",CPINK2 },
491 		{ "Pink",0, "#ffe0e0",CPINK },
492 		{ "Black",0, "black",CBLACK },
493 		{ "White", 0, "white",CWHITE },
494 		{ "Yellow", 0, "yellow",CYELLOW },
495 		{ "Light Blue",0, "#87ceff",CLIGHTBLUE },
496 	};
497 int numcols = sizeof(cols)/sizeof(VColour);
498 
499 /* for fill colour icon menu  */
500 VColour fillcols[] =
501 	{
502 		{ "Blue 4",0, "#000090",FILLCBLUE4 },
503 		{ "Blue 3",0, "#0000b0",FILLCBLUE3 },
504 		{ "Blue 2",0, "#0000d0",FILLCBLUE2 },
505 		{ "Blue",0, "blue",FILLCBLUE },
506 		{ "Green 4",0, "#009000",FILLCGREEN4 },
507 		{ "Green 3",0, "#00b000",FILLCGREEN3 },
508 		{ "Green 2",0, "#00d000",FILLCGREEN2 },
509 		{ "Green", 0, "green",FILLCGREEN },
510 		{ "Cyan 4",0, "#009090",FILLCCYAN4 },
511 		{ "Cyan 3",0, "#00b0b0",FILLCCYAN3 },
512 		{ "Cyan 2",0, "#00d0d0",FILLCCYAN2 },
513 		{ "Cyan",0, "cyan",FILLCCYAN },
514 		{ "Red 4",0, "#900000",FILLCRED4 },
515 		{ "Red 3",0, "#b00000",FILLCRED3 },
516 		{ "Red 2",0, "#d00000",FILLCRED2 },
517 		{ "Red", 0, "red",FILLCRED },
518 		{ "Magenta 4",0, "#900090",FILLCMAGENTA4 },
519 		{ "Magenta 3",0, "#b000b0",FILLCMAGENTA3 },
520 		{ "Magenta 2",0, "#d000d0",FILLCMAGENTA2 },
521 		{ "Magenta", 0, "magenta",FILLCMAGENTA },
522 		{ "Brown 4",0, "#803000",FILLCBROWN4 },
523 		{ "Brown 3",0, "#a04000",FILLCBROWN3 },
524 		{ "Brown 2",0, "#c06000",FILLCBROWN2 },
525 		{ "Gold",0, "gold",FILLCGOLD },
526 		{ "Pink 4",0, "#ff8080",FILLCPINK4 },
527 		{ "Pink 3",0, "#ffa0a0",FILLCPINK3 },
528 		{ "Pink 2",0, "#ffc0c0",FILLCPINK2 },
529 		{ "Pink",0, "#ffe0e0",FILLCPINK },
530 		{ "Black",0, "black",FILLCBLACK },
531 		{ "White", 0, "white",FILLCWHITE },
532 		{ "Yellow", 0, "yellow",FILLCYELLOW },
533 		{ "Light Blue",0, "#87ceff",FILLCLIGHTBLUE },
534 	};
535 int fillnumcols = sizeof(fillcols)/sizeof(VColour);
536 
537 /* pixmaps for fill style menu  */
538 Pixmap fills[NUM_FILLSTYLES];
539 Pixmap bfills[NUM_FILLSTYLES]; /* of depth one  */
540 Pixmap nofill;
541 
542 /* filled in by init.c  */
543 stkIcon *fillstyleicons;
544 uint fillstyleicon_number = NUM_FILLSTYLES;
545 stkIconMenu fillstyle_float;
546 Window fillstyle_menu;
547 Window colour_menu;
548 Window fillcolour_menu;
549 List afonts; /* VFont list of loaded fonts for text drawing */
550 
551 /* fonts aliases */
552 /* if the fonts on the left hand side aren't on your
553 	system, replace them with suitable values */
554 char *fontnames[40][2] =
555 	{
556 		{"-adobe-times-medium-r-normal-", "Times Roman" },
557 		{"-adobe-times-medium-i-normal-", "Times Italic" },
558 		{"-adobe-times-bold-r-normal-", "Times Bold" },
559 		{"-adobe-times-bold-i-normal-", "Times Bold Italic" },
560 		{"-schumacher-clean-medium-r-normal-", "Avant Garde Book" },
561 		{"-schumacher-clean-medium-i-normal-", "Avant Garde Book Oblique" },
562 		{"-schumacher-clean-bold-r-normal-", "Avant Garde Demi" },
563 		/* bold italic seems not available anywhere, use medium-i  */
564 		{"-schumacher-clean-medium-i-normal-", "Avant Garde Demi Oblique" },
565 		{"-adobe-times-medium-r-normal-", "Bookman Light" },
566 		{"-adobe-times-medium-i-normal-", "Bookman Light Italic" },
567 		{"-adobe-times-bold-r-normal-", "Bookman Demi" },
568 		{"-adobe-times-bold-i-normal-", "Bookman Demi Italic" },
569 		{"-adobe-courier-medium-r-normal-", "Courier" },
570 		{"-adobe-courier-medium-o-normal-", "Courier Oblique" },
571 		{"-adobe-courier-bold-r-normal-", "Courier Bold" },
572 		{"-adobe-courier-bold-o-normal-", "Courier Bold Oblique" },
573 		{"-adobe-helvetica-medium-r-normal-", "Helvetica" },
574 		{"-adobe-helvetica-medium-o-normal-", "Helvetica Oblique" },
575 		{"-adobe-helvetica-bold-r-normal-", "Helvetica Bold" },
576 		{"-adobe-helvetica-bold-o-normal-", "Helvetica Bold Oblique" },
577 		{"-adobe-helvetica-medium-r-normal-", "Helvetica Narrow" },
578 		{"-adobe-helvetica-medium-o-normal-", "Helvetica Narrow Oblique" },
579 		{"-adobe-helvetica-bold-r-normal-", "Helvetica Narrow Bold" },
580 		{"-adobe-helvetica-bold-o-normal-", "Helvetica Narrow Bold Oblique" },
581 		{"-adobe-new century schoolbook-medium-r-normal-", "New Century Schoolbook Roman" },
582 		{"-adobe-new century schoolbook-medium-i-normal-", "New Century Schoolbook Italic" },
583 		{"-adobe-new century schoolbook-bold-r-normal-", "New Century Schoolbook Bold" },
584 		{"-adobe-new century schoolbook-bold-i-normal-", "New Century Schoolbook Bold Italic" },
585 		{"-*-lucidabright-medium-r-normal-", "Palatino Roman" },
586 		{"-*-lucidabright-medium-i-normal-", "Palatino Italic" },
587 		{"-*-lucidabright-demibold-r-normal-", "Palatino Bold" },
588 		{"-*-lucidabright-demibold-i-normal-", "Palation Bold Italic" },
589 		{"-*-symbol-medium-r-normal-", "Symbol (Greek)" },
590 		{"-*-itc zapf chancery-medium-i-normal-", "Zapf Chancery Medium Italic" },
591 		{"-*-itc zapf dingbats-*-*-*-", "Dingbats" },
592 		{"-adobe-times-medium-r-normal-", "Latex Roman" },
593 		{"-adobe-times-medium-i-normal-", "Latex Italic" },
594 		{"-adobe-times-bold-r-normal-", "Latex Bold" },
595 		{"-adobe-helvetica-medium-r-normal-", "Latex Sans Serif" },
596 		{"-adobe-courier-medium-r-normal-", "Latex Typewriter" },
597 	};
598 int numfontnames= 40;
599 
600 /* paper sizes and fig2dev names  */
601 Papersize sizes[14] =
602 	{
603 		{ "Letter", "Letter", 8.5, 11.0 },
604 		{ "Legal", "Legal", 8.5, 14.0 },
605 		{ "Tabloid", "Tabloid", 11.0, 17.0 },
606 		{ "ANSI A", "A", 8.5, 11.0 },
607 		{ "ANSI B", "B", 11.0, 17.0 },
608 		{ "ANSI C", "C", 17.0, 22.0 },
609 		{ "ANSI D", "D", 22.0, 34.0 },
610 		{ "ANSI E", "E", 34.0, 34.0 },
611 		{ "ISO A4", "A4", 8.2677, 11.6929 },
612 		{ "ISO A3", "A3", 11.6929, 16.5354 },
613 		{ "ISO A2", "A2", 16.5354, 23.3858 },
614 		{ "ISO A1", "A1", 23.3858, 33.1102 },
615 		{ "ISO A0", "A0", 33.1102, 46.8110 },
616 	 	{ "JIS B5", "B5", 7.1654, 10.1181 },
617 	};
618