1 #define SUBSYSTEM APPLICATION_EXEC "_widget: "
2 
3 #if ! defined(PROG_DISABLE_GUI) && ! defined(PROG_DISABLE_WIDGET)
4 #define WIDGET_TYPE_NONE 0							/* Widget types */
5 #define WIDGET_TYPE_BACKGROUND 1
6 #define WIDGET_TYPE_BLOCK 2
7 #define WIDGET_TYPE_LABEL 3
8 #define WIDGET_TYPE_LAMP 4
9 #define WIDGET_TYPE_LED_1 5
10 #define WIDGET_TYPE_LED_2 6
11 #define WIDGET_TYPE_LED_3 7
12 #define WIDGET_TYPE_PUSHBUTTON_1 8
13 #define WIDGET_TYPE_PUSHBUTTON_2 9
14 #define WIDGET_TYPE_PUSHBUTTON_3 10
15 #define WIDGET_TYPE_SLIDESWITCH 11
16 #define WIDGET_TYPE_TOGGLESWITCH 12
17 #define WIDGET_TYPE_TURNSWITCH 13
18 
19 #define WIDGET_SCALE_TYPE_NONE 0						/* Widget scale types */
20 #define WIDGET_SCALE_TYPE_BARS 1
21 #define WIDGET_SCALE_TYPE_DOTS 2
22 #define WIDGET_SCALE_TYPE_NUDE 3
23 
24 #define WIDGET_SCALE_DOT_WIDTH 12						/* Widget scale dot pixel buffer dimensions in pixels */
25 #define WIDGET_SCALE_DOT_HEIGHT 12
26 
27 #define WIDGET_SCALE_DISTANCE_FROM_RING 4.0					/* Widget scale text distance from ring of lines, smaller value is closer to scale ring */
28 #define WIDGET_SCALE_DISTANCE_FROM_DOTS 7.0					/* Widget scale text distance from ring of dots, smaller value is closer to scale ring */
29 #define WIDGET_SCALE_DISTANCE_FROM_EDGE 4.0					/* Widget scale distance, smaller value is closer to widget edge */
30 #define WIDGET_SCALE_DISTANCE_ENDPOINT 10.0					/* Widget scale endpoint distance, smaller value makes longer line */
31 
32 #define WIDGET_SCALE_GAUGE_MARGIN 32.0						/* Widget scale margin where pointer is on gauge */
33 
34 #define WIDGET_CB_TYPE_NONE 0							/* Widget callback types */
35 #define WIDGET_CB_TYPE_PUSHBUTTON_PUSH 1
36 #define WIDGET_CB_TYPE_SLIDESWITCH_SLIDE 2
37 #define WIDGET_CB_TYPE_TOGGLESWITCH_TOGGLE 3
38 #define WIDGET_CB_TYPE_TURNSWITCH_TURN 4
39 
40 #define WIDGET_CB_TYPE_KEYPRESS 5
41 #define WIDGET_CB_TYPE_KEYRELEASE 6
42 #define WIDGET_CB_TYPE_BUTTONPRESS 7
43 #define WIDGET_CB_TYPE_BUTTONRELEASE 8
44 
45 #define WIDGET_FRAME_LAMP_ANGLES 2						/* Widget frame angles */
46 #define WIDGET_FRAME_LED_ANGLES 2
47 #define WIDGET_FRAME_PUSHBUTTON_ANGLES 2
48 #define WIDGET_FRAME_TOGGLESWITCH_ANGLES 7
49 #define WIDGET_FRAME_TURNSWITCH_ANGLES 360
50 
51 #define WIDGET_STATE_DISABLE 0							/* Widget states */
52 #define WIDGET_STATE_ENABLE 1
53 
54 #define WIDGET_DEFAULT_COLOR 0							/* Widget defaults for creating new widgets */
55 #define WIDGET_DEFAULT_FONT_SIZE 10
56 #define WIDGET_DEFAULT_FONT_DPI 0
57 #define WIDGET_DEFAULT_JUSTIFICATION WIDGET_TITLE_JUSTIFICATION_LEFT
58 
59 #define WIDGET_SHADOW_RED 0x10							/* Widget shadow color components */
60 #define WIDGET_SHADOW_GREEN 0x10
61 #define WIDGET_SHADOW_BLUE 0x16
62 #define WIDGET_SHADOW_OPAQUENESS 0xc0
63 
64 #define WIDGET_SLIDER_SLIT_RED 0x16
65 #define WIDGET_SLIDER_SLIT_GREEN 0x19
66 #define WIDGET_SLIDER_SLIT_BLUE 0x13
67 #define WIDGET_SLIDER_SLIT_WIDTH 6
68 
69 #define WIDGET_BBOX_RED 0xff
70 #define WIDGET_BBOX_GREEN 0x10
71 #define WIDGET_BBOX_BLUE 0xff
72 #define WIDGET_BBOX_ALPHA 0xff
73 
74 struct widget_cb {
75 	unsigned int c;								/* Widget callback type (WIDGET_CB_TYPE_*) */
76 
77 	char *s;								/* Widget callback subroutine name */
78 };
79 
80 struct widget_stack {
81 	unsigned int c;								/* Widget type (WIDGET_TYPE_*) */
82 
83 	void *p;								/* Widget structure pointer */
84 
85 	struct widget_cb *cb;							/* Widget callbacks */
86 };
87 
88 struct widget_def {
89 	unsigned int id;							/* Widget stack id for window (a_window.p) */
90 
91 	struct widget_stack *stack;						/* Widget structures for window */
92 };
93 
94 struct widget_geometry {
95 	int x, y;								/* Widget position in pixels */
96 
97 	unsigned int w, h;							/* Widget size in pixels */
98 };
99 
100 struct widget_id {
101 	char *s;								/* Widget unique name */
102 
103 	size_t t;								/* Widget unique name length in bytes */
104 
105 	unsigned int f;								/* Widget unique name is allocated or not */
106 	unsigned int g;								/* Widget type structure is allocated or not */
107 
108 	unsigned int c;								/* Widget initial state (WIDGET_STATE_*) */
109 };
110 
111 struct widget_indicator {
112 	unsigned int f;								/* Widget indicator font handle */
113 	unsigned int c;								/* Widget indicator mode (WIDGET_INDICATOR_MODE_*) */
114 
115 	char *fc, *fs;								/* Widget indicator font charset and font file */
116 
117 	unsigned int fz, fr;							/* Widget indicator font size and resolution */
118 
119 	int fo;									/* Widget indicator vertical offset in pixels */
120 
121 	int ox, oy;								/* Widget indicator text previous position in pixels */
122 
123 	unsigned int ow, oh;							/* Widget indicator text previous dimensions in pixels */
124 
125 	struct pixel_rgba_8 r;							/* Widget indicator color */
126 
127 	struct text_2 i;							/* Widget indicator text info structure */
128 
129 	struct point_4 b_4;							/* Widget indicator point structure for backbuffer */
130 	struct region_copy_8 b_8;						/* Widget indicator region structure for backbuffer */
131 };
132 
133 struct widget_scale {
134 	unsigned int c;								/* Widget scale type (WIDGET_SCALE_TYPE_*) */
135 
136 	unsigned int k;								/* Widget scale item count */
137 	unsigned int d;								/* Widget scale dot is already generated or not */
138 
139 	struct points_4 p;							/* Widget scale lines for bars */
140 
141 	struct region_copy_8 *g;						/* Widget scale sphere region for dots */
142 	struct pixel_rgba_8 *m;							/* Widget scale sphere pixel buffer for dots */
143 
144 	struct texts_2 t;							/* Widget scale titles */
145 
146 	struct pixel_rgba_8 r;							/* Widget scale color */
147 
148 	struct rect_4 b;							/* Widget scale region structure for bounding box */
149 
150 	struct point_4 b_4;							/* Widget scale point structure for backbuffer */
151 	struct region_copy_8 b_8;						/* Widget scale region structure for backbuffer */
152 };
153 
154 struct widget_title {
155 	char *s;								/* Widget title */
156 
157 	size_t t;								/* Widget title length in bytes */
158 
159 	char *c;								/* Widget title font charset */
160 	char *e;								/* Widget title font file */
161 
162 	unsigned int y;								/* Widget title font size in 1/64 points */
163 	unsigned int d;								/* Widget title font resolution in dots per inch */
164 
165 	struct pixel_rgba_8 r;							/* Widget title color */
166 
167 	unsigned int j;								/* Widget title justification */
168 	unsigned int f;								/* Widget title font handle */
169 
170 	unsigned int q;								/* Widget title is rendered or not flag */
171 
172 	struct text_2 i;							/* Widget title text info structure */
173 
174 	struct point_4 b_4;							/* Widget title point structure for backbuffer */
175 	struct region_copy_8 b_8;						/* Widget title region structure for backbuffer */
176 };
177 
178 struct widget_type_background {
179 	unsigned int set;							/* Background set */
180 
181 	struct widget_id e;							/* Background id */
182 
183 	char *s;								/* Background file name if background is image */
184 
185 	struct pixel_rgba_8 c;							/* Background color if background is solid color */
186 
187 	float ch, cv;								/* Background hue and value */
188 
189 	struct widget_geometry p;						/* Background geometry */
190 };
191 
192 struct widget_type_block {
193 	unsigned int set;							/* Block set */
194 
195 	struct widget_id e;							/* Block id */
196 
197 	char *s;								/* Block file name if block is image */
198 
199 	struct pixel_rgba_8 c;							/* Block color if block is solid color */
200 	struct pixel_rgba_8 b;							/* Block border color */
201 
202 	unsigned int d;								/* Block border thickness in pixels */
203 
204 	struct pixel_rgba_8 *u;							/* Block backbuffer for image content */
205 
206 	struct widget_geometry p;						/* Block geometry */
207 };
208 
209 struct widget_type_label {
210 	unsigned int set;							/* Label set */
211 
212 	struct widget_id e;							/* Label id */
213 
214 	struct widget_title t;							/* Label title */
215 	struct widget_geometry p;						/* Label geometry */
216 };
217 
218 struct widget_type_lamp {
219 	unsigned int set;							/* Lamp set */
220 
221 	struct widget_id e;							/* Lamp id */
222 
223 	unsigned int o;								/* Lamp subtype (offset for widget_predraw structure) */
224 
225 	struct widget_title t;							/* Lamp title */
226 
227 	unsigned int k;								/* Lamp title position */
228 
229 	int ox, oy;								/* Lamp title finetune offsets */
230 
231 	unsigned int a, b;							/* Lamp minimum and maximum angles */
232 	unsigned int c;								/* Lamp steps between min and max */
233 	unsigned int d;								/* Lamp current position in steps */
234 
235 	float ch;								/* Lamp hue tune value */
236 
237 	struct widget_geometry p;						/* Lamp geometry */
238 };
239 
240 struct widget_type_led {
241 	unsigned int set;							/* Led set */
242 
243 	struct widget_id e;							/* Led id */
244 
245 	unsigned int o;								/* Led subtype (offset for widget_predraw structure) */
246 
247 	struct widget_title t;							/* Led title */
248 
249 	unsigned int k;								/* Led title position */
250 
251 	int ox, oy;								/* Led title finetune offsets */
252 
253 	unsigned int a, b;							/* Led minimum and maximum angles */
254 	unsigned int c;								/* Led steps between min and max */
255 	unsigned int d;								/* Led current position in steps */
256 
257 	float ch;								/* Led hue tune value */
258 
259 	struct widget_geometry p;						/* Led geometry */
260 };
261 
262 #define widget_type_led_1 widget_type_led
263 #define widget_type_led_2 widget_type_led
264 #define widget_type_led_3 widget_type_led
265 
266 struct widget_type_pushbutton {
267 	unsigned int set;							/* Pushbutton set */
268 
269 	struct widget_id e;							/* Pushbutton id */
270 
271 	unsigned int o;								/* Pushbutton subtype (offset for widget_predraw structure) */
272 
273 	struct widget_title t;							/* Pushbutton title */
274 
275 	unsigned int k;								/* Pushbutton title position */
276 
277 	int ox, oy;								/* Pushbutton title finetune offsets */
278 
279 	unsigned int a, b;							/* Pushbutton minimum and maximum angles */
280 	unsigned int c;								/* Pushbutton steps between min and max */
281 	unsigned int d;								/* Pushbutton current position in steps */
282 
283 	unsigned int z;								/* Pushbutton is sticky or not (stays on position) */
284 
285 	float ch;								/* Pushbutton hue tune value */
286 
287 	struct widget_geometry p;						/* Pushbutton geometry */
288 };
289 
290 #define widget_type_pushbutton_1 widget_type_pushbutton
291 #define widget_type_pushbutton_2 widget_type_pushbutton
292 #define widget_type_pushbutton_3 widget_type_pushbutton
293 
294 struct widget_type_slideswitch {
295 	unsigned int set;							/* Slideswitch set */
296 
297 	struct widget_id e;							/* Slideswitch id */
298 
299 	unsigned int o;								/* Slideswitch subtype (offset for widget_predraw structure) */
300 
301 	struct widget_title t;							/* Slideswitch title */
302 
303 	unsigned int k;								/* Slideswitch title position */
304 
305 	int ox, oy;								/* Slideswitch title finetune offsets */
306 
307 	unsigned int a;								/* Slideswitch minimum value (always zero) */
308 	unsigned int b;								/* Slideswitch slide length in pixels */
309 	unsigned int c;								/* Slideswitch steps */
310 	unsigned int d;								/* Slideswitch current position in steps */
311 
312 	unsigned int g;								/* Slideswitch callback trigger mode is continuous or not */
313 
314 	float ch;								/* Slideswitch hue tune value */
315 
316 	struct widget_geometry p;						/* Slideswitch geometry */
317 	struct widget_geometry q;						/* Slideswitch title geometry */
318 	struct widget_scale s;							/* Slideswitch scale */
319 	struct widget_indicator i;						/* Slideswitch indicator */
320 };
321 
322 struct widget_type_toggleswitch {
323 	unsigned int set;							/* Toggleswitch set */
324 
325 	struct widget_id e;							/* Toggleswitch id */
326 
327 	unsigned int o;								/* Toggleswitch subtype (offset for widget_predraw structure) */
328 
329 	struct widget_title t;							/* Toggleswitch title */
330 
331 	unsigned int k;								/* Toggleswitch title position */
332 
333 	int ox, oy;								/* Toggleswitch title finetune offsets */
334 
335 	unsigned int a, b;							/* Toggleswitch minimum and maximum angles */
336 	unsigned int c;								/* Toggleswitch steps between min and max */
337 	unsigned int d;								/* Toggleswitch current position in steps */
338 
339 	unsigned int g;								/* Toggleswitch callback trigger mode is continuous or not */
340 
341 	float ch;								/* Toggleswitch hue tune value */
342 
343 	struct widget_geometry p;						/* Toggleswitch geometry */
344 	struct widget_scale s;							/* Toggleswitch scale */
345 	struct widget_indicator i;						/* Toggleswitch indicator */
346 };
347 
348 struct widget_type_turnswitch {
349 	unsigned int set;							/* Turnswitch set */
350 
351 	struct widget_id e;							/* Turnswitch id */
352 
353 	unsigned int o;								/* Turnswitch subtype (offset for widget_predraw structure) */
354 
355 	struct widget_title t;							/* Turnswitch title */
356 
357 	unsigned int k;								/* Turnswitch title position */
358 
359 	int ox, oy;								/* Turnswitch title finetune offsets */
360 
361 	unsigned int a, b;							/* Turnswitch minimum and maximum angles */
362 	unsigned int c;								/* Turnswitch steps between min and max */
363 	unsigned int d;								/* Turnswitch current position in steps */
364 
365 	unsigned int g;								/* Turnswitch callback trigger mode is continuous or not */
366 
367 	float ch;								/* Turnswitch hue tune value */
368 
369 	struct widget_geometry p;						/* Turnswitch geometry */
370 	struct widget_scale s;							/* Turnswitch scale */
371 	struct widget_indicator i;						/* Turnswitch indicator */
372 };
373 
374 #define WIDGET_GFX_LAMP 0							/* Widget graphics offsets for struct widget_predraw */
375 #define WIDGET_GFX_LED_1 1
376 #define WIDGET_GFX_LED_2 2
377 #define WIDGET_GFX_LED_3 3
378 #define WIDGET_GFX_PUSHBUTTON_1 4
379 #define WIDGET_GFX_PUSHBUTTON_2 5
380 #define WIDGET_GFX_PUSHBUTTON_3 6
381 #define WIDGET_GFX_SLIDESWITCH 7
382 #define WIDGET_GFX_TOGGLESWITCH 8
383 #define WIDGET_GFX_TURNSWITCH 9
384 #define WIDGET_GFX_LASTINLINE WIDGET_GFX_TURNSWITCH
385 
386 #define WIDGET_GFX_TYPES 6							/* Widget graphics subtypes available */
387 #define WIDGET_GFX_CACHE 32							/* Widget graphics cache by hue values */
388 
389 struct widget_predraw_op {
390 	float c_h;								/* Widget graphics hue tune value */
391 
392 	struct t_img a_i;							/* Widget graphics image structure */
393 };
394 
395 struct widget_predraw_it {
396 	char *a;								/* Widget file name */
397 
398 	unsigned int f;								/* Widget file handle */
399 	unsigned int c;								/* Widget frame count */
400 
401 	unsigned int a_w, a_h, b_w, b_h;					/* Widget graphics and shadow frame dimensions in pixels */
402 	unsigned int c_f, d_f;							/* Widget graphics and shadow frame offset if many subtypes in same file */
403 
404 	int o_x, o_y;								/* Widget graphics offset to shadow in pixels */
405 
406 	uint8_t *m;								/* Widget graphics mouse mask */
407 
408 	struct t_img b_i;							/* Widget graphics shadow image structure */
409 
410 	struct widget_predraw_op c_o[WIDGET_GFX_CACHE];
411 };
412 
413 struct widget_predraw_t {
414 	struct widget_predraw_it c_t[WIDGET_GFX_TYPES];
415 };
416 
417 static struct widget_predraw_t widget_predraw[] = {
418 	{ {
419 		/* Lamps */
420 		{ "lamp_1_1.widget",
421 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
422 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
423 		{ "lamp_1_1.widget",
424 			0, 0, 0, 0, 0, 0, 2, 0, 0, 0, NULL,
425 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
426 		{ "lamp_1_1.widget",
427 			0, 0, 0, 0, 0, 0, 4, 0, 0, 0, NULL,
428 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
429 		{ "lamp_1_1.widget",
430 			0, 0, 0, 0, 0, 0, 6, 0, 0, 0, NULL,
431 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
432 		{ "lamp_1_1.widget",
433 			0, 0, 0, 0, 0, 0, 8, 0, 0, 0, NULL,
434 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
435 		{ "lamp_1_1.widget",
436 			0, 0, 0, 0, 0, 0, 10, 0, 0, 0, NULL,
437 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
438 	} },
439 	{ {
440 		/* Leds, type 1 */
441 		{ "led_1_1.widget",
442 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
443 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
444 		{ "led_1_1.widget",
445 			0, 0, 0, 0, 0, 0, 2, 0, 0, 0, NULL,
446 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
447 		{ "led_1_1.widget",
448 			0, 0, 0, 0, 0, 0, 4, 0, 0, 0, NULL,
449 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
450 		{ "led_1_1.widget",
451 			0, 0, 0, 0, 0, 0, 6, 0, 0, 0, NULL,
452 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
453 		{ "led_1_1.widget",
454 			0, 0, 0, 0, 0, 0, 8, 0, 0, 0, NULL,
455 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
456 		{ "led_1_1.widget",
457 			0, 0, 0, 0, 0, 0, 10, 0, 0, 0, NULL,
458 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
459 	} },
460 	{ {
461 		/* Leds, type 2 */
462 		{ "led_2_1.widget",
463 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
464 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
465 		{ "led_2_1.widget",
466 			0, 0, 0, 0, 0, 0, 2, 0, 0, 0, NULL,
467 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
468 		{ "led_2_1.widget",
469 			0, 0, 0, 0, 0, 0, 4, 0, 0, 0, NULL,
470 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
471 		{ "led_2_1.widget",
472 			0, 0, 0, 0, 0, 0, 6, 0, 0, 0, NULL,
473 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
474 		{ "led_2_1.widget",
475 			0, 0, 0, 0, 0, 0, 8, 0, 0, 0, NULL,
476 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
477 		{ "led_2_1.widget",
478 			0, 0, 0, 0, 0, 0, 10, 0, 0, 0, NULL,
479 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
480 	} },
481 	{ {
482 		/* Leds, type 3 */
483 		{ "led_3_1.widget",
484 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
485 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
486 		{ "led_3_1.widget",
487 			0, 0, 0, 0, 0, 0, 2, 0, 0, 0, NULL,
488 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
489 		{ "led_3_1.widget",
490 			0, 0, 0, 0, 0, 0, 4, 0, 0, 0, NULL,
491 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
492 		{ "led_3_1.widget",
493 			0, 0, 0, 0, 0, 0, 6, 0, 0, 0, NULL,
494 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
495 		{ "led_3_1.widget",
496 			0, 0, 0, 0, 0, 0, 8, 0, 0, 0, NULL,
497 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
498 		{ "led_3_1.widget",
499 			0, 0, 0, 0, 0, 0, 10, 0, 0, 0, NULL,
500 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
501 	} },
502 	{ {
503 		/* Pushbuttons, type 1 */
504 		{ "button_1_1.widget",
505 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
506 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
507 		{ "button_1_1.widget",
508 			0, 0, 0, 0, 0, 0, 2, 0, 0, 0, NULL,
509 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
510 		{ "button_1_1.widget",
511 			0, 0, 0, 0, 0, 0, 4, 0, 0, 0, NULL,
512 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
513 		{ "button_1_1.widget",
514 			0, 0, 0, 0, 0, 0, 6, 0, 0, 0, NULL,
515 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
516 		{ "button_1_1.widget",
517 			0, 0, 0, 0, 0, 0, 8, 0, 0, 0, NULL,
518 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
519 		{ "button_1_1.widget",
520 			0, 0, 0, 0, 0, 0, 10, 0, 0, 0, NULL,
521 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
522 	} },
523 	{ {
524 		/* Pushbuttons, type 2 */
525 		{ "button_2_1.widget",
526 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
527 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
528 		{ "button_2_1.widget",
529 			0, 0, 0, 0, 0, 0, 2, 0, 0, 0, NULL,
530 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
531 		{ "button_2_1.widget",
532 			0, 0, 0, 0, 0, 0, 4, 0, 0, 0, NULL,
533 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
534 		{ "button_2_1.widget",
535 			0, 0, 0, 0, 0, 0, 6, 0, 0, 0, NULL,
536 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
537 		{ "button_2_1.widget",
538 			0, 0, 0, 0, 0, 0, 8, 0, 0, 0, NULL,
539 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
540 		{ "button_2_1.widget",
541 			0, 0, 0, 0, 0, 0, 10, 0, 0, 0, NULL,
542 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
543 	} },
544 	{ {
545 		/* Pushbuttons, type 3 */
546 		{ "button_3_1.widget",
547 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
548 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
549 		{ "button_3_1.widget",
550 			0, 0, 0, 0, 0, 0, 2, 0, 0, 0, NULL,
551 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
552 		{ "button_3_1.widget",
553 			0, 0, 0, 0, 0, 0, 4, 0, 0, 0, NULL,
554 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
555 		{ "button_3_1.widget",
556 			0, 0, 0, 0, 0, 0, 6, 0, 0, 0, NULL,
557 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
558 		{ "button_3_1.widget",
559 			0, 0, 0, 0, 0, 0, 8, 0, 0, 0, NULL,
560 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
561 		{ "button_3_1.widget",
562 			0, 0, 0, 0, 0, 0, 10, 0, 0, 0, NULL,
563 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
564 	} },
565 	{ {
566 		/* Slideswitches */
567 		{ "slide_1_1.widget",
568 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
569 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
570 		{ "slide_1_2.widget",
571 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
572 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
573 		{ "slide_2_1.widget",
574 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
575 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
576 		{ "slide_2_2.widget",
577 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
578 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
579 		{ "slide_3_1.widget",
580 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
581 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
582 		{ "slide_3_2.widget",
583 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
584 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
585 	} },
586 	{ {
587 		/* Toggleswitches */
588 		{ "lamp_1_1.widget",
589 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
590 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
591 		{ NULL,
592 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
593 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
594 		{ NULL,
595 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
596 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
597 		{ NULL,
598 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
599 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
600 		{ NULL,
601 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
602 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
603 		{ NULL,
604 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
605 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
606 	} },
607 	{ {
608 		/* Turnswitches */
609 		{ "knob_1_1.widget",
610 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
611 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
612 		{ "knob_1_2.widget",
613 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
614 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
615 		{ "knob_2_1.widget",
616 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
617 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
618 		{ "knob_2_2.widget",
619 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
620 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
621 		{ "knob_3_1.widget",
622 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
623 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } },
624 		{ "knob_3_2.widget",
625 			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
626 			{ 0, 0, 0, NULL, NULL, 0 }, { { -1.0, { 0, 0, 0, NULL, NULL, 0 } } } }
627 	} }
628 };
629 
630 static const char *c_d_t[] = {							/* Search directories for widget files */
631 	DIR_PLACE_WIDGETS_1, DIR_PLACE_WIDGETS_2, DIR_PLACE_WIDGETS_3,		/*  $ is considered as env var, */
632 	DIR_PLACE_WIDGETS_4, DIR_PLACE_WIDGETS_5, DIR_PLACE_WIDGETS_6,		/*  ~ is considered as home dir, */
633 	DIR_PLACE_WIDGETS_7, DIR_PLACE_WIDGETS_8, DIR_PLACE_WIDGETS_9,		/*  @ is considered as installation prefix */
634 	DIR_PLACE_WIDGETS_10,							/*  . is considered as absolute path */
635 
636 	NULL
637 };
638 
639 static int c_shadow_opaque = WIDGET_SHADOW_OPAQUENESS;				/* Resource options */
640 static int c_font_size = WIDGET_DEFAULT_FONT_SIZE;
641 static int c_font_dpi = WIDGET_DEFAULT_FONT_DPI;
642 
643 static char *c_font_face = NULL;
644 
645 #if ! defined(__GNUC__) || (__GNUC__ < 5)
646 static struct pixel_rgba_8 c_shadow_color;
647 static struct pixel_rgba_8 c_slider_slit_color;
648 #else
649 static struct pixel_rgba_8 c_shadow_color = {
650 	.pixel.r = WIDGET_SHADOW_RED,
651 	.pixel.g = WIDGET_SHADOW_GREEN,
652 	.pixel.b = WIDGET_SHADOW_BLUE,
653 	.pixel.a = 0
654 };
655 
656 static struct pixel_rgba_8 c_slider_slit_color = {
657 	.pixel.r = WIDGET_SLIDER_SLIT_RED,
658 	.pixel.g = WIDGET_SLIDER_SLIT_GREEN,
659 	.pixel.b = WIDGET_SLIDER_SLIT_BLUE,
660 	.pixel.a = 0
661 };
662 #endif
663 
664 static struct s_cnf s_cnf_t[] = {
665 	/* REMEMBER to add new entries to styles.h as well */
666 	{ "widget.shadowColor", &c_shadow_color.pixel.p, CONFIG_TYPE_COLOR },
667 	{ "widget.shadowOpaque", &c_shadow_opaque, CONFIG_TYPE_INTEGER },
668 	{ "widget.sliderSlitColor", &c_slider_slit_color.pixel.p, CONFIG_TYPE_COLOR },
669 	{ "widget.fontFace", &c_font_face, CONFIG_TYPE_STRING },
670 	{ "widget.fontSize", &c_font_size, CONFIG_TYPE_INTEGER },
671 	{ "widget.fontDPI", &c_font_dpi, CONFIG_TYPE_INTEGER },
672 
673 	{ NULL, NULL, 0 }
674 };
675 
676 static int widget_init_stack_op(struct w_stack *);
677 static struct w_info *widget_init_stack_alloc(struct w_stack *, unsigned int, void *);
678 static int widget_init_stack_bob(struct w_stack *, struct w_info *, unsigned int, char *);
679 static int widget_init_stack_bob_le(struct w_stack *, struct w_info *, unsigned int, unsigned int);
680 static int widget_init_stack_bob_pb(struct w_stack *, struct w_info *, unsigned int, unsigned int);
681 static void widget_init_stack_bob_sl_h(struct w_stack *, struct w_info *, struct widget_type_slideswitch *);
682 static void widget_init_stack_bob_sl_v(struct w_stack *, struct w_info *, struct widget_type_slideswitch *);
683 static int widget_init_stack_bob_af(struct w_stack *, struct w_info *, struct widget_title *, struct widget_geometry *);
684 static int widget_init_stack_bob_ag(struct w_stack *, struct w_info *, struct widget_title *, struct widget_geometry *, unsigned int, int, int);
685 static void widget_init_stack_bob_ag_x(struct widget_title *, struct widget_geometry *, int, unsigned int);
686 static void widget_init_stack_bob_ag_y(struct widget_title *, struct widget_geometry *, int, int, unsigned int, unsigned int, unsigned int);
687 static int widget_init_stack_bob_at(struct w_stack *, struct w_info *, struct widget_title *, struct widget_geometry *, struct widget_geometry *, unsigned int, unsigned int, float, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int, int, double);
688 static int widget_init_stack_bob_au(struct w_stack *, struct w_info *, struct widget_geometry *, struct pixel_rgba_8 *, struct pixel_rgba_8 *, unsigned int);
689 static int widget_init_stack_bob_au_noalpha(struct w_stack *, struct w_info *, struct widget_geometry *, struct pixel_rgba_8 *);
690 static int widget_init_stack_bob_aw(struct w_stack *, struct w_info *, struct widget_geometry *, struct pixel_rgba_8 *, unsigned int, unsigned int);
691 static int widget_init_stack_bob_av(struct w_stack *, struct w_info *, struct widget_geometry *, struct t_img *);
692 static int widget_init_stack_bob_av_noalpha(struct w_stack *, struct w_info *, struct widget_geometry *, struct t_img *, float, float);
693 static void widget_init_stack_bob_av_hue(struct w_info *, struct t_img *, float, float);
694 static void widget_init_stack_bob_av_op(struct w_info *, struct widget_geometry *, struct pixel_rgba_8 *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
695 static void widget_init_stack_bob_av_full(struct w_info *, struct widget_geometry *, struct pixel_rgba_8 *, unsigned int, unsigned int, unsigned int, unsigned int);
696 static void widget_init_stack_bob_av_part(struct w_info *, struct widget_geometry *, struct pixel_rgba_8 *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
697 static void widget_init_stack_bob_av_border(struct w_info *, struct widget_geometry *, struct pixel_rgba_8 *, unsigned int);
698 static struct pixel_rgba_8 *widget_init_stack_bob_store(struct pixel_rgba_8 *, size_t);
699 static void widget_init_stack_bob_content(unsigned int, unsigned int, struct w_info *, struct pixel_rgba_8 *, struct pixel_rgba_8 *, struct pixel_rgba_8 *, unsigned int);
700 static unsigned int widget_init_stack_bob_frame(unsigned int, unsigned int, unsigned int, unsigned int, double);
701 static int widget_init_stack_bob_op(struct w_info *, struct widget_geometry *);
702 static int widget_init_stack_bob_text_render(struct w_info *, struct widget_title *);
703 static void widget_init_stack_bob_text_close(struct widget_title *);
704 static void widget_init_stack_bob_text(struct w_stack *, struct widget_title *);
705 static void widget_init_stack_bob_copy(struct w_stack *, struct w_info *);
706 static void widget_init_stack_bob_copy_noalpha(struct w_stack *, struct w_info *);
707 static void widget_init_stack_bob_fill(struct w_stack *, struct w_info *, struct pixel_rgba_8 *, int, int, int, int);
708 static void widget_init_stack_bob_fill_noalpha(struct w_stack *, struct w_info *, struct pixel_rgba_8 *);
709 static void widget_init_stack_bob_fill_border(struct w_stack *, struct w_info *, struct pixel_rgba_8 *, unsigned int);
710 static void widget_init_stack_bob_mask(struct w_stack *, struct w_info *, unsigned int, unsigned int);
711 static void widget_init_stack_bob_apps(struct w_stack *, struct w_info *, struct pixel_c_2 *);
712 static void widget_init_stack_bob_sets(struct w_stack *, struct w_info *);
713 static void widget_init_stack_bob_rems(struct w_stack *, struct w_info *);
714 static int widget_init_stack_cb_add(struct w_info *, struct widget_cb *);
715 static int widget_init_stack_cb_delete(struct w_info *, struct widget_cb *);
716 static int widget_init_stack_bob_predraw(unsigned int, unsigned int, float, struct t_img **, struct t_img **);
717 static unsigned int widget_init_stack_bob_predraw_op(char *, struct t_img *, struct t_img *, uint8_t **, int *, int *, unsigned int *, unsigned int);
718 static void widget_init_stack_bob_predraw_it(struct pixel_rgba_8 *, unsigned int, unsigned int, unsigned int, float);
719 static void widget_init_stack_bob_predraw_size(unsigned int, unsigned int, unsigned int *, unsigned int *, unsigned int *, unsigned int *);
720 static void widget_init_stack_bob_predraw_offset(unsigned int, unsigned int, int *, int *);
721 static void widget_init_stack_bob_predraw_error(unsigned int);
722 static void widget_init_stack_bob_predraw_fetch(struct widget_predraw_it *);
723 static unsigned int widget_init_stack_bob_predraw_frame(unsigned int, unsigned int);
724 static uint8_t *widget_init_stack_bob_predraw_mask(unsigned int, unsigned int);
725 static void widget_init_stack_collision(struct w_stack *, struct w_info *, struct widget_id *, struct widget_geometry *);
726 static void widget_init_stack_collision_op(struct w_info *, struct w_info *, struct widget_id *, struct widget_geometry *, struct widget_id *, struct widget_geometry *);
727 static int widget_init_stack_collision_it(int, int, int);
728 static int widget_init_stack_collision_at(struct w_collision *, struct w_info *);
729 static void widget_free_widget(struct w_info *);
730 static void widget_free_widget_scale(struct widget_scale *);
731 static void widget_free_widget_indicator(struct widget_indicator *);
732 static void widget_free_widget_par(struct w_info *);
733 static int widget_create_led_op(struct w_stack *, char *, int, int, unsigned int, unsigned int, int, int, unsigned int, unsigned int);
734 static int widget_create_pushbutton_op(struct w_stack *, char *, int, int, unsigned int, unsigned int, int, int, unsigned int, unsigned int, unsigned int);
735 static int widget_create_it(struct w_stack *, struct widget_id *, struct widget_geometry *, void *, char *, int, int, unsigned int, unsigned int, unsigned int);
736 static int widget_create_op(struct w_stack *, struct widget_id *, void *, unsigned int);
737 static int widget_create_op_id(struct widget_id *, char *);
738 static void widget_create_op_gm(struct widget_geometry *, int, int, unsigned int, unsigned int);
739 static void *widget_create_op_alloc(size_t);
740 static int widget_state(struct w_stack *, struct w_info *, unsigned int);
741 static int widget_state_op(struct w_stack *, struct w_info *, unsigned int *, unsigned int, char *);
742 static int widget_state_it(struct w_stack *, struct w_info *, unsigned int, char *);
743 static void widget_step_set_ld(struct w_stack *, struct w_info *, unsigned int, unsigned int);
744 static void widget_step_set_pb(struct w_stack *, struct w_info *, unsigned int, unsigned int);
745 static void widget_step_set_ss(struct w_stack *, struct w_info *, unsigned int);
746 static void widget_step_set_op(struct w_stack *, struct w_info *, struct widget_scale *, struct widget_indicator *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int *, struct widget_geometry *, unsigned int, unsigned int, unsigned int, unsigned int, float, double);
747 static void widget_step_set_title(struct w_stack *, struct w_info *, struct widget_title *);
748 static void widget_indicator_set_at(struct widget_indicator *, char *, char *, unsigned int, unsigned int, int, struct pixel_rgba_8 *);
749 static void widget_indicator_set_op(struct w_stack *, struct w_info *, struct widget_indicator *, struct widget_geometry *, unsigned int, unsigned int, unsigned int);
750 static int widget_update_scale_bars_line(struct w_stack *, struct w_info *, struct widget_geometry *, struct widget_scale *, struct pixel_rgba_8 *, char *, char *, unsigned int, unsigned int, char **, double, double, unsigned int, double, double, unsigned int);
751 static void widget_update_scale_bars_line_h(struct widget_geometry *, struct widget_scale *, struct pixel_rgba_8 *, char *, char **, int, int, int, unsigned int, unsigned int, double, double);
752 static void widget_update_scale_bars_line_v(struct widget_geometry *, struct widget_scale *, struct pixel_rgba_8 *, char *, char **, int, int, int, unsigned int, unsigned int, double, double);
753 static int widget_update_scale_bars_round(struct w_stack *, struct w_info *, struct widget_geometry *, struct widget_scale *, struct pixel_rgba_8 *, char *, char *, unsigned int, unsigned int, char **, double, double, double, double, unsigned int);
754 static int widget_update_scale_dots_round(struct w_stack *, struct w_info *, struct widget_geometry *, struct widget_scale *, struct pixel_rgba_8 *, char *, char *, unsigned int, unsigned int, char **, double, double, double, double, unsigned int);
755 static int widget_update_scale_nude_round(struct w_stack *, struct w_info *, struct widget_geometry *, struct widget_scale *, struct pixel_rgba_8 *, char *, char *, unsigned int, unsigned int, char **, double, double, double, double, unsigned int);
756 static int widget_update_scale_it(struct w_stack *, char *, char *, char *, unsigned int, unsigned int, char **, double, double, unsigned int, struct pixel_rgba_8 *, unsigned int);
757 static unsigned int widget_update_scale_font(char *, unsigned int, unsigned int);
758 static void widget_update_scale_round_it(struct widget_scale *, struct pixel_rgb_8 *);
759 static void widget_update_scale(struct w_stack *, struct w_info *, struct widget_scale *);
760 static void widget_update_scale_op(struct w_stack *, struct w_info *, struct widget_scale *, int, int, unsigned int, unsigned int);
761 static void widget_update_indicator(struct w_stack *, struct w_info *, struct widget_indicator *, struct widget_geometry *, unsigned int, unsigned int);
762 static void widget_update_indicator_x(struct widget_indicator *, struct widget_geometry *);
763 static void widget_update_indicator_y(struct widget_indicator *, struct widget_geometry *, unsigned int, int, unsigned int);
764 static void widget_update_indicator_op(struct w_stack *, struct w_info *, struct widget_indicator *, int, int, unsigned int, unsigned int);
765 static int widget_update_indicator_at(struct widget_indicator *, struct widget_geometry *, unsigned int);
766 static void widget_update_op(struct w_stack *, struct w_info *, int, int, unsigned int, unsigned int);
767 static void widget_update_it(struct w_stack *, struct w_info *, struct region_copy_8 *, int, int, unsigned int, unsigned int);
768 static int widget_cb_add_op(struct w_stack *, char *, char *, unsigned int);
769 static int widget_cb_delete_op(struct w_stack *, char *, unsigned int);
770 static void widget_refresh_op(struct w_stack *, int, int, unsigned int, unsigned int);
771 static int widget_push_cb_button_press_pb(struct t_ctx *, struct w_stack *, struct w_info *, struct w_par *, unsigned int);
772 static int widget_push_cb_button_release_pb(struct w_stack *, struct w_info *, struct w_par *, unsigned int);
773 static int widget_push_cb_button_clear_13(unsigned int, unsigned int *);
774 static int widget_push_cb_button_toggle_13(unsigned int, unsigned int *);
775 static int widget_push_cb_button_press_13(unsigned int, unsigned int, unsigned int *);
776 static int widget_push_cb_button_press_134567(unsigned int, unsigned int, unsigned int *, unsigned int);
777 static int widget_push_cb_button_press_menu(struct t_ctx *, unsigned int, struct w_par *, char *, size_t);
778 static void widget_push_cb_button_swap(struct w_par *);
779 struct w_info *widget_get_info_by_id(struct w_stack *, unsigned int);
780 struct w_info *widget_get_info_by_name(struct w_stack *, char *);
781 static int widget_get_info_by_name_op(struct widget_id *, char *, size_t);
782 static struct w_info *widget_get_info_by_set(struct w_stack *, unsigned int, unsigned int *);
783 static char *widget_strcpy(char *, char *);
784 
785 /* dsl_cb.c */
786 void dsl_cb_param_uint_add(struct d_par *, unsigned int, unsigned int);
787 void dsl_cb_param_string_add(struct d_par *, char *, size_t, unsigned int);
788 
789 /* styles.c */
790 void styles_fetch_all(struct s_cnf *);
791 
792 /* widget_cb.c */
793 void widget_cb_pushbutton_push(struct w_par *, struct d_par *);
794 void widget_cb_slideswitch_slide(struct w_par *, struct d_par *);
795 void widget_cb_toggleswitch_toggle(struct w_par *, struct d_par *);
796 void widget_cb_turnswitch_turn(struct w_par *, struct d_par *);
797 
798 void widget_cb_generic_key_press(struct w_par *, struct d_par *);
799 void widget_cb_generic_key_release(struct w_par *, struct d_par *);
800 void widget_cb_generic_button_press(struct w_par *, struct d_par *);
801 void widget_cb_generic_button_release(struct w_par *, struct d_par *);
802 
803 /* worker_draw.c */
804 unsigned int window_get_mod_shift(void);
805 unsigned int window_get_mod_lock(void);
806 unsigned int window_get_mod_ctrl(void);
807 unsigned int window_get_mod_cmd(void);
808 unsigned int window_get_mod_alt(void);
809 
810 /* worker_menu.c */
811 #if ! defined(PROG_DISABLE_MENU)
812 int menu_init_stack_by_name(struct t_ctx *, char *, size_t, unsigned int);
813 #endif
814 #endif
815