1 /* 2 * FIG : Facility for Interactive Generation of figures 3 * Copyright (c) 1985-1988 by Supoj Sutanthavibul 4 * Parts Copyright (c) 1989-2015 by Brian V. Smith 5 * Parts Copyright (c) 1991 by Paul King 6 * Parts Copyright (c) 2016-2020 by Thomas Loimer 7 * 8 * Any party obtaining a copy of these files is granted, free of charge, a 9 * full and unrestricted irrevocable, world-wide, paid up, royalty-free, 10 * nonexclusive right and license to deal in this software and documentation 11 * files (the "Software"), including without limitation the rights to use, 12 * copy, modify, merge, publish, distribute, sublicense and/or sell copies of 13 * the Software, and to permit persons who receive copies from any such 14 * party to do so, with the only requirement being that the above copyright 15 * and this permission notice remain intact. 16 * 17 */ 18 19 20 #ifndef MODE_H 21 #define MODE_H 22 23 #if defined HAVE_CONFIG_H && !defined VERSION 24 #include "config.h" 25 #endif 26 27 #include <X11/Intrinsic.h> /* Boolean */ 28 #include <limits.h> /* PATH_MAX, below */ 29 #ifndef PATH_MAX 30 #define PATH_MAX 1024 31 #endif 32 33 #ifndef RESOURCES_H 34 #include "resources.h" 35 #endif 36 37 #define F_NULL 0 38 #define FIRST_DRAW_MODE F_CIRCLE_BY_RAD 39 #define F_CIRCLE_BY_RAD 1 40 #define F_CIRCLE_BY_DIA 2 41 #define F_ELLIPSE_BY_RAD 3 42 #define F_ELLIPSE_BY_DIA 4 43 #define F_CIRCULAR_ARC 5 44 #define F_POLYLINE 6 45 #define F_BOX 7 46 #define F_POLYGON 8 47 #define F_TEXT 9 48 #define F_APPROX_SPLINE 10 49 #define F_CLOSED_APPROX_SPLINE 11 50 #define F_INTERP_SPLINE 12 51 #define F_CLOSED_INTERP_SPLINE 13 52 #define F_ARCBOX 14 53 #define F_REGPOLY 15 54 #define F_PICOBJ 16 55 #define F_PLACE_LIB_OBJ 17 56 57 #define FIRST_EDIT_MODE F_GLUE 58 #define F_GLUE 30 59 #define F_BREAK 31 60 #define F_SCALE 32 61 #define F_ADD 33 62 #define F_COPY 34 63 #define F_MOVE 35 64 #define F_DELETE 36 65 #define F_MOVE_POINT 37 66 #define F_DELETE_POINT 38 67 #define F_ADD_POINT 39 68 #define F_DELETE_ARROW_HEAD 40 69 #define F_ADD_ARROW_HEAD 41 70 #define F_FLIP 42 71 #define F_ROTATE 43 72 #define F_AUTOARROW 44 73 #define F_CONVERT 45 74 #define F_EDIT 46 75 #define F_UPDATE 47 76 #define F_ALIGN 48 77 #define F_ZOOM 49 78 #define F_LOAD 50 79 #define F_ENTER_COMP 51 80 #define F_EXIT_COMP 52 81 #define F_EXIT_ALL_COMP 53 82 #define F_OPEN_CLOSE 54 83 #define F_SPLIT 55 84 #define F_JOIN 56 85 #define F_TANGENT 57 86 #define F_ANGLEMEAS 58 87 #define F_LENMEAS 59 88 #define F_AREAMEAS 60 89 #define F_PASTE 61 90 #define F_CHOP 62 91 92 extern int cur_mode; 93 94 /* alignment mode */ 95 #define ALIGN_NONE 0 96 #define ALIGN_LEFT 1 97 #define ALIGN_TOP 1 98 #define ALIGN_CENTER 2 99 #define ALIGN_RIGHT 3 100 #define ALIGN_BOTTOM 3 101 #define ALIGN_DISTRIB_C 4 102 #define ALIGN_DISTRIB_E 5 103 #define ALIGN_ABUT 6 104 105 extern int cur_halign; 106 extern int cur_valign; 107 108 /* angle geometry */ 109 #define L_UNCONSTRAINED 0 110 #define L_LATEXLINE 1 111 #define L_LATEXARROW 2 112 #define L_MOUNTHATTAN 3 113 #define L_MANHATTAN 4 114 #define L_MOUNTAIN 5 115 116 extern int manhattan_mode; 117 extern int mountain_mode; 118 extern int latexline_mode; 119 extern int latexarrow_mode; 120 121 /* arrow mode */ 122 #define L_NOARROWS 0 123 #define L_FARROWS 1 124 #define L_FBARROWS 2 125 #define L_BARROWS 3 126 127 extern int autoforwardarrow_mode; 128 extern int autobackwardarrow_mode; 129 130 /* grid subunit modes (mm, 1/16", 1/10") */ 131 #define NUM_GRID_UNITS 3 132 enum { MM_UNIT, FRACT_UNIT, TENTH_UNIT }; 133 134 /* grid mode */ 135 #define GRID_0 0 136 #define GRID_1 1 137 #define GRID_2 2 138 #define GRID_3 3 139 #define GRID_4 4 140 #define GRID_ISO_1 5 /* isometric grid */ 141 #define GRID_ISO_2 6 142 #define GRID_ISO_3 7 143 #define GRID_ISO_4 8 144 #define GRID_SQUARE 0 145 #define GRID_ISO 1 146 147 extern int cur_gridtype, cur_gridmode; 148 extern int cur_gridunit, old_gridunit, grid_unit; 149 extern int grid_spacing[NUM_GRID_UNITS][GRID_4]; 150 extern char *grid_name[NUM_GRID_UNITS][GRID_4+1]; 151 152 /* point position */ 153 #define P_ANY 0 154 #define P_MAGNET 1 155 #define P_GRID1 2 156 #define P_GRID2 3 157 #define P_GRID3 4 158 #define P_GRID4 5 159 160 extern int cur_pointposn; 161 extern int posn_rnd[NUM_GRID_UNITS][P_GRID4+1]; 162 163 /* rotn axis */ 164 #define UD_FLIP 1 165 #define LR_FLIP 2 166 167 extern float cur_rotnangle; 168 169 /* smart link mode */ 170 #define SMART_OFF 0 171 #define SMART_MOVE 1 172 #define SMART_SLIDE 2 173 174 extern int cur_linkmode; 175 176 /* misc */ 177 extern int action_on; 178 extern int highlighting; 179 extern int aborting; 180 extern int anypointposn; 181 extern int figure_modified; 182 extern int cur_numsides; 183 extern int cur_numcopies; 184 extern int cur_numxcopies; 185 extern int cur_numycopies; 186 extern char cur_fig_units[200]; 187 extern char cur_library_dir[PATH_MAX]; 188 extern char cur_image_editor[PATH_MAX]; 189 extern char cur_spellchk[PATH_MAX]; 190 extern char cur_browser[PATH_MAX]; 191 extern char cur_pdfviewer[PATH_MAX]; 192 extern Boolean warnexist; 193 194 extern void reset_modifiedflag(void); 195 extern void set_modifiedflag(void); 196 extern void reset_action_on(void); 197 extern void set_action_on(void); 198 199 /********************** global mode variables ************************/ 200 201 extern int num_point; 202 extern int min_num_points; 203 204 /*************************** Export Settings ****************************/ 205 206 /*********************************************************************/ 207 /* If you change the order of the LANG_xxx you must change the order */ 208 /* of the lang_texts[] and the LANG_items[] items in mode.c */ 209 /*********************************************************************/ 210 211 /* position of languages starting from 0 */ 212 enum { 213 LANG_PS, 214 LANG_EPS, 215 LANG_PDF, 216 LANG_PSPDF, 217 LANG_BOX, 218 LANG_LATEX, 219 LANG_PICT2E, 220 LANG_TIKZ, 221 LANG_PSTRICKS, 222 LANG_EPIC, 223 LANG_EEPIC, 224 LANG_EEPICEMU, 225 LANG_PSTEX, 226 LANG_PDFTEX, 227 LANG_PSPDFTEX, 228 LANG_PICTEX, 229 LANG_CGM, 230 LANG_EMF, 231 LANG_DXF, 232 LANG_GBX, 233 LANG_IBMGL, 234 LANG_MAP, 235 LANG_TEXTYL, 236 LANG_TPIC, 237 LANG_PIC, 238 LANG_MF, 239 LANG_MP, 240 LANG_TK, 241 LANG_PTK, 242 LANG_SHAPE, 243 LANG_SVG, 244 /* bitmap formats should follow here, starting with GIF */ 245 LANG_GIF, 246 LANG_JPEG, 247 LANG_PCX, 248 LANG_PNG, 249 LANG_PPM, 250 LANG_SLD, 251 LANG_TIFF, 252 LANG_XBM, 253 #ifdef USE_XPM 254 LANG_XPM, 255 #endif 256 END_OF_LANGS 257 }; 258 259 /* important for the menu dividing line */ 260 #define FIRST_BITMAP_LANG LANG_GIF 261 262 /* number of export languages */ 263 264 #define NUM_EXP_LANG END_OF_LANGS 265 266 extern int cur_exp_lang; 267 extern char *lang_items[NUM_EXP_LANG]; 268 extern char *lang_texts[NUM_EXP_LANG]; 269 extern Boolean batch_exists; 270 extern char batch_file[]; 271 272 /*************************** Mode Settings ****************************/ 273 274 extern int cur_objmask; 275 extern int cur_updatemask; 276 extern int new_objmask; 277 extern int cur_depth; 278 279 /*************************** Text Settings ****************************/ 280 281 extern int hidden_text_length; 282 extern float cur_textstep; 283 extern int cur_fontsize; 284 extern int cur_latex_font; 285 extern int cur_ps_font; 286 extern int cur_textjust; 287 extern int cur_textflags; 288 289 /******************************* Lines *********************************/ 290 291 extern int cur_linewidth; 292 extern int cur_linestyle; 293 extern int cur_joinstyle; 294 extern int cur_capstyle; 295 extern float cur_dashlength; 296 extern float cur_dotgap; 297 extern float cur_styleval; 298 extern Color cur_pencolor; 299 extern Color cur_fillcolor; 300 extern int cur_boxradius; 301 extern int cur_fillstyle; 302 extern int cur_arrowmode; 303 extern int cur_arrowtype; 304 extern float cur_arrowwidth; 305 extern float cur_arrowheight; 306 extern float cur_arrowthick; 307 extern float cur_arrow_multwidth; 308 extern float cur_arrow_multheight; 309 extern float cur_arrow_multthick; 310 extern Boolean use_abs_arrowvals; 311 extern int cur_arctype; 312 extern float cur_tangnormlen; 313 314 /*************************** Dimension lines ****************************/ 315 316 extern int cur_dimline_thick; 317 extern int cur_dimline_style; 318 extern int cur_dimline_color; 319 extern int cur_dimline_leftarrow; 320 extern int cur_dimline_rightarrow; 321 extern float cur_dimline_arrowlength; 322 extern float cur_dimline_arrowwidth; 323 extern Boolean cur_dimline_ticks; 324 extern int cur_dimline_tickthick; 325 extern int cur_dimline_boxthick; 326 extern int cur_dimline_boxcolor; 327 extern int cur_dimline_textcolor; 328 extern int cur_dimline_font; 329 extern int cur_dimline_fontsize; 330 extern int cur_dimline_psflag; 331 extern Boolean cur_dimline_fixed; 332 extern int cur_dimline_prec; 333 334 /**************************** Miscellaneous *****************************/ 335 336 extern float cur_elltextangle; /* text/ellipse input angle */ 337 extern char EMPTY_PIC[8]; 338 339 /*************************** File Settings ****************************/ 340 341 extern char cur_file_dir[]; 342 extern char cur_export_dir[]; 343 extern char cur_filename[]; 344 extern char save_filename[]; /* to undo load or "new" command */ 345 extern char file_header[]; 346 extern char cut_buf_name[]; /* path of .xfig cut buffer file */ 347 extern char xfigrc_name[]; /* path of .xfigrc file */ 348 349 #endif /* MODE_H */ 350