File: resources.h

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (402 lines) | stat: -rw-r--r-- 13,943 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
/*
 * FIG : Facility for Interactive Generation of figures
 * Copyright (c) 1985-1988 by Supoj Sutanthavibul
 * Parts Copyright (c) 1989-2002 by Brian V. Smith
 * Parts Copyright (c) 1991 by Paul King
 *
 * Any party obtaining a copy of these files is granted, free of charge, a
 * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
 * nonexclusive right and license to deal in this software and
 * documentation files (the "Software"), including without limitation the
 * rights to use, copy, modify, merge, publish and/or distribute copies of
 * the Software, and to permit persons who receive copies from any such 
 * party to do so, with the only requirement being that this copyright 
 * notice remain intact.
 *
 */

#ifndef RESOURCES_H
#define RESOURCES_H

#include "paintop.h"

#define NUMSHADEPATS	21
#define NUMTINTPATS	20
#define NUMPATTERNS	22
#define NUMFILLPATS	NUMSHADEPATS+NUMTINTPATS+NUMPATTERNS

/* page sizes used when imported EPS has no bounding box or pdf has no /MediaBox */
#define LETTER_WIDTH	10200
#define LETTER_HEIGHT	13200
#define A4_WIDTH	 9921
#define A4_HEIGHT	14031

/* min, max zoom allowed */
#define	MIN_ZOOM	0.01
#define	MAX_ZOOM	100

/* starting, min, max depth of objects on canvas */
#define DEF_DEPTH	50
#define MIN_DEPTH	0
#define MAX_DEPTH	999

/* min, max font size (points) */
#define MIN_FONT_SIZE	1
#define MAX_FONT_SIZE	500

/* min, max font size on the display (after zooming) */
/* this is necessary because some X servers crash completely
   when rendering very small fonts */
#define MIN_X_FONT_SIZE	5
#define MAX_X_FONT_SIZE	MAX_FONT_SIZE

/* maximum width of lines (Fig units) */
#define MAX_LINE_WIDTH 500

/* max number of sides for regular polygon */
#define MIN_POLY_SIDES	3
#define MAX_POLY_SIDES	200

/* min, max vertical spacing when entering text (fraction of font size) */
#define MIN_TEXT_STEP	0
#define MAX_TEXT_STEP	100

/* min, max arc-box corner radius (1/80 inch) */
#define MIN_BOX_RADIUS	2
#define MAX_BOX_RADIUS	1000

/* number of standard colors */
#define NUM_STD_COLS	32
/* max number of user-defined colors */
#define MAX_USR_COLS	512

/* number of paper sizes (A4, B5, letter, etc. [see resources.c]) */
#define NUMPAPERSIZES	29

/* define these positions so we can start with default paper size */
#define PAPER_LETTER	0
#define PAPER_A4	13

#define	Color		int

/* default number of colors to use for GIF/XPM */
/* this can be overridden in resources or command-line arg */
#define DEF_MAX_IMAGE_COLS 64

/* max and default number of recently used files for File menu */
#define MAX_RECENT_FILES	9
#define DEF_RECENT_FILES	5

/* for picture files */
#define	MAX_COLORMAP_SIZE	MAX_USR_COLS

/* for JPEG export */
#define	DEF_JPEG_QUALITY	75

/* default border margin for export */
#define DEF_EXPORT_MARGIN	0

/* for screen capture */

#define	IMAGE_PALETTE	0	/* colormapped screen capture */
#define IMAGE_RGB	1	/* RGB (TrueColor) screen capture */

struct Cmap {
	unsigned short red, green, blue;
	unsigned long pixel;
};

typedef struct {
		char *name,
		     *rgb;
		} fig_colors ;

/* for the xfig icon */
extern Pixmap		 fig_icon;

/* version string for xfig (generated in main() )*/
extern char		 xfig_version[];

/* these are allocated in main() in case we aren't using default colormap 
   (so we can't use BlackPixelOfScreen... */

extern XColor		 black_color, white_color;

