resources.h

Go to the documentation of this file.
00001 /*
00002  * FIG : Facility for Interactive Generation of figures
00003  * Copyright (c) 1985-1988 by Supoj Sutanthavibul
00004  * Parts Copyright (c) 1989-2002 by Brian V. Smith
00005  * Parts Copyright (c) 1991 by Paul King
00006  *
00007  * Any party obtaining a copy of these files is granted, free of charge, a
00008  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
00009  * nonexclusive right and license to deal in this software and
00010  * documentation files (the "Software"), including without limitation the
00011  * rights to use, copy, modify, merge, publish and/or distribute copies of
00012  * the Software, and to permit persons who receive copies from any such 
00013  * party to do so, with the only requirement being that this copyright 
00014  * notice remain intact.
00015  *
00016  */
00017 
00018 #ifndef RESOURCES_H
00019 #define RESOURCES_H
00020 
00021 #include "paintop.h"
00022 
00023 #define NUMSHADEPATS    21
00024 #define NUMTINTPATS     20
00025 #define NUMPATTERNS     22
00026 #define NUMFILLPATS     NUMSHADEPATS+NUMTINTPATS+NUMPATTERNS
00027 
00028 /* page sizes used when imported EPS has no bounding box or pdf has no /MediaBox */
00029 #define LETTER_WIDTH    10200
00030 #define LETTER_HEIGHT   13200
00031 #define A4_WIDTH         9921
00032 #define A4_HEIGHT       14031
00033 
00034 /* min, max zoom allowed */
00035 #define MIN_ZOOM        0.01
00036 #define MAX_ZOOM        100
00037 
00038 /* starting, min, max depth of objects on canvas */
00039 #define DEF_DEPTH       50
00040 #define MIN_DEPTH       0
00041 #define MAX_DEPTH       999
00042 
00043 /* min, max font size (points) */
00044 #define MIN_FONT_SIZE   1
00045 #define MAX_FONT_SIZE   500
00046 
00047 /* min, max font size on the display (after zooming) */
00048 /* this is necessary because some X servers crash completely
00049    when rendering very small fonts */
00050 #define MIN_X_FONT_SIZE 5
00051 #define MAX_X_FONT_SIZE MAX_FONT_SIZE
00052 
00053 /* maximum width of lines (Fig units) */
00054 #define MAX_LINE_WIDTH 500
00055 
00056 /* max number of sides for regular polygon */
00057 #define MIN_POLY_SIDES  3
00058 #define MAX_POLY_SIDES  200
00059 
00060 /* min, max vertical spacing when entering text (fraction of font size) */
00061 #define MIN_TEXT_STEP   0
00062 #define MAX_TEXT_STEP   100
00063 
00064 /* min, max arc-box corner radius (1/80 inch) */
00065 #define MIN_BOX_RADIUS  2
00066 #define MAX_BOX_RADIUS  1000
00067 
00068 /* number of standard colors */
00069 #define NUM_STD_COLS    32
00070 /* max number of user-defined colors */
00071 #define MAX_USR_COLS    512
00072 
00073 /* number of paper sizes (A4, B5, letter, etc. [see resources.c]) */
00074 #define NUMPAPERSIZES   29
00075 
00076 /* define these positions so we can start with default paper size */
00077 #define PAPER_LETTER    0
00078 #define PAPER_A4        13
00079 
00080 #define Color           int
00081 
00082 /* default number of colors to use for GIF/XPM */
00083 /* this can be overridden in resources or command-line arg */
00084 #define DEF_MAX_IMAGE_COLS 64
00085 
00086 /* max and default number of recently used files for File menu */
00087 #define MAX_RECENT_FILES        9
00088 #define DEF_RECENT_FILES        5
00089 
00090 /* for picture files */
00091 #define MAX_COLORMAP_SIZE       MAX_USR_COLS
00092 
00093 /* for JPEG export */
00094 #define DEF_JPEG_QUALITY        75
00095 
00096 /* default border margin for export */
00097 #define DEF_EXPORT_MARGIN       0
00098 
00099 /* for screen capture */
00100 
00101 #define IMAGE_PALETTE   0       /* colormapped screen capture */
00102 #define IMAGE_RGB       1       /* RGB (TrueColor) screen capture */
00103 
00104 struct Cmap {
00105         unsigned short red, green, blue;
00106         unsigned long pixel;
00107 };
00108 
00109 typedef struct {
00110                 char *name,
00111                      *rgb;
00112                 } fig_colors ;
00113 
00114 /* for the xfig icon */
00115 extern Pixmap            fig_icon;
00116 
00117 /* version string for xfig (generated in main() )*/
00118 extern char              xfig_version[];
00119 
00120 /* these are allocated in main() in case we aren't using default colormap 
00121    (so we can't use BlackPixelOfScreen... */
00122 
00123 extern XColor            black_color, white_color;
00124 
00125 /* original directory where xfig started */
00126 extern char              orig_dir[PATH_MAX+2];
00127 
00128 /* whether user is updating Fig files or loading one to view */
00129 extern Boolean           update_figs;
00130 
00131 #ifdef USE_XPM
00132 #include <xpm.h>
00133 extern XpmAttributes     xfig_icon_attr;
00134 #endif
00135 extern fig_colors        colorNames[NUM_STD_COLS + 1];
00136 extern char             *short_clrNames[NUM_STD_COLS + 1];
00137 extern Pixel             colors[NUM_STD_COLS+MAX_USR_COLS];
00138 extern XColor            user_colors[MAX_USR_COLS];
00139 extern XColor            undel_user_color;
00140 extern XColor            n_user_colors[MAX_USR_COLS];
00141 extern XColor            save_colors[MAX_USR_COLS];
00142 extern int               num_usr_cols, n_num_usr_cols;
00143 extern int               current_memory;
00144 extern Boolean           colorUsed[MAX_USR_COLS];
00145 extern Boolean           colorFree[MAX_USR_COLS];
00146 extern Boolean           n_colorFree[MAX_USR_COLS];
00147 extern Boolean           all_colors_available;
00148 extern Pixel             dark_gray_color, med_gray_color, lt_gray_color;
00149 extern Pixel             pageborder_color;
00150 extern Pixel             zero_lines_color;
00151 extern int               max_depth, min_depth;
00152 extern char              tool_name[200];
00153 extern int               export_background_color; /* current export/print background color */
00154 extern Boolean           display_fractions;     /* whether to display fractions in lengths */
00155 extern char             *userhome;              /* user's home directory */
00156 extern struct _pics     *pictures;              /* common repository to share imported pictures */
00157 extern float             scale_factor;          /* scale drawing as it is read in */
00158 
00159 /* number of colors we want to use for GIF/XPM images */
00160 extern int              avail_image_cols;
00161 /* colormap used for same */
00162 extern XColor           image_cells[MAX_COLORMAP_SIZE];
00163 
00164 /* resources structure */
00165 
00166 typedef struct _appres {
00167     Boolean         allownegcoords;     /* allow negative x/y coordinates for panning */
00168     int             balloon_delay;      /* delay (ms) before balloon pops up on */
00169     char           *boldFont;
00170     char           *browser;            /* browser for viewing html docs */
00171     int             but_per_row;        /* number of buttons wide for the mode panel */
00172     char           *buttonFont;
00173     char           *canvasbackground;
00174     char           *canvasforeground;
00175     Boolean         DEBUG;
00176     Boolean         dontswitchcmap;     /* don't allow switching of colormap */
00177     Boolean         installowncmap;     /* install our own private colormap */
00178     Boolean         drawzerolines;      /* draw lines through 0,0 (useful w/allow_neg_coords) */
00179     char           *exportLanguage;
00180     Boolean         flushleft;          /* center/flush-left printing */
00181     char           *geometry;
00182     char           *iconGeometry;
00183     char           *image_editor;       /* image editor (xv, etc) */
00184     Boolean         INCHES;
00185     int             internalborderwidth;
00186     int             jpeg_quality;       /* jpeg image quality */
00187     char           *keyFile;
00188     Boolean         landscape;
00189     Boolean         latexfonts;
00190     char           *library_dir;        /* for object library path */
00191     float           magnification;      /* export/print magnification */
00192     int             max_image_colors;   /* max colors to use for GIF/XPM images */
00193     Boolean         monochrome;
00194     Boolean         multiple;           /* multiple/single page for export/print */
00195     char           *normalFont;
00196     char           *pageborder;         /* color of page border */
00197     char           *paper_size;         /* ASCII size of paper (from command-line) */
00198     int             papersize;          /* size of paper */
00199     Boolean         RHS_PANEL;
00200     char           *pdf_viewer;         /* viewer for pdf docs */
00201     int             rulerthick;         /* thickness of rulers */
00202     Boolean         scalablefonts;      /* hns 5 Nov 91 */
00203     Boolean         ShowAllButtons;
00204     Boolean         showballoons;       /* show popup messages when user passes over buttons */
00205     Boolean         showlengths;        /* length/width lines when drawing or moving */
00206     Boolean         shownums;           /* print point numbers above polyline points */
00207     Boolean         show_pageborder;    /* show page border in color on canvas */
00208     Boolean         specialtext;
00209     char           *spellcheckcommand;  /* spell check command e.g. 
00210                                            "spell %s" or  "ispell -l < %s | sort -u" */
00211     int             spinner_delay;      /* delay (ms) before spinner counts automatically */
00212     int             spinner_rate;       /* rate (ms) at which spinner counts */
00213     int             startfillstyle;     /* starting fill style */
00214     float           startfontsize;      /* ges 6 Feb 91 */
00215     int             startgridmode;      /* starting grid mode */
00216     char           *startlatexFont;     /* bab 11 Jan 92 */
00217     int             startlinewidth;     /* starting line width */
00218     int             startposnmode;      /* starting point position mode */
00219     char           *startpsFont;        /* bab 11 Jan 92 */
00220     float           starttextstep;      /* starting multi-line text spacing */
00221     Boolean         tablet;             /* input tablet extension */
00222     float           tmp_height;
00223     float           tmp_width;
00224     Boolean         tracking;           /* mouse tracking in rulers */
00225     int             transparent;        /* transparent color for GIF export
00226                                                 (-2=none, -1=background) */
00227     float           userscale;          /* scale screen units to user units */
00228     char           *userunit;           /* user defined unit name */
00229     float           zoom;               /* starting zoom scale */
00230     char           *version;            /* version of the app-defaults file (compared with
00231                                            the version/patchlevel of xfig when starting */
00232     int             export_margin;      /* size of border around figure for export */
00233     Boolean         flipvisualhints;    /* switch left/right mouse indicator messages */
00234     Boolean         rigidtext;
00235     Boolean         hiddentext;
00236     Boolean         showdepthmanager;   /* whether or not to display the depth manager */
00237     char           *grid_color;         /* color of grid (when on) */
00238     int             smooth_factor;      /* smoothing factor when export to bitmap formats */
00239     Boolean         icon_view;          /* icon or list view of library objects */
00240     int             library_icon_size;  /* size of those icons */
00241     Boolean         splash;             /* whether or not to show the splash screen on startup */
00242     char           *zerolines;          /* color of zero-crossing lines on canvas */
00243     int             freehand_resolution; /* minimum spacing of points when drawing freehand */
00244     char           *tgrid_unit;         /* units of grid/point positioning (1/10" or 1/16") */
00245     Boolean         overlap;            /* overlap/no-overlap multiple pages for export/print */
00246     char           *ghostscript;        /* name of ghostscript (e.g. gs or gswin32) */
00247     Boolean         correct_font_size;  /* adjust for difference in Fig screen res vs points (80/72) */
00248     int             encoding;           /* encoding for latex escape translation */
00249 #ifdef I18N
00250     Boolean international;
00251     String font_menu_language;
00252     Boolean euc_encoding;
00253     Boolean latin_keyboard;
00254     Boolean always_use_fontset;
00255     XFontSet fixed_fontset;
00256     XFontSet normal_fontset;
00257     XFontSet bold_fontset;
00258     int fontset_size;
00259     String xim_input_style;
00260     String fig2dev_localize_option;
00261 #ifdef I18N_USE_PREEDIT
00262     String text_preedit;
00263 #endif
00264 #endif  /* I18N */
00265 
00266 }               appresStruct, *appresPtr;
00267 extern appresStruct appres;
00268 
00269 typedef struct {
00270     int             length, ascent, descent;
00271 }               pr_size;
00272 
00273 typedef struct {
00274     unsigned int    r_width, r_height, r_left, r_top;
00275 }               RectRec;
00276 
00277 typedef struct {
00278     int             type;
00279     char           *label;
00280     caddr_t         info;
00281 }               MenuItemRec;
00282 
00283 struct Menu {
00284     int             m_imagetype;
00285 #define MENU_IMAGESTRING        0x00    /* imagedata is char * */
00286 #define MENU_GRAPHIC            0x01    /* imagedata is pixrect * */
00287     caddr_t         m_imagedata;
00288     int             m_itemcount;
00289     MenuItemRec    *m_items;
00290     struct Menu    *m_next;
00291     caddr_t         m_data;
00292 };
00293 
00294 /* def for paper size list */
00295 struct paper_def {
00296     char  *sname;               /* short name e.g. 'A' */
00297     char  *fname;               /* full name e.g. 'A     (8.5" x 11")' */
00298     int    width,height;        /* size in Fig units e.g. 10200 13200 */
00299 };
00300 
00301 typedef struct Menu MenuRec;
00302 
00303 typedef XImage  *PIXRECT;
00304 typedef pr_size PR_SIZE;
00305 typedef RectRec RECT;
00306 
00307 extern float    ZOOM_FACTOR;
00308 extern float    PIC_FACTOR;
00309 
00310 extern Window   main_canvas;            /* main canvas window */
00311 extern Window   canvas_win;             /* current canvas */
00312 extern Window   msg_win, sideruler_win, topruler_win;
00313 
00314 extern Cursor   cur_cursor;
00315 extern Cursor   arrow_cursor, bull_cursor, buster_cursor, crosshair_cursor,
00316                 null_cursor, text_cursor, pick15_cursor, pick9_cursor,
00317                 panel_cursor, l_arrow_cursor, lr_arrow_cursor, r_arrow_cursor,
00318                 u_arrow_cursor, ud_arrow_cursor, d_arrow_cursor, wait_cursor,
00319                 magnify_cursor;
00320 
00321 extern Widget   tool;
00322 extern XtAppContext tool_app;
00323 
00324 extern Widget   canvas_sw, ps_fontmenu,         /* printer font menu tool */
00325                 latex_fontmenu,                 /* printer font menu tool */
00326                 msg_form, msg_panel, name_panel, cmd_form, mode_panel, 
00327                 d_label, e_label, mousefun,
00328                 ind_panel, ind_box, upd_ctrl,   /* indicator panel */
00329                 unitbox_sw, sideruler_sw, topruler_sw;
00330 
00331 extern Display *tool_d;
00332 extern Screen  *tool_s;
00333 extern Window   tool_w;
00334 extern Widget   tool_form;
00335 extern int      tool_sn;
00336 extern int      tool_vclass;
00337 extern Visual  *tool_v;
00338 extern int      tool_dpth;
00339 extern int      tool_cells;
00340 extern int      image_bpp;              /* # of bytes-per-pixel for images at this visual */
00341 extern int      screen_wd, screen_ht;   /* width and height of screen */
00342 extern Colormap tool_cm, newcmap;
00343 extern Boolean  swapped_cmap;
00344 extern Atom     wm_delete_window;
00345 extern int      num_recent_files;       /* number of recent files in list */
00346 extern int      max_recent_files;       /* user max number of recent files */
00347 extern int      splash_onscreen;        /* flag used to clear off splash graphic */
00348 
00349 extern GC       gc, button_gc, ind_button_gc, mouse_button_gc,
00350                 fill_color_gc, pen_color_gc, blank_gc, ind_blank_gc, 
00351                 mouse_blank_gc, gccache[NUMOPS], grid_gc,
00352                 fillgc, fill_gc[NUMFILLPATS],   /* fill style gc's */
00353                 tr_gc, tr_xor_gc, tr_erase_gc,  /* for the rulers */
00354                 sr_gc, sr_xor_gc, sr_erase_gc;
00355 
00356 extern Color    grid_color;
00357 extern Pixmap   fill_pm[NUMFILLPATS],fill_but_pm[NUMPATTERNS];
00358 extern float    fill_pm_zoom[NUMFILLPATS],fill_but_pm_zoom[NUMFILLPATS];
00359 extern XColor   x_fg_color, x_bg_color;
00360 extern unsigned long but_fg, but_bg;
00361 extern unsigned long ind_but_fg, ind_but_bg;
00362 extern unsigned long mouse_but_fg, mouse_but_bg;
00363 
00364 /* will contain environment variable XFIGTMPDIR, if any */
00365 extern char    *TMPDIR;
00366 
00367 /* will contain environment variable FIG2DEV_DIR, if any */
00368 extern char    *fig2dev_path;
00369 extern char     fig2dev_cmd[PATH_MAX];
00370 
00371 extern String  text_translations;
00372 
00373 /* for w_export.c and w_print.c */
00374 
00375 extern char    *orient_items[2];
00376 extern char    *just_items[2];
00377 extern struct   paper_def paper_sizes[NUMPAPERSIZES];
00378 extern char    *multiple_pages[2], *overlap_pages[2];
00379 
00380 /* for w_file.c and w_export.c */
00381 
00382 extern char    *offset_unit_items[3];
00383 #endif /* RESOURCES_H */
00384 
00385 extern int      RULER_WD;
00386 
00387 /* environment variable name definition for image editor used for screen capture */
00388 
00389 #define XFIG_ENV_GIF_EDITOR    getenv("XFIG_GIF_EDITOR")
00390 
00391 /* flag for when picture object is read in merge_file to see if need to remap
00392    existing picture colors */
00393 
00394 extern Boolean  pic_obj_read;
00395 
00396 typedef struct _recent_file_struct {
00397         char    *name;
00398         Widget  menu;
00399 } _recent_files;
00400 
00401 extern _recent_files recent_files[];
00402 

Generated on Sun Mar 4 15:03:49 2007 for Scilab [trunk] by  doxygen 1.5.1