1 /*
2  * FIG : Facility for Interactive Generation of figures
3  * Copyright (c) 1991 by Paul King
4  * Parts Copyright (c) 1989-2007 by Brian V. Smith
5  *
6  * Any party obtaining a copy of these files is granted, free of charge, a
7  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
8  * nonexclusive right and license to deal in this software and documentation
9  * files (the "Software"), including without limitation the rights to use,
10  * copy, modify, merge, publish, distribute, sublicense and/or sell copies of
11  * the Software, and to permit persons who receive copies from any such
12  * party to do so, with the only requirement being that the above copyright
13  * and this permission notice remain intact.
14  *
15  */
16 
17 #ifndef W_INDPANEL_H
18 #define W_INDPANEL_H
19 
20 #include "w_icons.h"
21 
22 /* size of buttons in indicator panel */
23 #define		DEF_IND_SW_HT		34
24 #define		DEF_IND_SW_WD		64
25 #define		FONT_IND_SW_WD		(40+PS_FONTPANE_WD)
26 #define		NARROW_IND_SW_WD	56
27 #define		WIDE_IND_SW_WD		76
28 #define		XWIDE_IND_SW_WD		90
29 
30 /* size of update control panel */
31 #define		UPD_BITS	10	/* bits wide and high */
32 #define		UPD_BORD	1	/* border width for update squares */
33 #define		UPD_INT		2	/* internal spacing */
34 #define		UPD_CTRL_HT	40 + UPD_BITS + 2*UPD_BORD + 2*UPD_INT
35 
36 extern Dimension UPD_CTRL_WD;		/* actual width is det. in setup_ind_panel */
37 
38 #define NUM_CAPSTYLE_TYPES	3
39 #define NUM_JOINSTYLE_TYPES	3
40 #define NUM_LINESTYLE_TYPES	6
41 
42 /* indicator button selection */
43 
44 #define I_ANGLEGEOM	0x00000001
45 #define I_VALIGN	0x00000002
46 #define I_HALIGN	0x00000004
47 #define I_ARROWSIZE	0x00000008
48 #define I_POINTPOSN	0x00000010
49 #define I_FILLSTYLE	0x00000020
50 #define I_BOXRADIUS	0x00000040
51 #define I_LINEWIDTH	0x00000080
52 #define I_LINESTYLE	0x00000100
53 #define I_ARROWMODE	0x00000200
54 #define I_TEXTJUST	0x00000400
55 #define I_FONTSIZE	0x00000800
56 #define I_FONT		0x00001000
57 #define I_TEXTSTEP	0x00002000
58 #define I_DIMLINE	0x00004000
59 #define I_ROTNANGLE	0x00008000
60 #define I_NUMSIDES	0x00010000
61 #define I_PEN_COLOR	0x00020000
62 #define I_FILL_COLOR	0x00040000
63 #define I_LINKMODE	0x00080000
64 #define I_DEPTH		0x00100000
65 #define I_ELLTEXTANGLE	0x00200000
66 #define I_TEXTFLAGS	0x00400000
67 #define I_JOINSTYLE	0x00800000
68 #define I_ARROWTYPE	0x01000000
69 #define I_CAPSTYLE	0x02000000
70 #define I_ARCTYPE	0x04000000
71 #define I_NUMCOPIES	0x08000000
72 #define I_NUMXCOPIES	0x10000000
73 #define I_NUMYCOPIES	0x20000000
74 #define I_TANGNORMLEN	0x40000000
75 #define I_free1_____	0x80000000	/* this one is free for another ind */
76 
77 #define I_NONE		0x00000000
78 
79 /* be sure to update I_ALL if more buttons are added */
80 #define I_ALL		0xffffffff & ~I_free1_____
81 
82 #define I_MIN2		(I_POINTPOSN)
83 #define I_MIN3		(I_MIN2 | I_LINKMODE)
84 #define I_ADDMOVPT	(I_MIN2 | I_ANGLEGEOM)
85 #define I_TEXT0		(I_TEXTJUST | I_FONT | I_FONTSIZE | I_PEN_COLOR | \
86 				I_DEPTH | I_ELLTEXTANGLE | I_TEXTFLAGS)
87 #define I_TEXT		(I_MIN2 | I_TEXTSTEP | I_TEXT0)
88 #define I_LINE0		(I_FILLSTYLE | I_LINESTYLE | I_LINEWIDTH | \
89 				I_PEN_COLOR | I_FILL_COLOR | I_DEPTH)
90 #define I_LINE1		(I_FILLSTYLE | I_LINESTYLE | I_JOINSTYLE | I_LINEWIDTH | \
91 				I_PEN_COLOR | I_FILL_COLOR | I_DEPTH | I_CAPSTYLE)
92 #define I_LINE		(I_MIN2 | I_LINE1 | I_DEPTH | I_ANGLEGEOM | I_DIMLINE | \
93 				I_ARROWMODE | I_ARROWTYPE | I_ARROWSIZE)
94 #define I_BOX		(I_MIN2 | I_LINE1 | I_DEPTH)
95 #define I_CIRCLE	(I_MIN2 | I_LINE0 | I_DEPTH)
96 #define I_ELLIPSE	(I_MIN2 | I_LINE0 | I_DEPTH | I_ELLTEXTANGLE)
97 #define I_ARC		(I_BOX | I_ARROWMODE | I_ARROWTYPE | I_ARROWSIZE | \
98 				I_CAPSTYLE | I_ARCTYPE)
99 #define I_CHOP		(I_ARCTYPE)
100 #define I_REGPOLY	(I_BOX | I_NUMSIDES)
101 #define I_CLOSED	(I_BOX | I_ANGLEGEOM)
102 #define I_OPEN		(I_CLOSED | I_ARROWMODE | I_ARROWTYPE | I_ARROWSIZE | I_CAPSTYLE)
103 #define I_ARCBOX	(I_BOX | I_BOXRADIUS)
104 #define I_PICOBJ	(I_MIN2 | I_DEPTH | I_PEN_COLOR)
105 #define I_OBJECT	(I_TEXT0 | I_LINE1 | I_ARROWMODE | I_ARROWTYPE | I_ARROWSIZE | \
106 				I_BOXRADIUS | I_DEPTH | I_ARCTYPE | I_DIMLINE)
107 #define I_ALIGN		(I_HALIGN | I_VALIGN)
108 #define I_ROTATE	(I_MIN2 | I_ROTNANGLE | I_NUMCOPIES)
109 #define I_COPY		(I_MIN3 | I_NUMXCOPIES | I_NUMYCOPIES)
110 #define I_ADD_DEL_ARROW (I_LINEWIDTH | I_ARROWTYPE | I_ARROWSIZE)
111 #define I_TANGENT       (I_MIN2 | I_LINE1 | I_DEPTH | I_ARROWTYPE | I_ARROWMODE | I_TANGNORMLEN)
112 
113 /* for checking which parts to update */
114 #define I_UPDATEMASK	(I_OBJECT)
115 
116 typedef struct choice_struct {
117     int		    value;
118     icon_struct	   *icon;
119     Pixmap	    pixmap;
120 }		choice_info;
121 
122 extern choice_info arrowtype_choices[];
123 extern choice_info dim_arrowtype_choices[];
124 extern choice_info fillstyle_choices[];
125 extern choice_info capstyle_choices[];
126 extern choice_info joinstyle_choices[];
127 extern choice_info linestyle_choices[];
128 
129 typedef struct ind_sw_struct {
130     int		    type;	/* one of I_CHOICE .. I_FVAL */
131     unsigned long   func;
132     char	    line1[38], line2[8];
133     int		    sw_width;
134     int		   *i_varadr;
135     float	   *f_varadr;
136     void	    (*inc_func) ();
137     void	    (*dec_func) ();
138     void	    (*show_func) ();
139     int		    min, max;	/* min, max values allowable */
140     float	    inc;	/* increment for spinner */
141     choice_info	   *choices;	/* specific to I_CHOICE */
142     int		    numchoices; /* specific to I_CHOICE */
143     int		    sw_per_row; /* specific to I_CHOICE */
144     Bool	    update;	/* whether this object component is updated by update */
145     Widget	    button;
146     Widget	    formw;
147     Widget	    updbut;
148     Pixmap	    pixmap;
149     Widget	    panel;	/* to keep track if already created */
150 }		ind_sw_info;
151 
152 extern ind_sw_info ind_switches[];
153 extern ind_sw_info *fill_style_sw;
154 extern ind_sw_info *pen_color_button, *fill_color_button, *depth_button;
155 
156 #define ZOOM_SWITCH_INDEX	0	/* used by w_zoom.c */
157 
158 /* EXPORTS */
159 
160 extern void	init_ind_panel(Widget tool);
161 extern void	add_ind_actions(void);
162 extern Boolean	update_buts_managed;
163 extern Widget	choice_popup;
164 extern void	show_depth(ind_sw_info *sw), show_zoom(ind_sw_info *sw);
165 extern void	show_fillstyle(ind_sw_info *sw);
166 extern void	fontpane_popup(int *psfont_adr, int *latexfont_adr, int *psflag_adr, void (*showfont_fn) (/* ??? */), Widget show_widget);
167 extern void	make_pulldown_menu_images(choice_info *entries, Cardinal nent, Pixmap *images, char **texts, Widget parent, XtCallbackProc callback);
168 extern void	tog_selective_update(long unsigned int mask);
169 extern unsigned long cur_indmask;	/* mask showing which indicator buttons are mapped */
170 extern void	inc_zoom_centered(ind_sw_info *sw);
171 extern void	dec_zoom_centered(ind_sw_info *sw);
172 extern void	fit_zoom(ind_sw_info *sw);
173 extern void	wheel_inc_zoom(), wheel_dec_zoom();
174 extern void update_current_settings(void);
175 extern void setup_ind_panel(void);
176 extern void manage_update_buts (void);
177 extern void recolor_fillstyles (void);
178 extern void unmanage_update_buts (void);
179 extern void update_indpanel (long unsigned int mask);
180 extern void choice_panel_dismiss (void);
181 extern void set_and_show_rotnangle (float value);
182 extern void generate_choice_pixmaps(ind_sw_info *isw);
183 extern void draw_cur_dimline(void);
184 extern void get_dimline_values(void);
185 extern void popup_arrowsize_panel(ind_sw_info *isw);
186 extern void popup_flags_panel(ind_sw_info *isw);
187 extern void popup_nval_panel(ind_sw_info *isw);
188 extern void popup_dimline_panel(ind_sw_info *isw);
189 extern void popup_choice_panel(ind_sw_info *isw);
190 
191 #endif /* W_INDPANEL_H */
192