/* original directory where xfig started */
extern char		 orig_dir[PATH_MAX+2];

/* whether user is updating Fig files or loading one to view */
extern Boolean		 update_figs;

#ifdef USE_XPM
#include <xpm.h>
extern XpmAttributes	 xfig_icon_attr;
#endif
extern fig_colors	 colorNames[NUM_STD_COLS + 1];
extern char		*short_clrNames[NUM_STD_COLS + 1];
extern Pixel		 colors[NUM_STD_COLS+MAX_USR_COLS];
extern XColor		 user_colors[MAX_USR_COLS];
extern XColor		 undel_user_color;
extern XColor		 n_user_colors[MAX_USR_COLS];
extern XColor		 save_colors[MAX_USR_COLS];
extern int		 num_usr_cols, n_num_usr_cols;
extern int		 current_memory;
extern Boolean		 colorUsed[MAX_USR_COLS];
extern Boolean		 colorFree[MAX_USR_COLS];
extern Boolean		 n_colorFree[MAX_USR_COLS];
extern Boolean		 all_colors_available;
extern Pixel		 dark_gray_color, med_gray_color, lt_gray_color;
extern Pixel		 pageborder_color;
extern Pixel		 zero_lines_color;
extern int		 max_depth, min_depth;
extern char		 tool_name[200];
extern int		 export_background_color; /* current export/print background color */
extern Boolean		 display_fractions;	/* whether to display fractions in lengths */
extern char		*userhome;		/* user's home directory */
extern struct _pics	*pictures;		/* common repository to share imported pictures */
extern float		 scale_factor;		/* scale drawing as it is read in */

/* number of colors we want to use for GIF/XPM images */
extern int		avail_image_cols;
/* colormap used for same */
extern XColor		image_cells[MAX_COLORMAP_SIZE];

/* resources structure */

