5 /* Modification History
7 Created 12/20/98 Dan Espen:
9 - FvwmForm.c got too big for my home machine to deal with.
13 #include "libs/Flocale.h" /* for font definition stuff */
15 * This next stuff should be more specific and customizable.
16 * For example padVText (above) was one of the things TXT_SPC
20 /* This one, box_spc would have to be saved as part of an "item".
21 It's used for input boxes, buttons, and I think, choices.
24 /* Item_hspc is only used during the "massage phase"
25 has to be saved in items. */
29 /* Control the areas that are realloced in chunks: */
30 #define ITEMS_PER_EXPANSION 32
31 #define CHOICES_PER_SEL_EXPANSION 8
32 #define BUTTON_COMMAND_EXPANSION 8
33 #define TIMEOUT_COMMAND_EXPANSION 8
49 /* There is a "drawtable" for each item drawn in a form */
50 typedef struct _drawtable
{
51 struct _drawtable
*dt_next
; /* link list, circle */
52 char *dt_font_name
; /* font name */
53 char *dt_color_names
[4];
54 int dt_used
; /* 1=used as text, 2 used as item */
55 unsigned long dt_colors
[6]; /* text fore/back
56 button/choice/input fore/back
57 hilite and shadow (item only)
58 Note, need all 6 because choices
60 GC dt_GC
; /* graphic ctx used for text */
61 GC dt_item_GC
; /* graphic ctx used for graphics */
62 FlocaleFont
*dt_Ffont
; /* Fvwm font structure */
63 FlocaleWinString
*dt_Fstr
; /* Fvwm string (handles multibyte) */
66 /* An "item" is something in a form. Part of the structure is common
67 for all item types, the rest of the structure is a union. */
69 int type
; /* item type, one of I_TEXT .. I_BUTTON */
70 struct _head
{ /* common header */
72 union _item
*next
; /* for all items linklist */
73 int win
; /* X window id */
74 char *name
; /* identifier name */
75 int size_x
, size_y
; /* size of bounding box */
76 int pos_x
, pos_y
; /* position of top-left corner */
77 DrawTable
*dt_ptr
; /* only used for items that need it */
82 int n
; /* string length */
83 char *value
; /* string to display */
84 unsigned long color
; /* color of text */
87 struct { /* I_INPUT */
89 int buf
; /* input string buffer */
90 int n
; /* string length */
91 char *value
; /* input string */
92 char *init_value
; /* default string */
93 char *blanks
; /* blank string */
94 int size
; /* input field size */
95 int left
; /* position of the left-most displayed char */
96 union _item
*next_input
; /* a ring of input fields */
97 union _item
*prev_input
; /* for tabbing */
98 int value_history_count
; /* count of input history */
99 int value_history_yankat
; /* yank point between restarts */
100 char **value_history_ptr
; /* curr insertion point */
102 struct { /* I_SELECT */
104 int key
; /* one of IS_MULTIPLE, IS_SINGLE */
105 int n
; /* number of choices */
106 int choices_array_count
; /* current choices array size */
107 union _item
**choices
; /* list of choices */
109 struct { /* I_CHOICE */
111 int on
; /* selected or not */
112 int init_on
; /* initially selected or not */
113 char *value
; /* value if selected */
114 int n
; /* text string length */
115 char *text
; /* text string */
116 union _item
*sel
; /* selection it belongs to */
118 struct { /* I_BUTTON */
120 int key
; /* one of IB_CONTINUE, IB_RESTART, IB_QUIT */
121 int n
; /* # of commands */
122 int len
; /* text length */
123 char *text
; /* text string */
124 int keypress
; /* short cut */
125 int button_array_size
; /* current size of next array */
126 char **commands
; /* Fvwm command to execute */
128 struct { /* I_TIMEOUT */
130 int timeleft
; /* seconds left on timer */
131 int len
; /* text length */
132 char *text
; /* text string */
133 char *command
; /* Fvwm command(s) to execute */
140 #define L_LEFTRIGHT 4
141 #define MICRO_S_FOR_10MS 10000
142 #define VH_SIZE 50 /* size of value history */
144 /* There is one "line" structure for each line in the form.
145 "Lines" point at an array of "items". */
146 typedef struct _line
{
147 struct _line
*next
; /* Pointer to next line */
148 int n
; /* number of items on the line */
149 int justify
; /* justification */
150 int size_x
, size_y
; /* size of bounding rectangle */
151 int item_array_size
; /* track size */
152 Item
**items
; /* ptr to array of items */
155 /* Need a struct for the pointer color.
156 Since colors are unsigned, we need a flag to indicate whether
157 the color was ever set. */
158 typedef struct _ptrc
{
159 XColor pointer_color
;
163 /* There is one "form". Start of attempt to change that. */
164 typedef struct _form
{
166 struct _form
*next
; /* dje hmm. a linklist of forms? */
169 int grab_server
; /* set during parse used on display */
170 int server_grabbed
; /* first time switch */
171 int gx
, gy
, have_geom
;
174 int max_width
, total_height
; /* frame size */
175 unsigned long screen_background
;
176 Item
*cur_input
; /* current input during parse and run */
177 Item
*first_input
; /* forms first input item during parse*/
178 Item
*last_error
; /* fvwm error message display area */
179 DrawTable
*roots_dt
; /* root draw tables linklist */
183 int padVText
; /* vert space for text item */
184 char *leading
; /* part of command to match for data */
185 char *file_to_read
; /* file to read for data */
186 char *title
; /* form title, NULL, use alias */
187 char *expand_buffer
; /* buffer to expand commands in */
188 int expand_buffer_size
; /* current size */
189 char have_env_var
; /* at least one env var on cmd line */
191 Ptr_color p_c
[6]; /* fg/bg for pointers, used flag */
192 int activate_on_press
; /* activate button on press */
195 enum {input_pointer
,button_pointer
,button_in_pointer
};
196 enum {input_fore
,input_back
,
197 button_fore
,button_back
,
198 button_in_fore
,button_in_back
};
200 extern Form cur_form
; /* current form */
201 #define CF cur_form /* I may want to undo this... */
205 /* Link list roots */
206 extern Item
*root_item_ptr
; /* pointer to root of item list */
207 extern Line root_line
;
208 extern Line
*cur_line
;
209 extern char preload_yorn
;
210 extern Item
*item
; /* current during parse */
211 extern Item
*cur_sel
, *cur_button
; /* current during parse */
213 extern Atom wm_del_win
;
214 extern int fd_x
; /* fd for X connection */
215 extern Window root
, ref
;
218 enum { c_bg
, c_fg
, c_item_bg
, c_item_fg
, c_itemlo
, c_itemhi
};
219 extern char *color_names
[4];
220 extern char bg_state
;
221 extern char endDefaultsRead
;
222 enum { f_text
, f_input
, f_button
, f_timeout
};
223 extern char *font_names
[4];
224 extern char *screen_background_color
;
227 extern int itemcolorset
;
229 /* From FvwmAnimate start */
231 extern int MyNameLen
;
232 /* here is the old double parens trick. */
235 #define myfprintf(X) \
242 #define tempmyfprintf(X) \
246 extern int Channel
[2];
248 /* From FvwmAnimate end */
251 void ReadXServer(void); /* ReadXServer.c */
252 void RedrawText(Item
*item
); /* FvwmForm.c */
253 void RedrawTimeout(Item
*item
); /* FvwmForm.c */
255 Item
*item
, int click
, XEvent
*pev
); /* FvwmForm.c */
256 void UpdateRootTransapency(
257 Bool pr_only
, Bool do_draw
); /* FvwmForm.c */
258 void DoCommand (Item
*cmd
); /* FvwmForm.c */
259 int FontWidth (XFontStruct
*xfs
); /* FvwmForm.c */
260 void RedrawFrame (XEvent
*pev
); /* FvwmForm.c */
261 char * ParseCommand (int, char *, char, int *, char **s
); /* ParseCommand.c */
263 RETSIGTYPE
DeadPipe(int nonsense
); /* FvwmForm.c */