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 */
480 #define INST_NONETLIST 2 /* Instance is not netlistable */
482 /*----------------------------------------------------------------------*/
484 /*----------------------------------------------------------------------*/
495 #define FILLSOLID 224 /* = 32 + 64 + 128 */
501 #define SQUARECAP 1024
502 #define CLIPMASK 2048
503 #define FIXEDBBOX 4096
505 /*----------------------------------------------------------------------*/
506 /* Box edit styles */
507 /*----------------------------------------------------------------------*/
515 /*----------------------------------------------------------------------*/
516 /* Path edit styles */
517 /*----------------------------------------------------------------------*/
519 #define TANGENTS 1 /* (NORMAL = 0) */
521 /*----------------------------------------------------------------------*/
522 /* Cycle points (selected points) (flag bits, can be OR'd together) */
523 /*----------------------------------------------------------------------*/
527 #define LASTENTRY 0x04
529 #define REFERENCE 0x10
530 #define ANTIXY 0x20 /* For matched-tangent curves */
532 /*----------------------------------------------------------------------*/
533 /* Arc creation and edit styles */
534 /*----------------------------------------------------------------------*/
539 /*----------------------------------------------------------------------*/
540 /* Delete/undelete draw-mode styles */
541 /*----------------------------------------------------------------------*/
546 /*----------------------------------------------------------------------*/
547 /* Schematic object types and pin label types */
548 /*----------------------------------------------------------------------*/
550 #define PRIMARY 0 /* Primary (master) schematic page */
551 #define SECONDARY 1 /* Secondary (slave) schematic page */
552 #define TRIVIAL 2 /* Symbol as non-schematic element */
553 #define SYMBOL 3 /* Symbol associated with a schematic */
554 #define FUNDAMENTAL 4 /* Standalone symbol */
555 #define NONETWORK 5 /* Do not netlist this object */
556 #define GLYPH 6 /* Symbol is a font glyph */
562 #define HIERARCHY_LIMIT 256 /* Stop if recursion goes this deep */
564 /*----------------------------------------------------------------------*/
565 /* Save types. This list incorporates "ALL_PAGES", below. */
566 /*----------------------------------------------------------------------*/
568 #define CURRENT_PAGE 0 /* Current page + all associated pages */
569 #define NO_SUBCIRCUITS 1 /* Current page w/o subcircuit pages */
571 /*----------------------------------------------------------------------*/
572 /* Modes used when ennumerating page totals. */
573 /*----------------------------------------------------------------------*/
575 #define INDEPENDENT 0
577 #define TOTAL_PAGES 2
578 #define LINKED_PAGES 3
579 #define PAGE_DEPEND 4
582 /*----------------------------------------------------------------------*/
583 /* Color scheme styles (other than NORMAL) */
584 /*----------------------------------------------------------------------*/
588 /*----------------------------------------------------------------------*/
589 /* Cursor definitions */
590 /*----------------------------------------------------------------------*/
592 #define NUM_CURSORS 11
594 #define ARROW appcursors[0]
595 #define CROSS appcursors[1]
596 #define SCISSORS appcursors[2]
597 #define COPYCURSOR appcursors[3]
598 #define ROTATECURSOR appcursors[4]
599 #define EDCURSOR appcursors[5]
600 #define TEXTPTR appcursors[6]
601 #define CIRCLE appcursors[7]
602 #define QUESTION appcursors[8]
603 #define WAITFOR appcursors[9]
604 #define HAND appcursors[10]
606 #define DEFAULTCURSOR (*areawin->defaultcursor)
608 /*----------------------------------------------------------------------*/
609 /* integer and floating-point coordinate list structures */
610 /*----------------------------------------------------------------------*/
612 typedef XPoint
* pointlist
;
613 typedef XfPoint
* fpointlist
;
615 /*----------------------------------------------------------------------*/
616 /* Allowed parameterization types */
617 /*----------------------------------------------------------------------*/
620 P_NUMERIC
= 0, /* uncommitted numeric parameter */
635 P_POSITION
, /* mode only, not a real parameter */
639 /*----------------------------------------------------------------------*/
640 /* Labels are constructed of strings and executables */
641 /*----------------------------------------------------------------------*/
643 typedef struct _stringpart
*stringptr
;
645 typedef struct _stringpart
{
659 /*----------------------------------------------------------------------*/
660 /* structures of all main elements which can be displayed & manipulated */
661 /*----------------------------------------------------------------------*/
663 /*----------------------------------------------------------------------*/
664 /* Object & object instance parameter structure */
665 /* (Add types as necessary) */
666 /*----------------------------------------------------------------------*/
668 enum paramtypes
{XC_INT
= 0, XC_FLOAT
, XC_STRING
, XC_EXPR
};
670 /* Object parameters: general key:value parameter model */
671 /* Note that this really should be a hash table, not a linked list. . . */
673 typedef struct _oparam
*oparamptr
;
675 typedef struct _oparam
{
676 char * key
; /* name of the parameter */
677 u_char type
; /* type is from paramtypes list above */
678 u_char which
; /* what the parameter represents (P_*) */
680 stringpart
*string
; /* xcircuit label type */
681 char *expr
; /* TCL (string) expression */
682 int ivalue
; /* also covers type short int by typecasting */
684 } parameter
; /* default or substitution value */
685 oparamptr next
; /* next parameter in linked list */
688 /* Element parameters: reference back to the object's parameters */
689 /* These parameters are forward-substituted when descending into */
690 /* an object instance. */
691 /* Note that this really should be a hash table, not a linked list. . . */
693 typedef struct _eparam
*eparamptr
;
695 typedef struct _eparam
{
696 char * key
; /* name of the parameter */
697 u_char flags
; /* namely, bit declaring an indirect parameter */
699 int pointno
; /* point number in point array, for polygons */
700 short pathpt
[2]; /* element number and point number, for paths */
701 char *refkey
; /* parameter reference key, for instances */
703 eparamptr next
; /* next parameter in linked list */
706 #define P_INDIRECT 0x01 /* indirect parameter indicator */
708 /*----------------------------------------------------------------------*/
709 /* Generic element type is a superset of all elements. */
710 /*----------------------------------------------------------------------*/
713 u_short type
; /* type is LABEL, POLYGON, etc., from below */
716 } generic
, *genericptr
; /* (convenience function for retypecasting) */
718 /*----------------------------------------------------------------------*/
719 /* selection-mechanism structures */
720 /*----------------------------------------------------------------------*/
733 /*----------------------------------------------------------------------*/
735 /*----------------------------------------------------------------------*/
739 Dimension width
, height
;
742 /*----------------------------------------------------------------------*/
743 /* Object instance type */
744 /*----------------------------------------------------------------------*/
746 typedef struct _xcobject
*objectptr
;
751 eparamptr passed
; /* numerical parameters passed from above */
756 objectptr thisobject
;
757 oparamptr params
; /* parameter substitutions for this instance */
758 BBox bbox
; /* per-instance bounding box information */
759 BBox
*schembbox
; /* Extra bounding box for pin labels */
760 } objinst
, *objinstptr
;
762 /* Linked-list for objects */
764 typedef struct _objlist
*objlistptr
;
766 typedef struct _objlist
{
767 int libno
; /* library in which object appears */
768 objectptr thisobject
; /* pointer to the object */
772 /* Linked-list for object instances */
774 typedef struct _pushlist
*pushlistptr
;
776 typedef struct _pushlist
{
778 char *clientdata
; /* general-purpose record */
782 /* Same as above, but for the list of instances in a library, so it */
783 /* needs an additional record showing whether or not the instance is */
784 /* "virtual" (not the primary library instance of the object) */
786 typedef struct _liblist
*liblistptr
;
788 typedef struct _liblist
{
794 /*----------------------------------------------------------------------*/
795 /* Generalized graphic object (Tcl/Tk only) */
796 /*----------------------------------------------------------------------*/
800 int color
; /* foreground, for bitmaps only */
801 eparamptr passed
; /* numerical parameters passed from above */
805 xcImage
*source
; /* source data */
807 xcImage
*target
; /* target (scaled) data */
808 float trot
; /* target rotation */
809 float tscale
; /* target scale (0 = uninitialized) */
810 Pixmap clipmask
; /* clipmask for non-manhattan rotations */
811 Boolean valid
; /* does target need to be regenerated? */
812 #endif /* !HAVE_CAIRO */
813 } graphic
, *graphicptr
;
815 /*----------------------------------------------------------------------*/
817 /*----------------------------------------------------------------------*/
822 eparamptr passed
; /* numerical parameters passed from above */
823 pointselect
*cycle
; /* Edit position(s), or NULL */
832 /*----------------------------------------------------------------------*/
834 /*----------------------------------------------------------------------*/
839 eparamptr passed
; /* numerical parameters passed from above */
842 pointselect
*cycle
; /* Edit position(s), or NULL */
847 /*----------------------------------------------------------------------*/
849 /*----------------------------------------------------------------------*/
854 eparamptr passed
; /* numerical parameters passed from above */
857 pointselect
*cycle
; /* Edit position(s), or NULL */
859 /* the following are for rendering only */
860 XfPoint points
[INTSEGS
];
861 } spline
, *splineptr
;
863 /*----------------------------------------------------------------------*/
865 /*----------------------------------------------------------------------*/
870 eparamptr passed
; /* numerical parameters passed from above */
873 pointselect
*cycle
; /* Edit position(s), or NULL */
874 short radius
; /* x-axis radius */
875 short yaxis
; /* y-axis radius */
876 float angle1
; /* endpoint angles, in degrees */
879 /* the following are for rendering only */
881 XfPoint points
[RSTEPS
+ 1];
884 /*----------------------------------------------------------------------*/
886 /*----------------------------------------------------------------------*/
891 eparamptr passed
; /* numerical parameters passed from above */
895 genericptr
*plist
; /* to be retypecast to polygon, arc, or spline */
898 /*----------------------------------------------------------------------*/
899 /* selection from top-level object */
900 /*----------------------------------------------------------------------*/
902 /*----------------------------------------------------------------------*/
903 /* Undo mechanism definitions */
904 /*----------------------------------------------------------------------*/
906 enum UNDO_MODES
{UNDO_DONE
= 0, UNDO_MORE
, MODE_CONNECT
, MODE_RECURSE_WIDE
,
907 MODE_RECURSE_NARROW
};
909 typedef struct _selection
*selectionptr
;
911 typedef struct _selection
{
918 #define select_element(a) recurse_select_element(a, UNDO_MORE)
919 #define select_add_element(a) recurse_select_element(a, UNDO_DONE)
921 #define easydraw(a, b) geneasydraw(a, b, topobject, areawin->topinstance)
923 /*----------------------------------------------------------------------*/
924 /* Netlist structures for schematic capture */
925 /*----------------------------------------------------------------------*/
927 /* Structure to hold net and subnet IDs for a bus */
934 /* Structure mimicking the top part of a Polylist or Labellist */
935 /* when we just want the netlist information and don't care */
936 /* which one we're looking at. */
946 /* Linked polygon list */
948 typedef struct _Polylist
*PolylistPtr
;
949 typedef struct _Polylist
952 int id
; /* A single net ID, if subnets == 0 */
953 buslist
*list
; /* List of net and subnet IDs for a bus */
955 int subnets
; /* Number of subnets; 0 if no subnets */
956 objectptr cschem
; /* Schematic containing the polygon */
958 PolylistPtr next
; /* Next polygon in the linked list */
961 /* Linked label list */
963 typedef struct _Labellist
*LabellistPtr
;
964 typedef struct _Labellist
967 int id
; /* A single net ID, if subnets == 0 */
968 buslist
*list
; /* List of net and subnet IDs for a bus */
970 int subnets
; /* Number of subnets; 0 if no subnets */
971 objectptr cschem
; /* Schematic containing the label */
972 objinstptr cinst
; /* Specific label instance, if applicable */
977 /* List of object's networks by (flattened) name */
979 typedef struct _Netname
*NetnamePtr
;
980 typedef struct _Netname
983 stringpart
*localpin
;
987 /* List of object's I/O ports */
989 typedef struct _Portlist
*PortlistPtr
;
990 typedef struct _Portlist
997 /* List of calls to instances of objects */
998 /* or subcircuit objects. */
1000 typedef struct _Calllist
*CalllistPtr
;
1001 typedef struct _Calllist
1003 objectptr cschem
; /* Schematic containing the instance called */
1004 objinstptr callinst
; /* Instance called */
1005 objectptr callobj
; /* Object of instance called */
1006 char *devname
; /* if non-null, name of device in netlist */
1007 int devindex
; /* if non-negative, index of device in netlist */
1012 /* PCB netlist structures */
1032 /*----------------------------------------------------------------------*/
1033 /* Information needed to highlight a net */
1034 /*----------------------------------------------------------------------*/
1037 Genericlist
*netlist
;
1038 objinstptr thisinst
;
1041 /*----------------------------------------------------------------------*/
1042 /* Main object structure */
1043 /*----------------------------------------------------------------------*/
1045 typedef struct _xcobject
{
1047 u_short changes
; /* Number of unsaved changes to object */
1050 XPoint pcorner
; /* position relative to window */
1051 BBox bbox
; /* bounding box information (excluding */
1052 /* parameterized elements) */
1054 genericptr
*plist
; /* to be retypecast to label, polygon, etc. */
1055 oparamptr params
; /* list of parameters, with default values */
1057 Highlight highlight
; /* net to be highlighted on redraw */
1059 objectptr symschem
; /* schematic page support */
1060 Boolean valid
; /* Is current netlist valid? */
1061 Boolean traversed
; /* Flag to indicate object was processed */
1062 LabellistPtr labels
; /* Netlist pins */
1063 PolylistPtr polygons
; /* Netlist wires */
1064 PortlistPtr ports
; /* Netlist ports */
1065 CalllistPtr calls
; /* Netlist subcircuits and connections */
1066 Boolean infolabels
; /* TRUE if object contains info-labels */
1067 NetnamePtr netnames
; /* Local names for flattening */
1068 /* (this probably shouldn't be here. . .) */
1071 /*----------------------------------------------------------------------*/
1072 /* Transformation matrices */
1073 /* Works like this (see also PostScript reference manual): */
1074 /* [x' y' 1] = [x y 1] * | a d 0 | */
1077 /*----------------------------------------------------------------------*/
1079 typedef struct _matrix
*Matrixptr
;
1081 typedef struct _matrix
{
1082 float a
, b
, c
, d
, e
, f
;
1083 Matrixptr nextmatrix
;
1086 /*----------------------------------------------------------------------*/
1087 /* Some convenience functions for matrix manipulation */
1088 /*----------------------------------------------------------------------*/
1090 #define DCTM areawin->MatStack
1092 /*----------------------------------------------------------------------*/
1093 /* button tap/press definitions */
1094 /*----------------------------------------------------------------------*/
1096 #define PRESSTIME 200 /* milliseconds of push to be a "press" */
1098 /*----------------------------------------------------------------------*/
1099 /* object name alias structures */
1100 /*----------------------------------------------------------------------*/
1102 typedef struct _stringlist
*slistptr
;
1104 typedef struct _stringlist
{
1109 typedef struct _alias
*aliasptr
;
1111 typedef struct _alias
{
1112 objectptr baseobj
; /* pointer to object (actual name) */
1113 slistptr aliases
; /* linked list of alias names */
1117 /*----------------------------------------------------------------------*/
1118 /* To facilitate compiling the Tcl/Tk version, we make some convenient */
1119 /* definitions for types "xc..." and "Xc..." which can be mapped both */
1120 /* to X and Xt or to Tk functions and types. */
1121 /*----------------------------------------------------------------------*/
1125 #define xcWidget Tk_Window
1126 #define xcWidgetList Tk_Window *
1127 #define xcAddEventHandler(a,b,c,d,e) Tk_CreateEventHandler(a,b,d,e)
1128 #define xcRemoveEventHandler(a,b,c,d,e) Tk_DeleteEventHandler(a,b,d,e)
1129 #define xcEventHandler Tk_EventProc *
1130 #define xcWindow Tk_WindowId
1131 #define xcIsRealized Tk_IsMapped /* not sure this is right */
1132 #define xcScreen Tk_Screen
1133 #define xcParent Tk_Parent
1134 #define xcDispatchEvent(a) Tk_HandleEvent(a)
1135 #define xcAddTimeOut(a, b, c, d) Tcl_CreateTimerHandler((int)(b), c, d)
1136 #define xcRemoveTimeOut Tcl_DeleteTimerHandler
1137 #define xcTimeOutProc Tcl_TimerProc *
1138 #define xcIntervalId Tcl_TimerToken
1142 #define xcWidget Widget
1143 #define xcWidgetList WidgetList
1144 #define xcAddEventHandler XtAddEventHandler
1145 #define xcRemoveEventHandler XtRemoveEventHandler
1146 #define xcEventHandler XtEventHandler
1147 #define xcWindow XtWindow
1148 #define xcIsRealized XtIsRealized
1149 #define xcScreen XtScreen
1150 #define xcParent XtParent
1151 #define xcDispatchEvent(a) XtDispatchEvent(a)
1152 #define xcAddTimeOut XtAppAddTimeOut
1153 #define xcRemoveTimeOut XtRemoveTimeOut
1154 #define xcTimeOutProc XtTimerCallbackProc
1155 #define xcIntervalId XtIntervalId
1157 #define ClientData XtPointer
1161 /*----------------------------------------------------------------------*/
1162 /* structures for managing the popup prompt widgets */
1163 /*----------------------------------------------------------------------*/
1168 void (*buttoncall
)();
1173 xcWidget popup
; /* Popup widget */
1174 xcWidget textw
; /* Text entry widget */
1175 xcWidget filew
; /* File list window */
1176 xcWidget scroll
; /* Scrollbar widget */
1177 void (*setvalue
)(); /* Callback function */
1178 buttonsave
*buttonptr
; /* Button widget calling popup */
1179 char *filter
; /* Extension filter for highlighting */
1180 /* files. NULL for no file window. */
1181 /* NULL-string for no highlights. */
1196 enum {DIRECTORY
= 0, MATCH
, NONMATCH
}; /* file types */
1198 /*----------------------------------------------------------------------*/
1199 /* Initial Resource Management */
1200 /*----------------------------------------------------------------------*/
1203 /* schematic layout colors */
1204 Pixel globalcolor
, localcolor
, infocolor
, ratsnestcolor
;
1206 /* non-schematic layout color(s) */
1207 Pixel fixedbboxpix
, bboxpix
, clipcolor
;
1209 /* color scheme 1 */
1211 Pixel gridpix
, snappix
, selectpix
, axespix
;
1212 Pixel buttonpix
, filterpix
, auxpix
, barpix
, parampix
;
1214 /* color scheme 2 */
1216 Pixel gridpix2
, snappix2
, selectpix2
, axespix2
;
1217 Pixel buttonpix2
, auxpix2
, parampix2
;
1219 int width
, height
, timeout
;
1220 XFontStruct
*filefont
;
1223 XFontStruct
*xcfont
, *textfont
, *titlefont
, *helpfont
;
1226 } ApplicationData
, *ApplicationDataPtr
;
1228 /*----------------------------------------------------------------------*/
1229 /* Macros for GC color and function handling */
1230 /*----------------------------------------------------------------------*/
1232 #define XTopSetForeground(a) if (a == DEFAULTCOLOR) SetForeground(dpy, \
1233 areawin->gc, FOREGROUND); else SetForeground(dpy, areawin->gc, a)
1235 #define XcTopSetForeground(z) XTopSetForeground(z); areawin->gccolor = \
1236 ((z) == DEFAULTCOLOR) ? FOREGROUND : (z)
1238 #define XcSetForeground(z) SetForeground(dpy, areawin->gc, z); \
1239 areawin->gccolor = z
1241 /*----------------------------------------------------------------------*/
1242 /* Structure for maintaining list of colors */
1243 /*----------------------------------------------------------------------*/
1250 /*----------------------------------------------------------------------*/
1251 /* Font information structure */
1252 /*----------------------------------------------------------------------*/
1253 /* Flags: bit description */
1254 /* 0 bold = 1, normal = 0 */
1255 /* 1 italic = 1, normal = 0 */
1256 /* 2 <reserved, possibly for narrow font type> */
1257 /* 3 drawn = 1, PostScript = 0 */
1258 /* 4 <reserved, possibly for LaTeX font type> */
1259 /* 5 special encoding = 1, Standard Encoding = 0 */
1260 /* 6 ISOLatin1 = 2, ISOLatin2 = 3 */
1261 /* 7+ <reserved for other encoding schemes> */
1262 /*----------------------------------------------------------------------*/
1269 objectptr
*encoding
;
1271 const char **utf8encoding
;
1272 cairo_font_face_t
*font_face
;
1273 unsigned long glyph_index
[256];
1274 double glyph_top
[256];
1275 double glyph_bottom
[256];
1276 double glyph_advance
[256];
1277 #endif /* HAVE_CAIRO */
1280 /*----------------------------------------------------------------------*/
1287 /*----------------------------------------------------------------------*/
1288 /* Key macro information */
1289 /*----------------------------------------------------------------------*/
1291 typedef struct _keybinding
*keybindingptr
;
1293 typedef struct _keybinding
{
1294 xcWidget window
; /* per-window function, or NULL */
1298 keybindingptr nextbinding
;
1301 /*----------------------------------------------------------------------*/
1302 /* Enumeration of functions available for binding to keys/buttons */
1303 /* IMPORTANT! Do not alter this list without also fixing the text */
1304 /* in keybindings.c! */
1305 /*----------------------------------------------------------------------*/
1308 XCF_ENDDATA
= -2, XCF_SPACER
/* -1 */,
1309 XCF_Page
/* 0 */, XCF_Anchor
/* 1 */,
1310 XCF_Superscript
/* 2 */, XCF_Subscript
/* 3 */,
1311 XCF_Normalscript
/* 4 */, XCF_Font
/* 5 */,
1312 XCF_Boldfont
/* 6 */, XCF_Italicfont
/* 7 */,
1313 XCF_Normalfont
/* 8 */, XCF_Underline
/* 9 */,
1314 XCF_Overline
/* 10 */, XCF_ISO_Encoding
/* 11 */,
1315 XCF_Halfspace
/* 12 */, XCF_Quarterspace
/* 13 */,
1316 XCF_Special
/* 14 */, XCF_TabStop
/* 15 */,
1317 XCF_TabForward
/* 16 */, XCF_TabBackward
/* 17 */,
1318 XCF_Text_Return
/* 18 */, XCF_Text_Delete
/* 19 */,
1319 XCF_Text_Right
/* 20 */, XCF_Text_Left
/* 21 */,
1320 XCF_Text_Up
/* 22 */, XCF_Text_Down
/* 23 */,
1321 XCF_Text_Split
/* 24 */, XCF_Text_Home
/* 25 */,
1322 XCF_Text_End
/* 26 */, XCF_Linebreak
/* 27 */,
1323 XCF_Parameter
/* 28 */, XCF_Edit_Param
/* 29 */,
1324 XCF_ChangeStyle
/* 30 */, XCF_Edit_Delete
/* 31 */,
1325 XCF_Edit_Insert
/* 32 */, XCF_Edit_Append
/* 33 */,
1326 XCF_Edit_Next
/* 34 */, XCF_Attach
/* 35 */,
1327 XCF_Next_Library
/* 36 */, XCF_Library_Directory
/* 37 */,
1328 XCF_Library_Move
/* 38 */, XCF_Library_Copy
/* 39 */,
1329 XCF_Library_Edit
/* 40 */, XCF_Library_Delete
/* 41 */,
1330 XCF_Library_Duplicate
/* 42 */, XCF_Library_Hide
/* 43 */,
1331 XCF_Library_Virtual
/* 44 */, XCF_Page_Directory
/* 45 */,
1332 XCF_Library_Pop
/* 46 */, XCF_Virtual
/* 47 */,
1333 XCF_Help
/* 48 */, XCF_Redraw
/* 49 */,
1334 XCF_View
/* 50 */, XCF_Zoom_In
/* 51 */,
1335 XCF_Zoom_Out
/* 52 */, XCF_Pan
/* 53 */,
1336 XCF_Double_Snap
/* 54 */, XCF_Halve_Snap
/* 55 */,
1337 XCF_Write
/* 56 */, XCF_Rotate
/* 57 */,
1338 XCF_Flip_X
/* 58 */, XCF_Flip_Y
/* 59 */,
1339 XCF_Snap
/* 60 */, XCF_SnapTo
/* 61 */,
1340 XCF_Pop
/* 62 */, XCF_Push
/* 63 */,
1341 XCF_Delete
/* 64 */, XCF_Select
/* 65 */,
1342 XCF_Box
/* 66 */, XCF_Arc
/* 67 */,
1343 XCF_Text
/* 68 */, XCF_Exchange
/* 69 */,
1344 XCF_Copy
/* 70 */, XCF_Move
/* 71 */,
1345 XCF_Join
/* 72 */, XCF_Unjoin
/* 73 */,
1346 XCF_Spline
/* 74 */, XCF_Edit
/* 75 */,
1347 XCF_Undo
/* 76 */, XCF_Redo
/* 77 */,
1348 XCF_Select_Save
/* 78 */, XCF_Unselect
/* 79 */,
1349 XCF_Dashed
/* 80 */, XCF_Dotted
/* 81 */,
1350 XCF_Solid
/* 82 */, XCF_Prompt
/* 83 */,
1351 XCF_Dot
/* 84 */, XCF_Wire
/* 85 */,
1352 XCF_Cancel
/* 86 */, XCF_Nothing
/* 87 */,
1353 XCF_Exit
/* 88 */, XCF_Netlist
/* 89 */,
1354 XCF_Swap
/* 90 */, XCF_Pin_Label
/* 91 */,
1355 XCF_Pin_Global
/* 92 */, XCF_Info_Label
/* 93 */,
1356 XCF_Graphic
/* 94 */, XCF_SelectBox
/* 95 */,
1357 XCF_Connectivity
/* 96 */, XCF_Continue_Element
/* 97 */,
1358 XCF_Finish_Element
/* 98 */, XCF_Continue_Copy
/* 99 */,
1359 XCF_Finish_Copy
/* 100 */, XCF_Finish
/* 101 */,
1360 XCF_Cancel_Last
/* 102 */, XCF_Sim
/* 103 */,
1361 XCF_SPICE
/* 104 */, XCF_PCB
/* 105 */,
1362 XCF_SPICEflat
/* 106 */, XCF_Rescale
/* 107 */,
1363 XCF_Reorder
/* 108 */, XCF_Color
/* 109 */,
1364 XCF_Margin_Stop
/* 110 */, XCF_Text_Delete_Param
/* 111 */,
1368 /*----------------------------------------------------------------------*/
1369 /* Per-drawing-page parameters */
1370 /*----------------------------------------------------------------------*/
1373 /* per-drawing-page parameters */
1374 objinstptr pageinst
;
1375 char *filename
; /* file to save as */
1376 u_char idx
; /* page index */
1377 psbkground background
; /* background rendered file info */
1385 XPoint drawingscale
;
1386 XPoint pagesize
; /* size of page to print on */
1390 /*----------------------------------------------------------------------*/
1391 /* Structure holding information about graphic images used. These hold */
1392 /* the original data for the images, and may be shared. */
1393 /*----------------------------------------------------------------------*/
1401 /*----------------------------------------------------------------------*/
1402 /* The main globally-accessible data structure. This structure holds */
1403 /* all the critical data needed by the drawing window */
1404 /*----------------------------------------------------------------------*/
1406 typedef struct _windowdata
*XCWindowDataPtr
;
1408 typedef struct _windowdata
{
1410 XCWindowDataPtr next
; /* next window in list */
1412 /* widgets and X11 parameters */
1414 xcWidget scrollbarh
, scrollbarv
;
1420 Pixmap pbuf
; /* clipmask buffer for hierarchical clipping */
1421 signed char clipped
;
1423 #endif /* !HAVE_CAIRO */
1425 xcIntervalId time_id
;
1426 Boolean redraw_needed
;
1427 Boolean redraw_ongoing
;
1429 cairo_surface_t
*surface
;
1430 cairo_t
*cr
; /* cairo_drawing context */
1431 cairo_pattern_t
*fixed_pixmap
; /* pixmap holding the background data of */
1432 /* all fixed element. ie. not including the */
1433 /* element currently being edited. */
1434 #else /* HAVE_CAIRO */
1435 Pixmap fixed_pixmap
;
1436 #endif /* HAVE_CAIRO */
1437 /* global page parameters */
1438 short width
, height
;
1440 float vscale
; /* proper scale */
1441 XPoint pcorner
; /* page position */
1443 /* global option defaults */
1451 short filter
; /* selection filter */
1461 Boolean mapped
; /* indicates if window is drawable */
1462 char buschar
; /* Character indicating vector notation */
1463 Boolean editinplace
;
1465 Boolean pinattach
; /* keep wires attached to pins when moving objinsts */
1466 Boolean showclipmasks
; /* draw clipmask shape outlines */
1473 /* buffers and associated variables */
1474 XPoint save
, origin
;
1481 objinstptr topinstance
;
1482 objectptr editstack
;
1485 pushlistptr hierstack
;
1486 event_mode_t event_mode
;
1487 char *lastbackground
;
1488 Cursor
*defaultcursor
;
1491 /* Record for undo function */
1493 typedef struct _undostack
*Undoptr
;
1495 typedef struct _undostack
{
1496 Undoptr next
; /* next record in undo stack */
1497 Undoptr last
; /* double-linked for "redo" function */
1498 u_int type
; /* type of event */
1499 short idx
; /* counter for undo event */
1500 objinstptr thisinst
; /* instance of object in which event occurred */
1501 XCWindowData
*window
;/* window in which event occurred */
1502 int idata
; /* simple undedicated integer datum */
1503 char *undodata
; /* free space to be malloc'd */
1504 /* (size dependent on "type") */
1507 /* This whole thing needs to be cleaned up. . . now I've got objects in */
1508 /* "library" which are repeated both in the "instlist" pair and the */
1509 /* "thisobject" pointer in each instance. The instance is repeated on */
1510 /* the library page. Ideally, the instance list should only exist on */
1511 /* the library page, and not be destroyed on every call to "composelib" */
1516 liblistptr instlist
; /* List of instances */
1519 typedef struct _Technology
*TechPtr
;
1521 typedef struct _Technology
{
1522 u_char flags
; /* Flags for library page (changed, read-only) */
1523 char *technology
; /* Namespace name (without the "::") */
1524 char *filename
; /* Library file associated with technology */
1525 TechPtr next
; /* Linked list */
1528 /* Known flags for library pages */
1530 #define TECH_CHANGED 0x01
1531 #define TECH_READONLY 0x02 /* Technology file not writable */
1532 #define TECH_IMPORTED 0x04 /* Loaded only part of file */
1533 #define TECH_REPLACE 0x08 /* Replace instances when reading */
1534 #define TECH_REPLACE_TEMP 0x10 /* Temporary store */
1535 #define TECH_USED 0x20 /* Temporary marker flag */
1536 #define TECH_PREFER 0x40 /* Prefer technology on name conflict */
1538 /*----------------------------------------------------------------------*/
1539 /* A convenient structure for holding all the object lists */
1540 /*----------------------------------------------------------------------*/
1543 char *libsearchpath
; /* list of directories to search */
1544 char *filesearchpath
; /* list of directories to search */
1547 Boolean retain_backup
;
1548 xcIntervalId timeout_id
;
1550 Boolean filefilter
; /* Is the file list filtered? */
1551 Boolean hold
; /* allow HOLD modifiers on buttons */
1552 Boolean showtech
; /* Write technology names in library */
1553 u_short new_changes
;
1554 signed char suspend
; /* suspend graphics updates if TRUE */
1557 Pagedata
**pagelist
;
1558 Undoptr undostack
; /* actions to undo */
1559 Undoptr redostack
; /* actions to redo */
1562 TechPtr technologies
;
1564 Imagedata
*imagelist
;
1566 XCWindowData
*windowlist
; /* linked list of known windows */
1570 /*-------------------------------------------------------------------------*/
1571 /* Track state of the ghostscript renderer */
1572 /*-------------------------------------------------------------------------*/
1575 GS_INIT
, /* Initial state; gs is idle. */
1576 GS_PENDING
, /* Drawing in progress; gs is busy. */
1577 GS_READY
/* Drawing done; gs is waiting for "next". */
1581 /*-------------------------------------------------------------------------*/
1582 /* For the eventmodes (ARC_MODE, EARC_MODE, SPLINE_MODE, etc) the drawing */
1583 /* and/or redrawing of the elements is centralized in functions */
1584 /* corresponding to the eventmode name (arc_mode_draw, spline_mode_draw, */
1585 /* etc.). Depending on the state these functions clear, draw or whatever */
1586 /* is needed. A description of the options follows below */
1587 /* fixed_pixmap refers to the background pixmap without the element(s) */
1588 /* currently being edited. */
1589 /*-------------------------------------------------------------------------*/
1592 xcDRAW_INIT
, /* Initalize fixed_pixmap and draw the element(s) */
1593 /* element(s) currently being edited, including */
1596 xcDRAW_EDIT
, /* Draw the currently edited element(s), including */
1599 xcDRAW_FINAL
, /* Draw the finalized element(s), without edit */
1600 /* lines to the fixed_pixmap */
1602 xcDRAW_EMPTY
, /* Refresh the screen by drawing the fixed_pixmap */
1603 /* This essentially clear the edited elements */
1605 xcREDRAW_FORCED
/* Redraws everything, including edit lines. Only */
1606 /* used in drawarea. This one should be called */
1607 /* when something has changed (eg. zoom). */
1608 /* It will redraw the fixed_pixmap */
1611 /*----------------------------------------------------------------------*/
1612 /* structures previously defined in menudefs.h */
1613 /*----------------------------------------------------------------------*/
1614 /*----------------------------------------------------------------------*/
1615 /* Menu Definitions for hierarchical pulldown menus */
1616 /*----------------------------------------------------------------------*/
1620 typedef struct _menustruct
*menuptr
;
1622 typedef struct _menustruct
{
1626 XtCallbackProc func
;
1630 /*----------------------------------------------------------------------*/
1631 /* Structure for calling routines from the Toolbar icons */
1632 /*----------------------------------------------------------------------*/
1634 typedef struct _toolbarstruct
*toolbarptr
;
1636 typedef struct _toolbarstruct
{
1639 XtCallbackProc func
;
1645 /* Menus and Toolbars are taken care of entirely by scripts in the Tcl/ */
1646 /* Tk version of xcircuit. */
1647 /*----------------------------------------------------------------------*/