typedef struct _appres {
    Boolean	    allownegcoords;	/* allow negative x/y coordinates for panning */
    int		    balloon_delay;	/* delay (ms) before balloon pops up on */
    char	   *boldFont;
    char	   *browser;		/* browser for viewing html docs */
    int		    but_per_row;	/* number of buttons wide for the mode panel */
    char	   *buttonFont;
    char	   *canvasbackground;
    char	   *canvasforeground;
    Boolean	    DEBUG;
    Boolean	    dontswitchcmap;	/* don't allow switching of colormap */
    Boolean	    installowncmap;	/* install our own private colormap */
    Boolean	    drawzerolines;	/* draw lines through 0,0 (useful w/allow_neg_coords) */
    char	   *exportLanguage;
    Boolean	    flushleft;		/* center/flush-left printing */
    char	   *geometry;
    char	   *iconGeometry;
    char	   *image_editor;	/* image editor (xv, etc) */
    Boolean	    INCHES;
    int		    internalborderwidth;
    int		    jpeg_quality;	/* jpeg image quality */
    char	   *keyFile;
    Boolean	    landscape;
    Boolean	    latexfonts;
    char	   *library_dir;	/* for object library path */
    float	    magnification;	/* export/print magnification */
    int		    max_image_colors;	/* max colors to use for GIF/XPM images */
    Boolean	    monochrome;
    Boolean	    multiple;		/* multiple/single page for export/print */
    char	   *normalFont;
    char	   *pageborder;		/* color of page border */
    char	   *paper_size;		/* ASCII size of paper (from command-line) */
    int		    papersize;		/* size of paper */
    Boolean	    RHS_PANEL;
    char	   *pdf_viewer;		/* viewer for pdf docs */
    int		    rulerthick;		/* thickness of rulers */
    Boolean	    scalablefonts;	/* hns 5 Nov 91 */
    Boolean	    ShowAllButtons;
    Boolean	    showballoons;	/* show popup messages when user passes over buttons */
    Boolean	    showlengths;	/* length/width lines when drawing or moving */
    Boolean	    shownums;		/* print point numbers above polyline points */
    Boolean	    show_pageborder;	/* show page border in color on canvas */
    Boolean	    specialtext;
    char	   *spellcheckcommand;	/* spell check command e.g. 
					   "spell %s" or  "ispell -l < %s | sort -u" */
    int		    spinner_delay;	/* delay (ms) before spinner counts automatically */
    int		    spinner_rate;	/* rate (ms) at which spinner counts */
    int		    startfillstyle;	/* starting fill style */
    float	    startfontsize;	/* ges 6 Feb 91 */
    int		    startgridmode;	/* starting grid mode */
    char	   *startlatexFont;	/* bab 11 Jan 92 */
    int		    startlinewidth;	/* starting line width */
    int		    startposnmode;	/* starting point position mode */
    char	   *startpsFont;	/* bab 11 Jan 92 */
    float	    starttextstep;	/* starting multi-line text spacing */
    Boolean	    tablet;		/* input tablet extension */
    float	    tmp_height;
    float	    tmp_width;
    Boolean	    tracking;		/* mouse tracking in rulers */
    int		    transparent;	/* transparent color for GIF export
						(-2=none, -1=background) */
    float	    userscale;		/* scale screen units to user units */
    char	   *userunit;		/* user defined unit name */
    float	    zoom;		/* starting zoom scale */
    char	   *version;		/* version of the app-defaults file (compared with
					   the version/patchlevel of xfig when starting */
    int		    export_margin;	/* size of border around figure for export */
    Boolean	    flipvisualhints;	/* switch left/right mouse indicator messages */
    Boolean	    rigidtext;
    Boolean	    hiddentext;
    Boolean	    showdepthmanager;	/* whether or not to display the depth manager */
    char	   *grid_color;		/* color of grid (when on) */
    int		    smooth_factor;	/* smoothing factor when export to bitmap formats */
    Boolean	    icon_view;		/* icon or list view of library objects */
    int		    library_icon_size;	/* size of those icons */
    Boolean	    splash;		/* whether or not to show the splash screen on startup */
    char	   *zerolines;		/* color of zero-crossing lines on canvas */
    int		    freehand_resolution; /* minimum spacing of points when drawing freehand */
    char	   *tgrid_unit;		/* units of grid/point positioning (1/10" or 1/16") */
    Boolean	    overlap;		/* overlap/no-overlap multiple pages for export/print */
    char	   *ghostscript;	/* name of ghostscript (e.g. gs or gswin32) */
    Boolean	    correct_font_size;	/* adjust for difference in Fig screen res vs points (80/72) */
    int		    encoding;		/* encoding for latex escape translation */
#ifdef I18N
    Boolean international;
    String font_menu_language;
    Boolean euc_encoding;
    Boolean latin_keyboard;
    Boolean always_use_fontset;
    XFontSet fixed_fontset;
    XFontSet normal_fontset;
    XFontSet bold_fontset;
    int fontset_size;
    String xim_input_style;
    String fig2dev_localize_option;
#ifdef I18N_USE_PREEDIT
    String text_preedit;
#endif
#endif  /* I18N */

}		appresStruct, *appresPtr;
extern appresStruct appres;

typedef struct {
    int		    length, ascent, descent;
}		pr_size;

typedef struct {
    unsigned int    r_width, r_height, r_left, r_top;
}		RectRec;

typedef struct {
    int		    type;
    char	   *label;
    caddr_t	    info;
}		MenuItemRec;

struct Menu {
    int		    m_imagetype;
#define MENU_IMAGESTRING	0x00	/* imagedata is char * */
#define MENU_GRAPHIC		0x01	/* imagedata is pixrect * */
    caddr_t	    m_imagedata;
    int		    m_itemcount;
    MenuItemRec	   *m_items;
    struct Menu	   *m_next;
    caddr_t	    m_data;
};

/* def for paper size list */
struct paper_def {
    char  *sname;		/* short name e.g. 'A' */
    char  *fname;		/* full name e.g. 'A     (8.5" x 11")' */
    int	   width,height;	/* size in Fig units e.g. 10200 13200 */
};

typedef struct Menu MenuRec;

