1 /*----------------------------------------------------------------------*/
3 /* Copyright (c) 2002 Tim Edwards, Johns Hopkins University */
4 /*----------------------------------------------------------------------*/
6 /*----------------------------------------------------------------------*/
7 /* written by Tim Edwards, 8/20/93 */
8 /*----------------------------------------------------------------------*/
11 typedef unsigned char u_char
;
12 typedef unsigned short u_short
;
13 typedef unsigned int u_int
;
14 typedef unsigned long u_long
;
15 typedef unsigned long long u_long_long
;
27 #include <cairo/cairo.h>
30 /*----------------------------------------------------------------------*/
31 /* portable definition to prevent unused variables warning */
32 /*----------------------------------------------------------------------*/
34 #define UNUSED(x) (void) x
36 /*----------------------------------------------------------------------*/
37 /* Graphics functions defined for X11 */
38 /*----------------------------------------------------------------------*/
42 #define SetForeground(display, gc, fg) xc_cairo_set_color(fg)
43 typedef cairo_surface_t xcImage
;
45 #else /* !HAVE_CAIRO */
47 typedef XImage xcImage
;
48 #define DrawLine XDrawLine
49 #define DrawLines XDrawLines
50 #define DrawPoint XDrawPoint
51 #define FillPolygon XFillPolygon
53 #define SetForeground(dpy, gc, fg) XSetForeground(dpy, gc, colorlist[fg].color.pixel)
54 #define SetBackground(dpy, gc, bg) XSetBackground(dpy, gc, colorlist[bg].color.pixel)
55 #define SetThinLineAttributes XSetLineAttributes
56 #define SetLineAttributes(a, b, c, d, e, f) \
57 XSetLineAttributes(a, b, ((c) >= 1.55 ? (int)(c + 0.45) : 0), d, e, f)
58 #define SetDashes XSetDashes
59 #define SetFillStyle XSetFillStyle
60 #define SetStipple(a,b,c) XSetStipple(a,b,STIPPLE[c])
62 #endif /* !HAVE_CAIRO */
66 /*----------------------------------------------------------------------*/
67 /* Redefinition of fprintf() allows redirection of output to a console */
68 /* in the Tcl interpreter-based version. */
69 /*----------------------------------------------------------------------*/
72 #define Fprintf tcl_printf
73 #define Flush tcl_stdflush
75 #define Fprintf fprintf
80 #define malloc Tcl_Alloc
81 /* (see definition of my_calloc in the asg subdirectory) */
82 /* #define calloc(a,b) Tcl_Alloc(a * b) */
83 #define free(a) Tcl_Free((char *)(a))
84 #define realloc(a,b) Tcl_Realloc((char *)(a), b)
86 #define strdup Tcl_Strdup
87 extern char *Tcl_Strdup(const char *);
90 /*----------------------------------------------------------------------*/
91 /* Deal with 32/64 bit processors based on autoconf results. */
92 /*----------------------------------------------------------------------*/
95 #error "SIZEOF_VOID_P undefined!"
97 #ifndef SIZEOF_UNSIGNED_INT
98 #error "SIZEOF_UNSIGNED_INT undefined!"
100 #ifndef SIZEOF_UNSIGNED_LONG
101 #error "SIZEOF_UNSIGNED_LONG undefined!"
103 #ifndef SIZEOF_UNSIGNED_LONG_LONG
104 #error "SIZEOF_UNSIGNED_LONG_LONG undefined!"
107 #if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT
108 #define Number(a) (void *)((u_int) a)
109 typedef u_int pointertype
;
110 #elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG
111 #define Number(a) (void *)((u_long) a)
112 typedef u_long pointertype
;
113 #elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG_LONG
114 #define Number(a) (void *)((u_long_long) a)
115 typedef u_long_long pointertype
;
117 ERROR
: Cannot compile without knowing the size of a pointer
. See xcircuit
.h
.
120 /*----------------------------------------------------------------------*/
121 /* Basic element types */
123 /* These values determine how a genericptr should be cast into one of */
124 /* labelptr, polyptr, etc. To query the element type, use the macros */
125 /* ELEMENTTYPE(), IS_LABEL(), IS_POLYGON(), etc. These macros mask the */
126 /* bit field. Note that an element marked with REMOVE_TAG will not be */
127 /* recognized as any valid element, but otherwise, querying the type is */
128 /* transparent to other bit settings (such as NETLIST_INVALID). */
129 /*----------------------------------------------------------------------*/
131 /* Single-bit flags */
139 #define ARRAY 0x80 /* reserved; unused, for now. */
141 #define REMOVE_TAG 0x100 /* element to be removed from netlist */
142 #define NETLIST_INVALID 0x200 /* this element invalidates the netlist */
143 #define SELECT_HIDE 0x400 /* this element cannot be selected */
144 #define DRAW_HIDE 0x800 /* this element is not drawn. */
147 #define ALL_TYPES (OBJINST | LABEL | POLYGON | ARC | SPLINE | PATH \
149 #define VALID_TYPES (REMOVE_TAG | ALL_TYPES)
151 /*----------------------------------------------------------------------*/
152 /* Definition shortcuts */
153 /*----------------------------------------------------------------------*/
155 #define XtnSetArg(a,b) XtSetArg(wargs[n], a, b); n++
156 #define abs(a) ((a) < 0 ? -(a) : (a))
157 #define sign(a) ((a) <= 0 ? -1 : 1)
159 #define max(a,b) ((a) < (b) ? (b) : (a))
160 #define min(a,b) ((a) < (b) ? (a) : (b))
163 /*----------------------------------------------------------------------*/
164 /* Lengthier define constructs */
165 /*----------------------------------------------------------------------*/
167 /* Names used for convenience throughout the source code */
169 #define eventmode areawin->event_mode
170 #define topobject areawin->topinstance->thisobject
171 #define hierobject areawin->hierstack->thisinst->thisobject
173 #define PLIST_INCR(a) \
174 (a)->plist = (genericptr *) realloc ((a)->plist, \
175 ((a)->parts + 1) * sizeof(genericptr))
177 #define ENDPART topobject->plist + topobject->parts - 1
178 #define EDITPART topobject->plist + *areawin->selectlist
180 /* Type checks (argument "a" is type genericptr) */
182 #define ELEMENTTYPE(a) ((a)->type & VALID_TYPES)
184 #define IS_POLYGON(a) (ELEMENTTYPE(a) == POLYGON)
185 #define IS_LABEL(a) (ELEMENTTYPE(a) == LABEL)
186 #define IS_OBJINST(a) (ELEMENTTYPE(a) == OBJINST)
187 #define IS_ARC(a) (ELEMENTTYPE(a) == ARC)
188 #define IS_SPLINE(a) (ELEMENTTYPE(a) == SPLINE)
189 #define IS_PATH(a) (ELEMENTTYPE(a) == PATH)
190 #define IS_GRAPHIC(a) (ELEMENTTYPE(a) == GRAPHIC)
191 #define IS_ARRAY(a) (ELEMENTTYPE(a) == ARRAY)
193 /* Conversions from generic to specific types */
194 /* specifically, from type (genericptr *) to type (polyptr), etc. */
196 #define TOPOLY(a) (*((polyptr *)(a)))
197 #define TOLABEL(a) (*((labelptr *)(a)))
198 #define TOOBJINST(a) (*((objinstptr *)(a)))
199 #define TOARC(a) (*((arcptr *)(a)))
200 #define TOSPLINE(a) (*((splineptr *)(a)))
201 #define TOPATH(a) (*((pathptr *)(a)))
202 #define TOGRAPHIC(a) (*((graphicptr *)(a)))
203 #define TOGENERIC(a) (*((genericptr *)(a)))
205 /* conversions from a selection to a specific type */
207 #define SELTOGENERICPTR(a) ((areawin->hierstack == NULL) ? \
208 (topobject->plist + *(a)) : \
209 (hierobject->plist + *(a)))
211 #define SELTOPOLY(a) TOPOLY(SELTOGENERICPTR(a))
212 #define SELTOLABEL(a) TOLABEL(SELTOGENERICPTR(a))
213 #define SELTOOBJINST(a) TOOBJINST(SELTOGENERICPTR(a))
214 #define SELTOARC(a) TOARC(SELTOGENERICPTR(a))
215 #define SELTOSPLINE(a) TOSPLINE(SELTOGENERICPTR(a))
216 #define SELTOPATH(a) TOPATH(SELTOGENERICPTR(a))
217 #define SELTOGRAPHIC(a) TOGRAPHIC(SELTOGENERICPTR(a))
218 #define SELTOGENERIC(a) TOGENERIC(SELTOGENERICPTR(a))
220 #define SELECTTYPE(a) ((SELTOGENERIC(a))->type & ALL_TYPES)
221 #define SELTOCOLOR(a) ((SELTOGENERIC(a))->color)
224 /* creation of new elements */
226 #define NEW_POLY(a,b) \
228 a = (polyptr *)b->plist + b->parts; \
229 *a = (polyptr) malloc(sizeof(polygon)); \
232 #define NEW_LABEL(a,b) \
234 a = (labelptr *)b->plist + b->parts; \
235 *a = (labelptr) malloc(sizeof(label)); \
238 #define NEW_OBJINST(a,b) \
240 a = (objinstptr *)b->plist + b->parts; \
241 *a = (objinstptr) malloc(sizeof(objinst)); \
244 #define NEW_ARC(a,b) \
246 a = (arcptr *)b->plist + b->parts; \
247 *a = (arcptr) malloc(sizeof(arc)); \
250 #define NEW_SPLINE(a,b) \
252 a = (splineptr *)b->plist + b->parts; \
253 *a = (splineptr) malloc(sizeof(spline)); \
256 #define NEW_PATH(a,b) \
258 a = (pathptr *)b->plist + b->parts; \
259 *a = (pathptr) malloc(sizeof(path)); \
262 #define NEW_GRAPHIC(a,b) \
264 a = (graphicptr *)b->plist + b->parts; \
265 *a = (graphicptr) malloc(sizeof(graphic)); \
269 /*----------------------------------------------------------------------*/
280 short width
, ascent
, descent
, base
;
285 float *padding
; /* Allocated array of padding info per line */
286 XPoint
*tbreak
; /* Position in text to stop */
287 short dostop
; /* Location (index) in text to stop */
288 short line
; /* Stop line number, if using dostop or tbreak. */
291 /*----------------------------------------------------------------------*/
292 /* Implementation-specific definitions */
293 /*----------------------------------------------------------------------*/
295 #define LIBS 5 /* initial number of library pages */
296 #define PAGES 10 /* default number of top-level pages */
297 #define SCALEFAC 1.5 /* zoom in/out scaling multiplier */
298 #define SUBSCALE 0.67 /* ratio of subscript size to normal script size */
299 #define SBARSIZE 13 /* Pixel size of the scrollbar */
300 #define RSTEPS 72 /* Number of points defining a circle approx. */
301 #define SPLINESEGS 20 /* Number of points per spline approximation */
302 #define DELBUFSIZE 10 /* Number of delete events to save for undeleting */
303 #define MINAUTOSCALE 0.75 /* Won't automatically scale closer than this */
304 #define MAXCHANGES 20 /* Number of changes to induce a temp file save */
305 #define STIPPLES 8 /* Number of predefined stipple patterns */
306 #define PADSPACE 10 /* Spacing of pinlabels from their origins */
309 #define TBBORDER 1 /* border around toolbar buttons */
315 #define INTSEGS (SPLINESEGS - 2)
316 #define LASTSEG (SPLINESEGS - 3)
318 #define NOFILENAME (char *)(-1)
320 #define FONTHEIGHT(y) (y->ascent + y->descent + 6)
321 #define ROWHEIGHT FONTHEIGHT(appdata.xcfont)
322 #define FILECHARASCENT (appdata.filefont->ascent)
323 #define FILECHARHEIGHT (FILECHARASCENT + appdata.filefont->descent)
324 #define LISTHEIGHT 200
325 #define TEXTHEIGHT 28 /* Height of xcircuit vectored font at nominal size */
326 #define BASELINE 40 /* Height of baseline */
327 #define DEFAULTGRIDSPACE 32
328 #define DEFAULTSNAPSPACE 16
330 /*----------------------------------------------------------------------*/
332 #define RADFAC 0.0174532925199 /* (pi / 180) */
333 #define INVRFAC 57.295779 /* (180 / pi) */
335 /*----------------------------------------------------------------------*/
337 #define INCHSCALE 0.375 /* Scale of .25 inches to PostScript units */
338 #define CMSCALE 0.35433071 /* Scale of .5 cm to PostScript units */
339 #define IN_CM_CONVERT 28.3464567 /* 72 (in) / 2.54 (cm/in) */
341 /*----------------------------------------------------------------------*/
342 /* Event mode definitions (state of drawing area) */
343 /*----------------------------------------------------------------------*/
345 typedef enum editmode
{
346 NORMAL_MODE
= 0, /* On the drawing page, none of the situations below */
347 UNDO_MODE
, /* In the process of an undo/redo operation */
348 MOVE_MODE
, /* In the process of moving elements */
349 COPY_MODE
, /* In the process of copying elements */
350 PAN_MODE
, /* In the process of panning to follow the cursor */
351 SELAREA_MODE
, /* Area selection box */
352 RESCALE_MODE
, /* Interactive element rescaling box */
353 CATALOG_MODE
, /* On a library page, library directory, or page directory */
354 CATTEXT_MODE
, /* Editing an existing object name in the library */
355 FONTCAT_MODE
, /* Accessing the font character page from TEXT_MODE */
356 EFONTCAT_MODE
, /* Accessing the font character page from ETEXT_MODE */
357 TEXT_MODE
, /* Creating a new label */
358 WIRE_MODE
, /* Creating a new polygon (wire) */
359 BOX_MODE
, /* Creating a new box */
360 ARC_MODE
, /* Creating a new arc */
361 SPLINE_MODE
, /* Creating a new spline */
362 ETEXT_MODE
, /* Editing an exiting label */
363 EPOLY_MODE
, /* Editing an existing polygon */
364 EARC_MODE
, /* Editing an existing arc */
365 ESPLINE_MODE
, /* Editing an existing spline */
366 EPATH_MODE
, /* Editing an existing path */
367 EINST_MODE
, /* Editing an instance (from the level above) */
368 ASSOC_MODE
, /* Choosing an associated schematic or symbol */
369 CATMOVE_MODE
/* Moving objects in or between libraries */
372 /*----------------------------------------------------------------------*/
373 /* File loading modes */
374 /*----------------------------------------------------------------------*/
376 enum loadmodes
{IMPORT
= 1, PSBKGROUND
, SCRIPT
, RECOVER
,
386 /*----------------------------------------------------------------------*/
387 /* Text anchoring styles and other parameters (bitmask) */
388 /*----------------------------------------------------------------------*/
390 #define NOTLEFT 1 /* Center or right anchoring */
391 #define RIGHT 2 /* Right anchoring */
392 #define NOTBOTTOM 4 /* Middle or top anchoring */
393 #define TOP 8 /* Top anchoring */
394 #define FLIPINV 16 /* 1 if text is flip-invariant */
395 #define PINVISIBLE 32 /* 1 if pin visible outside of object */
396 #define PINNOOFFSET 64 /* 0 if pin label offset from position */
397 #define LATEXLABEL 128 /* 1 if label is in LaTeX syntax */
398 #define JUSTIFYRIGHT 256 /* Right text justification */
399 #define JUSTIFYBOTH 512 /* Right and left text justification */
400 #define TEXTCENTERED 1024 /* Centered text */
402 #define RLANCHORFIELD 3 /* right-left anchoring bit field */
403 #define TBANCHORFIELD 12 /* top-bottom anchoring bit field */
404 #define NONANCHORFIELD 2032 /* everything but anchoring fields */
405 #define NONJUSTIFFIELD 255 /* everything but justification fields */
407 /*----------------------------------------------------------------------*/
408 /* Text string part: types */
409 /*----------------------------------------------------------------------*/
411 #define TEXT_STRING 0 /* data is a text string */
412 #define SUBSCRIPT 1 /* start subscript; no data */
413 #define SUPERSCRIPT 2 /* start superscript; no data */
414 #define NORMALSCRIPT 3 /* stop super-/subscript; no data */
415 #define UNDERLINE 4 /* start underline; no data */
416 #define OVERLINE 5 /* start overline; no data */
417 #define NOLINE 6 /* stop over-/underline; no data */
418 #define TABSTOP 7 /* insert tab stop position */
419 #define TABFORWARD 8 /* insert tab stop position */
420 #define TABBACKWARD 9 /* insert tab stop position */
421 #define HALFSPACE 10 /* insert half-space; no data */
422 #define QTRSPACE 11 /* insert quarter space; no data */
423 #define RETURN 12 /* carriage-return character; no data */
424 #define FONT_NAME 13 /* inline font designator; data = font name */
425 #define FONT_SCALE 14 /* font scale change; data = scale */
426 #define FONT_COLOR 15 /* font color change; data = color */
427 #define MARGINSTOP 16 /* declare a width limit for the text */
428 #define KERN 17 /* set new kern values; data = kern x, y */
429 #define PARAM_START 18 /* bounds a parameter; data = param key */
430 #define PARAM_END 19 /* bounds a parameter; no data */
432 /* Actions translated to keystates (numbering continues from above) */
434 #define TEXT_RETURN 20
437 #define TEXT_SPLIT 23
441 #define TEXT_RIGHT 27
442 #define TEXT_DELETE 28
443 #define TEXT_DEL_PARAM 29
445 #define SPECIAL 63 /* used only when called from menu */
446 #define NULL_TYPE 255 /* used as a placeholder */
448 /*----------------------------------------------------------------------*/
450 /*----------------------------------------------------------------------*/
455 /*----------------------------------------------------------------------*/
456 /* Coordinate display types */
457 /*----------------------------------------------------------------------*/
464 /*----------------------------------------------------------------------*/
466 /*----------------------------------------------------------------------*/
468 #define FONTENCODING -1 /* Used only by libopen() */
473 #define USERLIB (xobjs.numlibs + LIBRARY - 1)
475 /*----------------------------------------------------------------------*/
476 /* Object instance styles */
477 /*----------------------------------------------------------------------*/
479 #define LINE_INVARIANT 1 /* Linewidth is invariant w.r.t. scale */
481 /*----------------------------------------------------------------------*/
483 /*----------------------------------------------------------------------*/
494 #define FILLSOLID 224 /* = 32 + 64 + 128 */
500 #define SQUARECAP 1024
501 #define CLIPMASK 2048
502 #define FIXEDBBOX 4096
504 /*----------------------------------------------------------------------*/
505 /* Box edit styles */
506 /*----------------------------------------------------------------------*/
514 /*----------------------------------------------------------------------*/
515 /* Path edit styles */
516 /*----------------------------------------------------------------------*/
518 #define TANGENTS 1 /* (NORMAL = 0) */
520 /*----------------------------------------------------------------------*/
521 /* Cycle points (selected points) (flag bits, can be OR'd together) */
522 /*----------------------------------------------------------------------*/
526 #define LASTENTRY 0x04
528 #define REFERENCE 0x10
529 #define ANTIXY 0x20 /* For matched-tangent curves */
531 /*----------------------------------------------------------------------*/
532 /* Arc creation and edit styles */
533 /*----------------------------------------------------------------------*/
538 /*----------------------------------------------------------------------*/
539 /* Delete/undelete draw-mode styles */
540 /*----------------------------------------------------------------------*/
545 /*----------------------------------------------------------------------*/
546 /* Schematic object types and pin label types */
547 /*----------------------------------------------------------------------*/
549 #define PRIMARY 0 /* Primary (master) schematic page */
550 #define SECONDARY 1 /* Secondary (slave) schematic page */
551 #define TRIVIAL 2 /* Symbol as non-schematic element */
552 #define SYMBOL 3 /* Symbol associated with a schematic */
553 #define FUNDAMENTAL 4 /* Standalone symbol */
554 #define NONETWORK 5 /* Do not netlist this object */
555 #define GLYPH 6 /* Symbol is a font glyph */
561 #define HIERARCHY_LIMIT 256 /* Stop if recursion goes this deep */
563 /*----------------------------------------------------------------------*/
564 /* Save types. This list incorporates "ALL_PAGES", below. */
565 /*----------------------------------------------------------------------*/
567 #define CURRENT_PAGE 0 /* Current page + all associated pages */
568 #define NO_SUBCIRCUITS 1 /* Current page w/o subcircuit pages */
570 /*----------------------------------------------------------------------*/
571 /* Modes used when ennumerating page totals. */
572 /*----------------------------------------------------------------------*/
574 #define INDEPENDENT 0
576 #define TOTAL_PAGES 2
577 #define LINKED_PAGES 3
578 #define PAGE_DEPEND 4
581 /*----------------------------------------------------------------------*/
582 /* Color scheme styles (other than NORMAL) */
583 /*----------------------------------------------------------------------*/
587 /*----------------------------------------------------------------------*/
588 /* Cursor definitions */
589 /*----------------------------------------------------------------------*/
591 #define NUM_CURSORS 11
593 #define ARROW appcursors[0]
594 #define CROSS appcursors[1]
595 #define SCISSORS appcursors[2]
596 #define COPYCURSOR appcursors[3]
597 #define ROTATECURSOR appcursors[4]
598 #define EDCURSOR appcursors[5]
599 #define TEXTPTR appcursors[6]
600 #define CIRCLE appcursors[7]
601 #define QUESTION appcursors[8]
602 #define WAITFOR appcursors[9]
603 #define HAND appcursors[10]
605 #define DEFAULTCURSOR (*areawin->defaultcursor)
607 /*----------------------------------------------------------------------*/
608 /* integer and floating-point coordinate list structures */
609 /*----------------------------------------------------------------------*/
611 typedef XPoint
* pointlist
;
612 typedef XfPoint
* fpointlist
;
614 /*----------------------------------------------------------------------*/
615 /* Allowed parameterization types */
616 /*----------------------------------------------------------------------*/
619 P_NUMERIC
= 0, /* uncommitted numeric parameter */
634 P_POSITION
, /* mode only, not a real parameter */
638 /*----------------------------------------------------------------------*/
639 /* Labels are constructed of strings and executables */
640 /*----------------------------------------------------------------------*/
642 typedef struct _stringpart
*stringptr
;
644 typedef struct _stringpart
{
658 /*----------------------------------------------------------------------*/
659 /* structures of all main elements which can be displayed & manipulated */
660 /*----------------------------------------------------------------------*/
662 /*----------------------------------------------------------------------*/
663 /* Object & object instance parameter structure */
664 /* (Add types as necessary) */
665 /*----------------------------------------------------------------------*/
667 enum paramtypes
{XC_INT
= 0, XC_FLOAT
, XC_STRING
, XC_EXPR
};
669 /* Object parameters: general key:value parameter model */
670 /* Note that this really should be a hash table, not a linked list. . . */
672 typedef struct _oparam
*oparamptr
;
674 typedef struct _oparam
{
675 char * key
; /* name of the parameter */
676 u_char type
; /* type is from paramtypes list above */
677 u_char which
; /* what the parameter represents (P_*) */
679 stringpart
*string
; /* xcircuit label type */
680 char *expr
; /* TCL (string) expression */
681 int ivalue
; /* also covers type short int by typecasting */
683 } parameter
; /* default or substitution value */
684 oparamptr next
; /* next parameter in linked list */
687 /* Element parameters: reference back to the object's parameters */
688 /* These parameters are forward-substituted when descending into */
689 /* an object instance. */
690 /* Note that this really should be a hash table, not a linked list. . . */
692 typedef struct _eparam
*eparamptr
;
694 typedef struct _eparam
{
695 char * key
; /* name of the parameter */
696 u_char flags
; /* namely, bit declaring an indirect parameter */
698 int pointno
; /* point number in point array, for polygons */
699 short pathpt
[2]; /* element number and point number, for paths */
700 char *refkey
; /* parameter reference key, for instances */
702 eparamptr next
; /* next parameter in linked list */
705 #define P_INDIRECT 0x01 /* indirect parameter indicator */
707 /*----------------------------------------------------------------------*/
708 /* Generic element type is a superset of all elements. */
709 /*----------------------------------------------------------------------*/
712 u_short type
; /* type is LABEL, POLYGON, etc., from below */
715 } generic
, *genericptr
; /* (convenience function for retypecasting) */
717 /*----------------------------------------------------------------------*/
718 /* selection-mechanism structures */
719 /*----------------------------------------------------------------------*/
732 /*----------------------------------------------------------------------*/
734 /*----------------------------------------------------------------------*/
738 Dimension width
, height
;
741 /*----------------------------------------------------------------------*/
742 /* Object instance type */
743 /*----------------------------------------------------------------------*/
745 typedef struct _xcobject
*objectptr
;
750 eparamptr passed
; /* numerical parameters passed from above */
755 objectptr thisobject
;
756 oparamptr params
; /* parameter substitutions for this instance */
757 BBox bbox
; /* per-instance bounding box information */
758 BBox
*schembbox
; /* Extra bounding box for pin labels */
759 } objinst
, *objinstptr
;
761 /* Linked-list for objects */
763 typedef struct _objlist
*objlistptr
;
765 typedef struct _objlist
{
766 int libno
; /* library in which object appears */
767 objectptr thisobject
; /* pointer to the object */
771 /* Linked-list for object instances */
773 typedef struct _pushlist
*pushlistptr
;
775 typedef struct _pushlist
{
777 char *clientdata
; /* general-purpose record */
781 /* Same as above, but for the list of instances in a library, so it */
782 /* needs an additional record showing whether or not the instance is */
783 /* "virtual" (not the primary library instance of the object) */
785 typedef struct _liblist
*liblistptr
;
787 typedef struct _liblist
{
793 /*----------------------------------------------------------------------*/
794 /* Generalized graphic object (Tcl/Tk only) */
795 /*----------------------------------------------------------------------*/
799 int color
; /* foreground, for bitmaps only */
800 eparamptr passed
; /* numerical parameters passed from above */
804 xcImage
*source
; /* source data */
806 xcImage
*target
; /* target (scaled) data */
807 float trot
; /* target rotation */
808 float tscale
; /* target scale (0 = uninitialized) */
809 Pixmap clipmask
; /* clipmask for non-manhattan rotations */
810 Boolean valid
; /* does target need to be regenerated? */
811 #endif /* !HAVE_CAIRO */
812 } graphic
, *graphicptr
;
814 /*----------------------------------------------------------------------*/
816 /*----------------------------------------------------------------------*/
821 eparamptr passed
; /* numerical parameters passed from above */
822 pointselect
*cycle
; /* Edit position(s), or NULL */
831 /*----------------------------------------------------------------------*/
833 /*----------------------------------------------------------------------*/
838 eparamptr passed
; /* numerical parameters passed from above */
841 pointselect
*cycle
; /* Edit position(s), or NULL */
846 /*----------------------------------------------------------------------*/
848 /*----------------------------------------------------------------------*/
853 eparamptr passed
; /* numerical parameters passed from above */
856 pointselect
*cycle
; /* Edit position(s), or NULL */
858 /* the following are for rendering only */
859 XfPoint points
[INTSEGS
];
860 } spline
, *splineptr
;
862 /*----------------------------------------------------------------------*/
864 /*----------------------------------------------------------------------*/
869 eparamptr passed
; /* numerical parameters passed from above */
872 pointselect
*cycle
; /* Edit position(s), or NULL */
873 short radius
; /* x-axis radius */
874 short yaxis
; /* y-axis radius */
875 float angle1
; /* endpoint angles, in degrees */
878 /* the following are for rendering only */
880 XfPoint points
[RSTEPS
+ 1];
883 /*----------------------------------------------------------------------*/
885 /*----------------------------------------------------------------------*/
890 eparamptr passed
; /* numerical parameters passed from above */
894 genericptr
*plist
; /* to be retypecast to polygon, arc, or spline */
897 /*----------------------------------------------------------------------*/
898 /* selection from top-level object */
899 /*----------------------------------------------------------------------*/
901 /*----------------------------------------------------------------------*/
902 /* Undo mechanism definitions */
903 /*----------------------------------------------------------------------*/
905 enum UNDO_MODES
{UNDO_DONE
= 0, UNDO_MORE
, MODE_CONNECT
, MODE_RECURSE_WIDE
,
906 MODE_RECURSE_NARROW
};
908 typedef struct _selection
*selectionptr
;
910 typedef struct _selection
{
917 #define select_element(a) recurse_select_element(a, UNDO_MORE)
918 #define select_add_element(a) recurse_select_element(a, UNDO_DONE)
920 #define easydraw(a, b) geneasydraw(a, b, topobject, areawin->topinstance)
922 /*----------------------------------------------------------------------*/
923 /* Netlist structures for schematic capture */
924 /*----------------------------------------------------------------------*/
926 /* Structure to hold net and subnet IDs for a bus */
933 /* Structure mimicking the top part of a Polylist or Labellist */
934 /* when we just want the netlist information and don't care */
935 /* which one we're looking at. */
945 /* Linked polygon list */
947 typedef struct _Polylist
*PolylistPtr
;
948 typedef struct _Polylist
951 int id
; /* A single net ID, if subnets == 0 */
952 buslist
*list
; /* List of net and subnet IDs for a bus */
954 int subnets
; /* Number of subnets; 0 if no subnets */
955 objectptr cschem
; /* Schematic containing the polygon */
957 PolylistPtr next
; /* Next polygon in the linked list */
960 /* Linked label list */
962 typedef struct _Labellist
*LabellistPtr
;
963 typedef struct _Labellist
966 int id
; /* A single net ID, if subnets == 0 */
967 buslist
*list
; /* List of net and subnet IDs for a bus */
969 int subnets
; /* Number of subnets; 0 if no subnets */
970 objectptr cschem
; /* Schematic containing the label */
971 objinstptr cinst
; /* Specific label instance, if applicable */
976 /* List of object's networks by (flattened) name */
978 typedef struct _Netname
*NetnamePtr
;
979 typedef struct _Netname
982 stringpart
*localpin
;
986 /* List of object's I/O ports */
988 typedef struct _Portlist
*PortlistPtr
;
989 typedef struct _Portlist
996 /* List of calls to instances of objects */
997 /* or subcircuit objects. */
999 typedef struct _Calllist
*CalllistPtr
;
1000 typedef struct _Calllist
1002 objectptr cschem
; /* Schematic containing the instance called */
1003 objinstptr callinst
; /* Instance called */
1004 objectptr callobj
; /* Object of instance called */
1005 char *devname
; /* if non-null, name of device in netlist */
1006 int devindex
; /* if non-negative, index of device in netlist */
1011 /* PCB netlist structures */
1031 /*----------------------------------------------------------------------*/
1032 /* Information needed to highlight a net */
1033 /*----------------------------------------------------------------------*/
1036 Genericlist
*netlist
;
1037 objinstptr thisinst
;
1040 /*----------------------------------------------------------------------*/
1041 /* Main object structure */
1042 /*----------------------------------------------------------------------*/
1044 typedef struct _xcobject
{
1046 u_short changes
; /* Number of unsaved changes to object */
1049 XPoint pcorner
; /* position relative to window */
1050 BBox bbox
; /* bounding box information (excluding */
1051 /* parameterized elements) */
1053 genericptr
*plist
; /* to be retypecast to label, polygon, etc. */
1054 oparamptr params
; /* list of parameters, with default values */
1056 Highlight highlight
; /* net to be highlighted on redraw */
1058 objectptr symschem
; /* schematic page support */
1059 Boolean valid
; /* Is current netlist valid? */
1060 Boolean traversed
; /* Flag to indicate object was processed */
1061 LabellistPtr labels
; /* Netlist pins */
1062 PolylistPtr polygons
; /* Netlist wires */
1063 PortlistPtr ports
; /* Netlist ports */
1064 CalllistPtr calls
; /* Netlist subcircuits and connections */
1065 Boolean infolabels
; /* TRUE if object contains info-labels */
1066 NetnamePtr netnames
; /* Local names for flattening */
1067 /* (this probably shouldn't be here. . .) */
1070 /*----------------------------------------------------------------------*/
1071 /* Transformation matrices */
1072 /* Works like this (see also PostScript reference manual): */
1073 /* [x' y' 1] = [x y 1] * | a d 0 | */
1076 /*----------------------------------------------------------------------*/
1078 typedef struct _matrix
*Matrixptr
;
1080 typedef struct _matrix
{
1081 float a
, b
, c
, d
, e
, f
;
1082 Matrixptr nextmatrix
;
1085 /*----------------------------------------------------------------------*/
1086 /* Some convenience functions for matrix manipulation */
1087 /*----------------------------------------------------------------------*/
1089 #define DCTM areawin->MatStack
1091 /*----------------------------------------------------------------------*/
1092 /* button tap/press definitions */
1093 /*----------------------------------------------------------------------*/
1095 #define PRESSTIME 200 /* milliseconds of push to be a "press" */
1097 /*----------------------------------------------------------------------*/
1098 /* object name alias structures */
1099 /*----------------------------------------------------------------------*/
1101 typedef struct _stringlist
*slistptr
;
1103 typedef struct _stringlist
{
1108 typedef struct _alias
*aliasptr
;
1110 typedef struct _alias
{
1111 objectptr baseobj
; /* pointer to object (actual name) */
1112 slistptr aliases
; /* linked list of alias names */
1116 /*----------------------------------------------------------------------*/
1117 /* To facilitate compiling the Tcl/Tk version, we make some convenient */
1118 /* definitions for types "xc..." and "Xc..." which can be mapped both */
1119 /* to X and Xt or to Tk functions and types. */
1120 /*----------------------------------------------------------------------*/
1124 #define xcWidget Tk_Window
1125 #define xcWidgetList Tk_Window *
1126 #define xcAddEventHandler(a,b,c,d,e) Tk_CreateEventHandler(a,b,d,e)
1127 #define xcRemoveEventHandler(a,b,c,d,e) Tk_DeleteEventHandler(a,b,d,e)
1128 #define xcEventHandler Tk_EventProc *
1129 #define xcWindow Tk_WindowId
1130 #define xcIsRealized Tk_IsMapped /* not sure this is right */
1131 #define xcScreen Tk_Screen
1132 #define xcParent Tk_Parent
1133 #define xcDispatchEvent(a) Tk_HandleEvent(a)
1134 #define xcAddTimeOut(a, b, c, d) Tcl_CreateTimerHandler((int)(b), c, d)
1135 #define xcRemoveTimeOut Tcl_DeleteTimerHandler
1136 #define xcTimeOutProc Tcl_TimerProc *
1137 #define xcIntervalId Tcl_TimerToken
1141 #define xcWidget Widget
1142 #define xcWidgetList WidgetList
1143 #define xcAddEventHandler XtAddEventHandler
1144 #define xcRemoveEventHandler XtRemoveEventHandler
1145 #define xcEventHandler XtEventHandler
1146 #define xcWindow XtWindow
1147 #define xcIsRealized XtIsRealized
1148 #define xcScreen XtScreen
1149 #define xcParent XtParent
1150 #define xcDispatchEvent(a) XtDispatchEvent(a)
1151 #define xcAddTimeOut XtAppAddTimeOut
1152 #define xcRemoveTimeOut XtRemoveTimeOut
1153 #define xcTimeOutProc XtTimerCallbackProc
1154 #define xcIntervalId XtIntervalId
1156 #define ClientData XtPointer
1160 /*----------------------------------------------------------------------*/
1161 /* structures for managing the popup prompt widgets */
1162 /*----------------------------------------------------------------------*/
1167 void (*buttoncall
)();
1172 xcWidget popup
; /* Popup widget */
1173 xcWidget textw
; /* Text entry widget */
1174 xcWidget filew
; /* File list window */
1175 xcWidget scroll
; /* Scrollbar widget */
1176 void (*setvalue
)(); /* Callback function */
1177 buttonsave
*buttonptr
; /* Button widget calling popup */
1178 char *filter
; /* Extension filter for highlighting */
1179 /* files. NULL for no file window. */
1180 /* NULL-string for no highlights. */
1195 enum {DIRECTORY
= 0, MATCH
, NONMATCH
}; /* file types */
1197 /*----------------------------------------------------------------------*/
1198 /* Initial Resource Management */
1199 /*----------------------------------------------------------------------*/
1202 /* schematic layout colors */
1203 Pixel globalcolor
, localcolor
, infocolor
, ratsnestcolor
;
1205 /* non-schematic layout color(s) */
1206 Pixel fixedbboxpix
, bboxpix
, clipcolor
;
1208 /* color scheme 1 */
1210 Pixel gridpix
, snappix
, selectpix
, axespix
;
1211 Pixel buttonpix
, filterpix
, auxpix
, barpix
, parampix
;
1213 /* color scheme 2 */
1215 Pixel gridpix2
, snappix2
, selectpix2
, axespix2
;
1216 Pixel buttonpix2
, auxpix2
, parampix2
;
1218 int width
, height
, timeout
;
1219 XFontStruct
*filefont
;
1222 XFontStruct
*xcfont
, *textfont
, *titlefont
, *helpfont
;
1225 } ApplicationData
, *ApplicationDataPtr
;
1227 /*----------------------------------------------------------------------*/
1228 /* Macros for GC color and function handling */
1229 /*----------------------------------------------------------------------*/
1231 #define XTopSetForeground(a) if (a == DEFAULTCOLOR) SetForeground(dpy, \
1232 areawin->gc, FOREGROUND); else SetForeground(dpy, areawin->gc, a)
1234 #define XcTopSetForeground(z) XTopSetForeground(z); areawin->gccolor = \
1235 ((z) == DEFAULTCOLOR) ? FOREGROUND : (z)
1237 #define XcSetForeground(z) SetForeground(dpy, areawin->gc, z); \
1238 areawin->gccolor = z
1240 /*----------------------------------------------------------------------*/
1241 /* Structure for maintaining list of colors */
1242 /*----------------------------------------------------------------------*/
1249 /*----------------------------------------------------------------------*/
1250 /* Font information structure */
1251 /*----------------------------------------------------------------------*/
1252 /* Flags: bit description */
1253 /* 0 bold = 1, normal = 0 */
1254 /* 1 italic = 1, normal = 0 */
1255 /* 2 <reserved, possibly for narrow font type> */
1256 /* 3 drawn = 1, PostScript = 0 */
1257 /* 4 <reserved, possibly for LaTeX font type> */
1258 /* 5 special encoding = 1, Standard Encoding = 0 */
1259 /* 6 ISOLatin1 = 2, ISOLatin2 = 3 */
1260 /* 7+ <reserved for other encoding schemes> */
1261 /*----------------------------------------------------------------------*/
1268 objectptr
*encoding
;
1270 const char **utf8encoding
;
1271 cairo_font_face_t
*font_face
;
1272 unsigned long glyph_index
[256];
1273 double glyph_top
[256];
1274 double glyph_bottom
[256];
1275 double glyph_advance
[256];
1276 #endif /* HAVE_CAIRO */
1279 /*----------------------------------------------------------------------*/
1286 /*----------------------------------------------------------------------*/
1287 /* Key macro information */
1288 /*----------------------------------------------------------------------*/
1290 typedef struct _keybinding
*keybindingptr
;
1292 typedef struct _keybinding
{
1293 xcWidget window
; /* per-window function, or NULL */
1297 keybindingptr nextbinding
;
1300 /*----------------------------------------------------------------------*/
1301 /* Enumeration of functions available for binding to keys/buttons */
1302 /* IMPORTANT! Do not alter this list without also fixing the text */
1303 /* in keybindings.c! */
1304 /*----------------------------------------------------------------------*/
1307 XCF_ENDDATA
= -2, XCF_SPACER
/* -1 */,
1308 XCF_Page
/* 0 */, XCF_Anchor
/* 1 */,
1309 XCF_Superscript
/* 2 */, XCF_Subscript
/* 3 */,
1310 XCF_Normalscript
/* 4 */, XCF_Font
/* 5 */,
1311 XCF_Boldfont
/* 6 */, XCF_Italicfont
/* 7 */,
1312 XCF_Normalfont
/* 8 */, XCF_Underline
/* 9 */,
1313 XCF_Overline
/* 10 */, XCF_ISO_Encoding
/* 11 */,
1314 XCF_Halfspace
/* 12 */, XCF_Quarterspace
/* 13 */,
1315 XCF_Special
/* 14 */, XCF_TabStop
/* 15 */,
1316 XCF_TabForward
/* 16 */, XCF_TabBackward
/* 17 */,
1317 XCF_Text_Return
/* 18 */, XCF_Text_Delete
/* 19 */,
1318 XCF_Text_Right
/* 20 */, XCF_Text_Left
/* 21 */,
1319 XCF_Text_Up
/* 22 */, XCF_Text_Down
/* 23 */,
1320 XCF_Text_Split
/* 24 */, XCF_Text_Home
/* 25 */,
1321 XCF_Text_End
/* 26 */, XCF_Linebreak
/* 27 */,
1322 XCF_Parameter
/* 28 */, XCF_Edit_Param
/* 29 */,
1323 XCF_ChangeStyle
/* 30 */, XCF_Edit_Delete
/* 31 */,
1324 XCF_Edit_Insert
/* 32 */, XCF_Edit_Append
/* 33 */,
1325 XCF_Edit_Next
/* 34 */, XCF_Attach
/* 35 */,
1326 XCF_Next_Library
/* 36 */, XCF_Library_Directory
/* 37 */,
1327 XCF_Library_Move
/* 38 */, XCF_Library_Copy
/* 39 */,
1328 XCF_Library_Edit
/* 40 */, XCF_Library_Delete
/* 41 */,
1329 XCF_Library_Duplicate
/* 42 */, XCF_Library_Hide
/* 43 */,
1330 XCF_Library_Virtual
/* 44 */, XCF_Page_Directory
/* 45 */,
1331 XCF_Library_Pop
/* 46 */, XCF_Virtual
/* 47 */,
1332 XCF_Help
/* 48 */, XCF_Redraw
/* 49 */,
1333 XCF_View
/* 50 */, XCF_Zoom_In
/* 51 */,
1334 XCF_Zoom_Out
/* 52 */, XCF_Pan
/* 53 */,
1335 XCF_Double_Snap
/* 54 */, XCF_Halve_Snap
/* 55 */,
1336 XCF_Write
/* 56 */, XCF_Rotate
/* 57 */,
1337 XCF_Flip_X
/* 58 */, XCF_Flip_Y
/* 59 */,
1338 XCF_Snap
/* 60 */, XCF_SnapTo
/* 61 */,
1339 XCF_Pop
/* 62 */, XCF_Push
/* 63 */,
1340 XCF_Delete
/* 64 */, XCF_Select
/* 65 */,
1341 XCF_Box
/* 66 */, XCF_Arc
/* 67 */,
1342 XCF_Text
/* 68 */, XCF_Exchange
/* 69 */,
1343 XCF_Copy
/* 70 */, XCF_Move
/* 71 */,
1344 XCF_Join
/* 72 */, XCF_Unjoin
/* 73 */,
1345 XCF_Spline
/* 74 */, XCF_Edit
/* 75 */,
1346 XCF_Undo
/* 76 */, XCF_Redo
/* 77 */,
1347 XCF_Select_Save
/* 78 */, XCF_Unselect
/* 79 */,
1348 XCF_Dashed
/* 80 */, XCF_Dotted
/* 81 */,
1349 XCF_Solid
/* 82 */, XCF_Prompt
/* 83 */,
1350 XCF_Dot
/* 84 */, XCF_Wire
/* 85 */,
1351 XCF_Cancel
/* 86 */, XCF_Nothing
/* 87 */,
1352 XCF_Exit
/* 88 */, XCF_Netlist
/* 89 */,
1353 XCF_Swap
/* 90 */, XCF_Pin_Label
/* 91 */,
1354 XCF_Pin_Global
/* 92 */, XCF_Info_Label
/* 93 */,
1355 XCF_Graphic
/* 94 */, XCF_SelectBox
/* 95 */,
1356 XCF_Connectivity
/* 96 */, XCF_Continue_Element
/* 97 */,
1357 XCF_Finish_Element
/* 98 */, XCF_Continue_Copy
/* 99 */,
1358 XCF_Finish_Copy
/* 100 */, XCF_Finish
/* 101 */,
1359 XCF_Cancel_Last
/* 102 */, XCF_Sim
/* 103 */,
1360 XCF_SPICE
/* 104 */, XCF_PCB
/* 105 */,
1361 XCF_SPICEflat
/* 106 */, XCF_Rescale
/* 107 */,
1362 XCF_Reorder
/* 108 */, XCF_Color
/* 109 */,
1363 XCF_Margin_Stop
/* 110 */, XCF_Text_Delete_Param
/* 111 */,
1367 /*----------------------------------------------------------------------*/
1368 /* Per-drawing-page parameters */
1369 /*----------------------------------------------------------------------*/
1372 /* per-drawing-page parameters */
1373 objinstptr pageinst
;
1374 char *filename
; /* file to save as */
1375 u_char idx
; /* page index */
1376 psbkground background
; /* background rendered file info */
1384 XPoint drawingscale
;
1385 XPoint pagesize
; /* size of page to print on */
1389 /*----------------------------------------------------------------------*/
1390 /* Structure holding information about graphic images used. These hold */
1391 /* the original data for the images, and may be shared. */
1392 /*----------------------------------------------------------------------*/
1400 /*----------------------------------------------------------------------*/
1401 /* The main globally-accessible data structure. This structure holds */
1402 /* all the critical data needed by the drawing window */
1403 /*----------------------------------------------------------------------*/
1405 typedef struct _windowdata
*XCWindowDataPtr
;
1407 typedef struct _windowdata
{
1409 XCWindowDataPtr next
; /* next window in list */
1411 /* widgets and X11 parameters */
1413 xcWidget scrollbarh
, scrollbarv
;
1419 Pixmap pbuf
; /* clipmask buffer for hierarchical clipping */
1420 signed char clipped
;
1422 #endif /* !HAVE_CAIRO */
1424 xcIntervalId time_id
;
1425 Boolean redraw_needed
;
1426 Boolean redraw_ongoing
;
1428 cairo_surface_t
*surface
;
1429 cairo_t
*cr
; /* cairo_drawing context */
1430 cairo_pattern_t
*fixed_pixmap
; /* pixmap holding the background data of */
1431 /* all fixed element. ie. not including the */
1432 /* element currently being edited. */
1433 #else /* HAVE_CAIRO */
1434 Pixmap fixed_pixmap
;
1435 #endif /* HAVE_CAIRO */
1436 /* global page parameters */
1437 short width
, height
;
1439 float vscale
; /* proper scale */
1440 XPoint pcorner
; /* page position */
1442 /* global option defaults */
1450 short filter
; /* selection filter */
1460 Boolean mapped
; /* indicates if window is drawable */
1461 char buschar
; /* Character indicating vector notation */
1462 Boolean editinplace
;
1464 Boolean pinattach
; /* keep wires attached to pins when moving objinsts */
1465 Boolean showclipmasks
; /* draw clipmask shape outlines */
1472 /* buffers and associated variables */
1473 XPoint save
, origin
;
1480 objinstptr topinstance
;
1481 objectptr editstack
;
1484 pushlistptr hierstack
;
1485 event_mode_t event_mode
;
1486 char *lastbackground
;
1487 Cursor
*defaultcursor
;
1490 /* Record for undo function */
1492 typedef struct _undostack
*Undoptr
;
1494 typedef struct _undostack
{
1495 Undoptr next
; /* next record in undo stack */
1496 Undoptr last
; /* double-linked for "redo" function */
1497 u_int type
; /* type of event */
1498 short idx
; /* counter for undo event */
1499 objinstptr thisinst
; /* instance of object in which event occurred */
1500 XCWindowData
*window
;/* window in which event occurred */
1501 int idata
; /* simple undedicated integer datum */
1502 char *undodata
; /* free space to be malloc'd */
1503 /* (size dependent on "type") */
1506 /* This whole thing needs to be cleaned up. . . now I've got objects in */
1507 /* "library" which are repeated both in the "instlist" pair and the */
1508 /* "thisobject" pointer in each instance. The instance is repeated on */
1509 /* the library page. Ideally, the instance list should only exist on */
1510 /* the library page, and not be destroyed on every call to "composelib" */
1515 liblistptr instlist
; /* List of instances */
1518 typedef struct _Technology
*TechPtr
;
1520 typedef struct _Technology
{
1521 u_char flags
; /* Flags for library page (changed, read-only) */
1522 char *technology
; /* Namespace name (without the "::") */
1523 char *filename
; /* Library file associated with technology */
1524 TechPtr next
; /* Linked list */
1527 /* Known flags for library pages */
1529 #define TECH_CHANGED 0x01
1530 #define TECH_READONLY 0x02 /* Technology file not writable */
1531 #define TECH_IMPORTED 0x04 /* Loaded only part of file */
1532 #define TECH_REPLACE 0x08 /* Replace instances when reading */
1533 #define TECH_REPLACE_TEMP 0x10 /* Temporary store */
1534 #define TECH_USED 0x20 /* Temporary marker flag */
1536 /*----------------------------------------------------------------------*/
1537 /* A convenient structure for holding all the object lists */
1538 /*----------------------------------------------------------------------*/
1541 char *libsearchpath
; /* list of directories to search */
1542 char *filesearchpath
; /* list of directories to search */
1545 Boolean retain_backup
;
1546 xcIntervalId timeout_id
;
1548 Boolean filefilter
; /* Is the file list filtered? */
1549 Boolean hold
; /* allow HOLD modifiers on buttons */
1550 Boolean showtech
; /* Write technology names in library */
1551 u_short new_changes
;
1552 signed char suspend
; /* suspend graphics updates if TRUE */
1555 Pagedata
**pagelist
;
1556 Undoptr undostack
; /* actions to undo */
1557 Undoptr redostack
; /* actions to redo */
1560 TechPtr technologies
;
1562 Imagedata
*imagelist
;
1564 XCWindowData
*windowlist
; /* linked list of known windows */
1568 /*-------------------------------------------------------------------------*/
1569 /* Track state of the ghostscript renderer */
1570 /*-------------------------------------------------------------------------*/
1573 GS_INIT
, /* Initial state; gs is idle. */
1574 GS_PENDING
, /* Drawing in progress; gs is busy. */
1575 GS_READY
/* Drawing done; gs is waiting for "next". */
1579 /*-------------------------------------------------------------------------*/
1580 /* For the eventmodes (ARC_MODE, EARC_MODE, SPLINE_MODE, etc) the drawing */
1581 /* and/or redrawing of the elements is centralized in functions */
1582 /* corresponding to the eventmode name (arc_mode_draw, spline_mode_draw, */
1583 /* etc.). Depending on the state these functions clear, draw or whatever */
1584 /* is needed. A description of the options follows below */
1585 /* fixed_pixmap refers to the background pixmap without the element(s) */
1586 /* currently being edited. */
1587 /*-------------------------------------------------------------------------*/
1590 xcDRAW_INIT
, /* Initalize fixed_pixmap and draw the element(s) */
1591 /* element(s) currently being edited, including */
1594 xcDRAW_EDIT
, /* Draw the currently edited element(s), including */
1597 xcDRAW_FINAL
, /* Draw the finalized element(s), without edit */
1598 /* lines to the fixed_pixmap */
1600 xcDRAW_EMPTY
, /* Refresh the screen by drawing the fixed_pixmap */
1601 /* This essentially clear the edited elements */
1603 xcREDRAW_FORCED
/* Redraws everything, including edit lines. Only */
1604 /* used in drawarea. This one should be called */
1605 /* when something has changed (eg. zoom). */
1606 /* It will redraw the fixed_pixmap */
1609 /*----------------------------------------------------------------------*/
1610 /* structures previously defined in menudefs.h */
1611 /*----------------------------------------------------------------------*/
1612 /*----------------------------------------------------------------------*/
1613 /* Menu Definitions for hierarchical pulldown menus */
1614 /*----------------------------------------------------------------------*/
1618 typedef struct _menustruct
*menuptr
;
1620 typedef struct _menustruct
{
1624 XtCallbackProc func
;
1628 /*----------------------------------------------------------------------*/
1629 /* Structure for calling routines from the Toolbar icons */
1630 /*----------------------------------------------------------------------*/
1632 typedef struct _toolbarstruct
*toolbarptr
;
1634 typedef struct _toolbarstruct
{
1637 XtCallbackProc func
;
1643 /* Menus and Toolbars are taken care of entirely by scripts in the Tcl/ */
1644 /* Tk version of xcircuit. */
1645 /*----------------------------------------------------------------------*/