typedef XImage	*PIXRECT;
typedef pr_size	PR_SIZE;
typedef RectRec	RECT;

extern float	ZOOM_FACTOR;
extern float	PIC_FACTOR;

extern Window	main_canvas;		/* main canvas window */
extern Window	canvas_win;		/* current canvas */
extern Window	msg_win, sideruler_win, topruler_win;

extern Cursor	cur_cursor;
extern Cursor	arrow_cursor, bull_cursor, buster_cursor, crosshair_cursor,
		null_cursor, text_cursor, pick15_cursor, pick9_cursor,
		panel_cursor, l_arrow_cursor, lr_arrow_cursor, r_arrow_cursor,
		u_arrow_cursor, ud_arrow_cursor, d_arrow_cursor, wait_cursor,
		magnify_cursor;

extern Widget	tool;
extern XtAppContext tool_app;

extern Widget	canvas_sw, ps_fontmenu,		/* printer font menu tool */
		latex_fontmenu, 		/* printer font menu tool */
		msg_form, msg_panel, name_panel, cmd_form, mode_panel, 
		d_label, e_label, mousefun,
		ind_panel, ind_box, upd_ctrl,	/* indicator panel */
		unitbox_sw, sideruler_sw, topruler_sw;

extern Display *tool_d;
extern Screen  *tool_s;
extern Window	tool_w;
extern Widget   tool_form;
extern int	tool_sn;
extern int	tool_vclass;
extern Visual  *tool_v;
extern int	tool_dpth;
extern int	tool_cells;
extern int	image_bpp;		/* # of bytes-per-pixel for images at this visual */
extern int	screen_wd, screen_ht;	/* width and height of screen */
extern Colormap	tool_cm, newcmap;
extern Boolean	swapped_cmap;
extern Atom	wm_delete_window;
extern int	num_recent_files;	/* number of recent files in list */
extern int	max_recent_files;	/* user max number of recent files */
extern int	splash_onscreen;	/* flag used to clear off splash graphic */

extern GC	gc, button_gc, ind_button_gc, mouse_button_gc,
		fill_color_gc, pen_color_gc, blank_gc, ind_blank_gc, 
		mouse_blank_gc, gccache[NUMOPS], grid_gc,
		fillgc, fill_gc[NUMFILLPATS],	/* fill style gc's */
		tr_gc, tr_xor_gc, tr_erase_gc,	/* for the rulers */
		sr_gc, sr_xor_gc, sr_erase_gc;

extern Color	grid_color;
extern Pixmap	fill_pm[NUMFILLPATS],fill_but_pm[NUMPATTERNS];
extern float	fill_pm_zoom[NUMFILLPATS],fill_but_pm_zoom[NUMFILLPATS];
extern XColor	x_fg_color, x_bg_color;
extern unsigned long but_fg, but_bg;
extern unsigned long ind_but_fg, ind_but_bg;
extern unsigned long mouse_but_fg, mouse_but_bg;

/* will contain environment variable XFIGTMPDIR, if any */
extern char    *TMPDIR;

/* will contain environment variable FIG2DEV_DIR, if any */
extern char    *fig2dev_path;
extern char     fig2dev_cmd[PATH_MAX];

extern String  text_translations;

/* for w_export.c and w_print.c */

extern char    *orient_items[2];
extern char    *just_items[2];
extern struct   paper_def paper_sizes[NUMPAPERSIZES];
extern char    *multiple_pages[2], *overlap_pages[2];

/* for w_file.c and w_export.c */

extern char    *offset_unit_items[3];
#endif /* RESOURCES_H */

extern int	RULER_WD;

/* environment variable name definition for image editor used for screen capture */

#define XFIG_ENV_GIF_EDITOR    getenv("XFIG_GIF_EDITOR")

/* flag for when picture object is read in merge_file to see if need to remap
   existing picture colors */

extern Boolean	pic_obj_read;

typedef struct _recent_file_struct {
	char	*name;
	Widget	menu;
} _recent_files;

extern _recent_files recent_files[];