1 /*
2 Copyright (C) 2011-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5
6 /*
7 WARNING: This file was generated by the dkct program (see
8 http://dktools.sourceforge.net/ for details).
9 Changes you make here will be lost if dkct is run again!
10 You should modify the original source and run dkct on it.
11 Original source: dkct-gui.ctr
12 */
13
14 /** @file dkct-gui.c The dkct-gui module.
15 */
16
17
18 #include "dk4conf.h"
19
20 #include <dkct/dkct.h>
21
22 #include <libdk3c/dk3unused.h>
23
24
25
26
27
28
29
30 /** Class names for GUI elements.
31 */
32 static char const * const dkct_gui_class_names[] = {
33 /* 0 */ "wxFrame",
34 /* 1 */ "wxDialog",
35 /* 2 */ "wxMDIParentFrame",
36 /* 3 */ "wxMDIChildFrame",
37 /* 4 */ "wxPopupWindow",
38 /* 5 */ "wxBoxSizer",
39 /* 6 */ "wxFlexGridSizer",
40 /* 7 */ "wxGridBagSizer",
41 /* 8 */ "wxGridSizer",
42 /* 9 */ "wxStaticBoxSizer",
43 /* 10 */ "wxStdDialogButtonSizer",
44 /* 11 */ "wxPanel",
45 /* 12 */ "wxNotebook",
46 /* 13 */ "wxScrolledWindow",
47 /* 14 */ "wxSplitterWindow",
48 /* 15 */ "wxButton",
49 /* 16 */ "wxBitmapButton",
50 /* 17 */ "wxChoice",
51 /* 18 */ "wxComboBox",
52 /* 19 */ "wxCheckBox",
53 /* 20 */ "wxListBox",
54 /* 21 */ "wxCheckListBox",
55 /* 22 */ "wxRadioBox",
56 /* 23 */ "wxRadioButton",
57 /* 24 */ "wxScrollBar",
58 /* 25 */ "wxSpinButton",
59 /* 26 */ "wxSpinCtrl",
60 /* 27 */ "wxSlider",
61 /* 28 */ "wxTextCtrl",
62 /* 29 */ "wxToggleButton",
63 /* 30 */ "wxGauge",
64 /* 31 */ "wxStaticText",
65 /* 32 */ "wxStaticBitmap",
66 /* 33 */ "wxStaticLine",
67 /* 34 */ "wxStaticBox",
68 /* 35 */ "wxMenuBar",
69 /* 36 */ "wxMenu",
70 /* 37 */ "wxMenuItem",
71 /* 38 */ "wxToolBar",
72 /* 39 */ "wxStatusBar",
73 /* 40 */ "wxToolBarToolBase", /* Not a wxWidgets class! */
74 /* 41 */ "wxGrid",
75 /* 42 */ "wxChoicebook",
76 /* 43 */ "wxListbook",
77 /* 44 */ "wxSimplebook",
78 /* 45 */ "wxToolbook",
79 /* 46 */ "wxTreebook",
80 /* 47 */ "wxScrolled<wxPanel>",
81 NULL
82 };
83
84
85
86 /** Option names.
87 */
88 static char const * const dkct_gui_option_keys[] = {
89 /* 0 */ "align",
90 NULL
91 };
92
93
94
95 /** Checkbox state names.
96 */
97 static char const * const dkct_gui_db_state_names[] = {
98 /* 0 */ "unchecked",
99 /* 1 */ "checked",
100 /* 2 */ "undetermined",
101 NULL
102 };
103
104
105
106 /** Table selection mode names.
107 */
108 static char const * const dkct_gui_cb_sel_names[]= {
109 /* 0 */ "single",
110 /* 1 */ "multiple",
111 /* 2 */ "extended",
112 NULL
113 };
114
115
116
117 /** Style property names for slider.
118 */
119 static char const * const dkct_gui_slider_style_names[] = {
120 /* 0 */ "ticks",
121 /* 1 */ "labels",
122 /* 2 */ "left",
123 /* 3 */ "right",
124 /* 4 */ "top",
125 /* 5 */ "bottom",
126 /* 6 */ "range",
127 /* 7 */ "inverse",
128 NULL
129 };
130
131
132
133 /** Style property names for text control.
134 */
135 static char const * const dkct_gui_text_style_names[] = {
136 /* 0 */ "enter",
137 /* 1 */ "tab",
138 /* 2 */ "multiline",
139 /* 3 */ "password",
140 /* 4 */ "readonly",
141 /* 5 */ "rich",
142 /* 6 */ "rich2",
143 /* 7 */ "url",
144 /* 8 */ "selection",
145 /* 9 */ "left",
146 /* 10 */ "centered",
147 /* 11 */ "right",
148 /* 12 */ "no-wrap",
149 /* 13 */ "char-wrap",
150 /* 14 */ "word-wrap",
151 /* 15 */ "best-wrap",
152 /* 16 */ "capitalize",
153 /* 17 */ "no-auto-resize",
154 NULL
155 };
156
157
158
159 /** Style property names for notebook.
160 */
161 static char const * const dkct_gui_notebook_style_names[] = {
162 /* 0 */ "top",
163 /* 1 */ "left",
164 /* 2 */ "right",
165 /* 3 */ "bottom",
166 /* 4 */ "fixed-width",
167 /* 5 */ "multiline",
168 /* 6 */ "no-theme",
169 /* 7 */ "flat",
170 NULL
171 };
172
173
174
175 /** Style property names for splitter window.
176 */
177 static char const * const dkct_gui_splitterw_style_names[] = {
178 /* 0 */ "3d",
179 /* 1 */ "3d-sash",
180 /* 2 */ "3d-border",
181 /* 3 */ "border",
182 /* 4 */ "no-border",
183 /* 5 */ "no-xp-theme",
184 /* 6 */ "permit-unsplit",
185 /* 7 */ "live-update",
186 NULL
187 };
188
189
190
191 /** Style property names for bitmap button.
192 */
193 static char const * const dkct_gui_bitmapb_style_names[] = {
194 /* 0 */ "auto-draw",
195 /* 1 */ "left",
196 /* 2 */ "top",
197 /* 3 */ "right",
198 /* 4 */ "bottom",
199 NULL
200 };
201
202
203
204 /** Style property names for gauge.
205 */
206 static char const * const dkct_gui_gauge_style_names[] = {
207 /* 0 */ "smooth",
208 NULL
209 };
210
211
212
213 /** Style property names for menu item.
214 */
215 static char const * const dkct_gui_menu_item_style_names[] = {
216 /* 0 */ "normal",
217 /* 1 */ "separator",
218 /* 2 */ "check",
219 /* 3 */ "radio",
220 NULL
221 };
222
223
224
225 /** Style property names for toolbar.
226 */
227 static char const * const dkct_gui_toolbar_style_names[] = {
228 /* 0 */ "flat",
229 /* 1 */ "dockable",
230 /* 2 */ "text",
231 /* 3 */ "no-icons",
232 /* 4 */ "no-divider",
233 /* 5 */ "horizontal-layout",
234 /* 6 */ "no-tooltips",
235 /* 7 */ "bottom",
236 /* 8 */ "right",
237 NULL
238 };
239
240
241
242 /** Style names for wxGrid object.
243 */
244 static char const * const dkct_gui_grid_style_names[] = {
245 /* 0 */ "autosize-data",
246 /* 1 */ "autosize-labels-rows",
247 /* 2 */ "autosize-labels-columns",
248 /* 3 */ "autosize-labels",
249 NULL
250 };
251
252
253
254 /** Style property names for button.
255 */
256 static char const * const dkct_gui_notebook_button_names[] = {
257 /* 0 */ "left",
258 /* 1 */ "top",
259 /* 2 */ "right",
260 /* 3 */ "bottom",
261 /* 4 */ "fit",
262 /* 5 */ "no-border",
263 NULL
264 };
265
266
267
268 /** Names for alignment.
269 */
270 static char const * const dkct_gui_align_names[] = {
271 /* 0 */ "left",
272 /* 1 */ "right",
273 /* 2 */ "top",
274 /* 3 */ "bottom",
275 /* 4 */ "centered",
276 /* 5 */ "centered-x",
277 /* 6 */ "centered-y",
278 NULL
279 };
280
281
282
283 /** Names for border positions.
284 */
285 static char const * const dkct_gui_border_position_names[] = {
286 /* 0 */ "all",
287 /* 1 */ "top",
288 /* 2 */ "left",
289 /* 3 */ "right",
290 /* 4 */ "bottom",
291 NULL
292 };
293
294
295
296 /** Names of pseudo objects.
297 */
298 static char const * const dkct_gui_pseudo_object_names[] = {
299 /* 0 */ "$stretch", /* Stretch spacer. */
300 /* 1 */ "$space", /* Spacer. */
301 /* 2 */ "$separator", /* Separator in menus. */
302 NULL
303 };
304
305
306
307 /** Base type names for the root object.
308 */
309 static char const * const dkct_gui_base_type_names[] = {
310 "frame",
311 "dialog",
312 NULL
313 };
314
315
316
317 /** Attribute names.
318 */
319 static char const * const dkct_gui_attribute_keys[] = {
320 /* 0 */ "expand",
321 /* 1 */ "type",
322 /* 2 */ "menu-bar",
323 /* 3 */ "tool-bar",
324 /* 4 */ "status-bar",
325 /* 5 */ "contents",
326 /* 6 */ "text",
327 /* 7 */ "id",
328 /* 8 */ "tip",
329 /* 9 */ "proportion",
330 /* 10 */ "status-text",
331 /* 11 */ "border",
332 /* 12 */ "constructor",
333 /* 13 */ "grid", /* Grid for wxFlexGridSizer/wxGridSizer. */
334 /* 14 */ "sash", /* Sash value for splitter window. */
335 /* 15 */ "minimum-pane-size", /* Minimum pane size for splitter window. */
336 /* 16 */ "bitmap", /* Bitmap expression for bitmap button. */
337 /* 17 */ "choices", /* Choices expression. */
338 /* 18 */ "states", /* Number of states + current state for checkbox. */
339 /* 19 */ "size", /* Element default size. */
340 /* 20 */ "selection", /* Selection style for list box. */
341 /* 21 */ "rows", /* Max number of rows for radio box. */
342 /* 22 */ "columns", /* Max number of columns for radio box. */
343 /* 23 */ "grow", /* Alias for expand. */
344 /* 24 */ "start-group", /* Start radio button group. */
345 /* 25 */ "direction", /* Spin/slider/scrollbar control direction. */
346 /* 26 */ "range", /* Spin/slider min and max value. */
347 /* 27 */ "wrap", /* Flag: Wrap spin control. */
348 /* 28 */ "keys", /* Flag: Use keys. */
349 /* 29 */ "validator", /* Set validator object. */
350 /* 30 */ "value", /* Spin/slider value. */
351 /* 31 */ "slider-style", /* Style for sliders. */
352 /* 32 */ "notebook-style", /* Style for notebooks. */
353 /* 33 */ "text-style", /* Style for text controls. */
354 /* 34 */ "button-style", /* Style for buttons. */
355 /* 35 */ "splitter-window-style", /* Style for splitter window. */
356 /* 36 */ "bitmap-button-style", /* Style for bitmap button. */
357 /* 37 */ "bitmap-disabled", /* Bitmap in disabled state. */
358 /* 38 */ "bitmap-selected", /* Bitmap in selected state. */
359 /* 39 */ "bitmap-focus", /* Bitmap when focused. */
360 /* 40 */ "bitmap-hover", /* Bitmap when mouse-over. */
361 /* 41 */ "gauge-style", /* Gauge style. */
362 /* 42 */ "menu-item-style", /* Menu item style. */
363 /* 43 */ "toolbar-style", /* Toolbar style. */
364 /* 44 */ "toolbar-button-style", /* Toolbar button style. */
365 /* 45 */ "icon", /* Icon for window. */
366 /* 46 */ "column-head", /* Column head for wxGrid. */
367 /* 47 */ "row-head", /* Row head for wxGrid. */
368 /* 48 */ "table", /* Table for wxGrid. */
369 /* 49 */ "minimum-size", /* Minimum size. */
370 /* 50 */ "growable-row", /* Growable row in wxGridBagSizer. */
371 /* 51 */ "growable-column", /* Growable column. */
372 /* 52 */ "complete-constructor-specified", /* Have complete constructor. */
373 /* 53 */ "cell-data", /* Data for a wxGrid cell */
374 /* 54 */ "grid-style", /* Style for grid */
375 /* 55 */ "tooltip-flag", /* Tool tip flag */
376 NULL
377 };
378
379
380
381 /** Keywords used to produce output file.
382 */
383 char const * const dkct_gui_out_kw[] = {
384 /* 0 */ "\n",
385 /* 1 */ " ",
386 /* 2 */ " ",
387 /* 3 */ "*",
388 /* 4 */ ";",
389 /* 5 */ " /**\tGUI element ",
390 /* 6 */ ".\n */\n",
391 /* 7 */ " /**\tFlag: GUI ok.\n */\n bool dkctGUILayoutOK;\n\n",
392 /* 8 */ " ",
393 /* 9 */ "dkctGUILayoutOK = false;\n",
394 /* 10 */ "dkctGUILayoutOK = true;\n",
395 /* 11 */ "dkctGUILayoutFinished",
396 /* 12 */ ":",
397 /* 13 */ "goto",
398 /* 14 */ " = NULL;\n",
399 /* 15 */ ".",
400 /* 16 */ "%d",
401 /* 17 */
402 " /**\tContents panel.\n */\n wxPanel *dkctGUIContentsPanel;\n\n",
403 /* 18 */ "dkctGUIContentsPanel = NULL;\n",
404 /* 19 */ "#if wxUSE_MENUS\n",
405 /* 20 */ "#if wxUSE_TOOLBAR\n",
406 /* 21 */ "#if wxUSE_STATUSBAR\n",
407 /* 22 */ "#endif\n",
408 /* 23 */ " = new ",
409 /* 24 */ ");",
410 /* 25 */ " if(!(",
411 /* 26 */ ")) {\n",
412 /* 27 */ " goto dkctGUILayoutFinished;\n",
413 /* 28 */ " }\n",
414 /* 29 */ "(\n",
415 /* 30 */ "dkctGUIContentsPanel",
416 /* 31 */ "->",
417 /* 32 */ "SetSizer(",
418 /* 33 */ "dkctGUIContentsPanel = new wxPanel(this);\n",
419 /* 34 */ "wxHORIZONTAL",
420 /* 35 */ "wxVERTICAL",
421 /* 36 */ "Add(\n",
422 /* 37 */ " );\n",
423 /* 38 */ ",\n",
424 /* 39 */ "wxALL",
425 /* 40 */ "wxTOP",
426 /* 41 */ "wxLEFT",
427 /* 42 */ "wxRIGHT",
428 /* 43 */ "wxBOTTOM",
429 /* 44 */ "|",
430 /* 45 */ "wxALIGN_LEFT",
431 /* 46 */ "wxALIGN_CENTER_HORIZONTAL",
432 /* 47 */ "wxALIGN_RIGHT",
433 /* 48 */ "wxALIGN_TOP",
434 /* 49 */ "wxALIGN_CENTER_VERTICAL",
435 /* 50 */ "wxALIGN_BOTTOM",
436 /* 51 */ "wxGROW",
437 /* 52 */ "0",
438 /* 53 */ "wxGBPosition(",
439 /* 54 */ "wxGBSpan(",
440 /* 55 */ ", ",
441 /* 56 */ ")",
442 /* 57 */ "SetMenuBar(",
443 /* 58 */ "SetToolBar(",
444 /* 59 */ " if(dkctGUILayoutOK) {\n",
445 /* 60 */ "->SetSizeHints(this);\n",
446 /* 61 */ "", /* UNUSED */
447 /* 62 */ " SetClientSize(dkctGUIMinSize);\n",
448 /* 63 */ "->Fit(this);\n",
449 /* 64 */ " }\n",
450 /* 65 */ "this",
451 /* 66 */ "wxID_ANY",
452 /* 67 */ " if((",
453 /* 68 */ ") && (",
454 /* 69 */ ")) {\n",
455 /* 70 */ "SplitVertically(",
456 /* 71 */ "SplitHorizontally(",
457 /* 72 */ "->SetMinimumPaneSize(",
458 /* 73 */ "wxEmptyString",
459 /* 74 */ "wxDefaultPosition",
460 /* 75 */ "wxDefaultSize",
461 /* 76 */ "wxCHK_3STATE",
462 /* 77 */ "->SetValue(true);\n",
463 /* 78 */ "->Set3StateValue(wxCHK_UNDETERMINED);\n",
464 /* 79 */ "->Set3StateValue(wxCHK_CHECKED);\n",
465 /* 80 */ "->Realize();\n",
466 /* 81 */ "wxSize(",
467 /* 82 */ "wxLB_SINGLE",
468 /* 83 */ "wxLB_MULTIPLE",
469 /* 84 */ "wxLB_EXTENDED",
470 /* 85 */ "|wxLB_HSCROLL|wxLB_NEEDED_SB",
471 /* 86 */ "wxRA_SPECIFY_ROWS",
472 /* 87 */ "wxRA_SPECIFY_COLS",
473 /* 88 */ "wxRB_GROUP",
474 /* 89 */ " wxSize const dkctGUIMinSize(",
475 /* 90 */ " CreateStatusBar(",
476 /* 91 */ " SetStatusText(",
477 /* 92 */ "wxSP_HORIZONTAL",
478 /* 93 */ "wxSP_VERTICAL",
479 /* 94 */ "|wxSP_ARROW_KEYS",
480 /* 95 */ "|wxSP_WRAP",
481 /* 96 */ "wxSP_ARROW_KEYS|wxSP_WRAP",
482 /* 97 */ "wxSP_ARROW_KEYS",
483 /* 98 */ "wxSP_WRAP",
484 /* 99 */ "",
485 /* 100 */ "NULL",
486 /* 101 */ "wxSB_HORIZONTAL",
487 /* 102 */ "wxSB_VERTICAL",
488 /* 103 */ "wxSL_HORIZONTAL",
489 /* 104 */ "wxSL_VERTICAL",
490 /* 105 */ "wxSL_AUTOTICKS",
491 /* 106 */ "wxSL_LABELS",
492 /* 107 */ "wxSL_LEFT",
493 /* 108 */ "wxSL_RIGHT",
494 /* 109 */ "wxSL_TOP",
495 /* 110 */ "wxSL_BOTTOM",
496 /* 111 */ "wxSL_SELRANGE",
497 /* 112 */ "wxSL_INVERSE",
498 /* 113 */ "wxNB_TOP",
499 /* 114 */ "wxNB_LEFT",
500 /* 115 */ "wxNB_RIGHT",
501 /* 116 */ "wxNB_BOTTOM",
502 /* 117 */ "wxNB_FIXEDWIDTH",
503 /* 118 */ "wxNB_MULTILINE",
504 /* 119 */ "wxNB_NOPAGETHEME",
505 /* 120 */ "wxNB_FLAT",
506 /* 121 */ "wxTE_PROCESS_ENTER",
507 /* 122 */ "wxTE_PROCESS_TAB",
508 /* 123 */ "wxTE_MULTILINE",
509 /* 124 */ "wxTE_PASSWORD",
510 /* 125 */ "wxTE_READONLY",
511 /* 126 */ "wxTE_RICH",
512 /* 127 */ "wxTE_RICH2",
513 /* 128 */ "wxTE_AUTO_URL",
514 /* 129 */ "wxTE_NOHIDESEL",
515 /* 130 */ "wxTE_LEFT",
516 /* 131 */ "wxTE_CENTRE",
517 /* 132 */ "wxTE_RIGHT",
518 /* 133 */ "wxTE_DONTWRAP",
519 /* 134 */ "wxTE_CHARWRAP",
520 /* 135 */ "wxTE_WORDWRAP",
521 /* 136 */ "wxTE_BESTWRAP",
522 /* 137 */ "wxTE_CAPITALIZE",
523 /* 138 */ "wxHSCROLL",
524 /* 139 */ "wxVSCROLL",
525 /* 140 */ "wxHSCROLL|wxVSCROLL",
526 /* 141 */ "wxBU_LEFT",
527 /* 142 */ "wxBU_TOP",
528 /* 143 */ "wxBU_RIGHT",
529 /* 144 */ "wxBU_BOTTOM",
530 /* 145 */ "wxBU_EXACTFIT",
531 /* 146 */ "wxNO_BORDER",
532 /* 147 */ "wxSP_3D",
533 /* 148 */ "wxSP_3DSASH",
534 /* 149 */ "wxSP_3DBORDER",
535 /* 150 */ "wxSP_BORDER",
536 /* 151 */ "wxSP_NOBORDER",
537 /* 152 */ "wxSP_NO_XP_THEME",
538 /* 153 */ "wxSP_PERMIT_UNSPLIT",
539 /* 154 */ "wxSP_LIVE_UPDATE",
540 /* 155 */ "wxBU_AUTODRAW",
541 /* 156 */ "->SetBitmapDisabled(",
542 /* 157 */ "->SetBitmapSelected(",
543 /* 158 */ "->SetBitmapFocus(",
544 /* 159 */ "->SetBitmapHover(",
545 /* 160 */ "wxGA_HORIZONTAL",
546 /* 161 */ "wxGA_VERTICAL",
547 /* 162 */ "|wxGA_SMOOTH",
548 /* 163 */ "wxALIGN_CENTRE",
549 /* 164 */ "wxST_NO_AUTORESIZE",
550 /* 165 */ "wxLI_HORIZONTAL",
551 /* 166 */ "wxLI_VERTICAL",
552 /* 167 */ "wxITEM_NORMAL",
553 /* 168 */ "wxITEM_SEPARATOR",
554 /* 169 */ "wxITEM_CHECK",
555 /* 170 */ "wxITEM_RADIO",
556 /* 171 */ "wxID_SEPARATOR",
557 /* 172 */ "wxTB_HORIZONTAL",
558 /* 173 */ "wxTB_VERTICAL",
559 /* 174 */ "|wxTB_FLAT",
560 /* 175 */ "|wxTB_DOCKABLE",
561 /* 176 */ "|wxTB_TEXT",
562 /* 177 */ "|wxTB_NOICONS",
563 /* 178 */ "|wxTB_NODIVIDER",
564 /* 179 */ "|wxTB_NOALIGN",
565 /* 180 */ "|wxTB_HORZ_LAYOUT",
566 /* 181 */ "|wxTB_NO_TOOTIPS",
567 /* 182 */ "|wxTB_BOTTOM",
568 /* 183 */ "|wxTB_RIGHT",
569 /* 184 */ "->Append(",
570 /* 185 */ "->AddTool(\n",
571 /* 186 */ "wxNullBitmap",
572 /* 187 */ "->AddControl(",
573 /* 188 */ "AppendSeparator();\n",
574 /* 189 */ "AddSeparator();\n",
575 /* 190 */ "SetToolTip(",
576 /* 191 */ "->AppendCheckItem(",
577 /* 192 */ "->AppendRadioItem(",
578 /* 193 */ "->AppendSeparator(",
579 /* 194 */ " = ",
580 /* 195 */ "SetIcon(",
581 /* 196 */ "Add(",
582 /* 197 */ "<none>",
583 /* 198 */ "->SetTable(",
584 /* 199 */ "true",
585 /* 200 */ "->CreateGrid(",
586 /* 201 */ "->SetColLabelValue(",
587 /* 202 */ "->SetRowLabelValue(",
588 /* 203 */ "->EnableEditing(false);",
589 /* 204 */ "->SetMinSize(wxSize(",
590 /* 205 */ "));",
591 /* 206 */ "->AddGrowableCol(",
592 /* 207 */ "->AddGrowableRow(",
593 /* 208 */ "AddButton(\n",
594 /* 209 */ ",",
595 /* 210 */ "SetLabel(",
596 /* 211 */ "SetValidator(",
597 /* 212 */ "SetSize(",
598 /* 213 */ "SetMinSize(",
599 /* 214 */ "->SetCellValue(",
600 /* 215 */ "->AutoSize(",
601 /* 216 */ "->SetRowLabelSize(wxGRID_AUTOSIZE",
602 /* 217 */ "->SetColLabelSize(wxGRID_AUTOSIZE",
603 /* 218 */ "if(",
604 /* 219 */ ") { ",
605 /* 220 */ "->AddPage(",
606 /* 221 */ "wxCHB_TOP",
607 /* 222 */ "wxLB_TOP",
608 /* 223 */ "wxCHB_LEFT",
609 /* 224 */ "wxLB_LEFT",
610 /* 225 */ "wxCHB_RIGHT",
611 /* 226 */ "wxLB_RIGHT",
612 /* 227 */ "wxCHB_BOTTOM",
613 /* 228 */ "wxLB_BOTTOM",
614 NULL
615 };
616
617
618
619 /** Names for directions.
620 */
621 static char const * const dkct_gui_direction_names[] = {
622 /* 0 */ "horizontal",
623 /* 1 */ "vertical",
624 /* 2 */ "both",
625 NULL
626 };
627
628
629
630 /** IDs for stock buttons and menu items.
631 */
632 static char const * const dkct_gui_stock_item_names[] = {
633 /* 0 */
634 "wxID_ABOUT",
635
636 /* 1 */
637 "wxID_ADD",
638
639 /* 2 */
640 "wxID_APPLY",
641
642 /* 3 */
643 "wxID_BACKWARD",
644
645 /* 4 */
646 "wxID_BOLD",
647
648 /* 5 */
649 "wxID_BOTTOM",
650
651 /* 6 */
652 "wxID_CANCEL",
653
654 /* 7 */
655 "wxID_CDROM",
656
657 /* 8 */
658 "wxID_CLEAR",
659
660 /* 9 */
661 "wxID_CLOSE",
662
663 /* 10 */
664 "wxID_CONVERT",
665
666 /* 11 */
667 "wxID_COPY",
668
669 /* 12 */
670 "wxID_CUT",
671
672 /* 13 */
673 "wxID_DELETE",
674
675 /* 14 */
676 "wxID_DOWN",
677
678 /* 15 */
679 "wxID_EDIT",
680
681 /* 16 */
682 "wxID_EXECUTE",
683
684 /* 17 */
685 "wxID_EXIT",
686
687 /* 18 */
688 "wxID_FILE",
689
690 /* 19 */
691 "wxID_FIND",
692
693 /* 20 */
694 "wxID_FIRST",
695
696 /* 21 */
697 "wxID_FLOPPY",
698
699 /* 22 */
700 "wxID_FORWARD",
701
702 /* 23 */
703 "wxID_HARDDISK",
704
705 /* 24 */
706 "wxID_HELP",
707
708 /* 25 */
709 "wxID_HOME",
710
711 /* 26 */
712 "wxID_INDENT",
713
714 /* 27 */
715 "wxID_INDEX",
716
717 /* 28 */
718 "wxID_INFO",
719
720 /* 29 */
721 "wxID_ITALIC",
722
723 /* 30 */
724 "wxID_JUMP_TO \t",
725
726 /* 31 */
727 "wxID_JUSTIFY_CENTER \t",
728
729 /* 32 */
730 "wxID_JUSTIFY_FILL",
731
732 /* 33 */
733 "wxID_JUSTIFY_LEFT \t",
734
735 /* 34 */
736 "wxID_JUSTIFY_RIGHT",
737
738 /* 35 */
739 "wxID_LAST",
740
741 /* 36 */
742 "wxID_NETWORK \t",
743
744 /* 37 */
745 "wxID_NEW",
746
747 /* 38 */
748 "wxID_NO",
749
750 /* 39 */
751 "wxID_OK",
752
753 /* 40 */
754 "wxID_OPEN",
755
756 /* 41 */
757 "wxID_PASTE",
758
759 /* 42 */
760 "wxID_PREFERENCES",
761
762 /* 43 */
763 "wxID_PREVIEW",
764
765 /* 44 */
766 "wxID_PRINT",
767
768 /* 45 */
769 "wxID_PROPERTIES",
770
771 /* 46 */
772 "wxID_REDO",
773
774 /* 47 */
775 "wxID_REFRESH",
776
777 /* 48 */
778 "wxID_REMOVE",
779
780 /* 49 */
781 "wxID_REPLACE",
782
783 /* 50 */
784 "wxID_REVERT_TO_SAVED",
785
786 /* 51 */
787 "wxID_SAVE",
788
789 /* 52 */
790 "wxID_SAVEAS",
791
792 /* 53 */
793 "wxID_SELECTALL",
794
795 /* 54 */
796 "wxID_SELECT_COLOR",
797
798 /* 55 */
799 "wxID_SELECT_FONT",
800
801 /* 56 */
802 "wxID_SORT_ASCENDING \t",
803
804 /* 57 */
805 "wxID_SORT_DESCENDING",
806
807 /* 58 */
808 "wxID_SPELL_CHECK",
809
810 /* 59 */
811 "wxID_STOP",
812
813 /* 60 */
814 "wxID_STRIKETHROUGH",
815
816 /* 61 */
817 "wxID_TOP",
818
819 /* 62 */
820 "wxID_UNDELETE",
821
822 /* 63 */
823 "wxID_UNDERLINE",
824
825 /* 64 */
826 "wxID_UNDO",
827
828 /* 65 */
829 "wxID_UNINDENT",
830
831 /* 66 */
832 "wxID_UP",
833
834 /* 67 */
835 "wxID_YES",
836
837 /* 68 */
838 "wxID_ZOOM_100",
839
840 /* 69 */
841 "wxID_ZOOM_FIT",
842
843 /* 70 */
844 "wxID_ZOOM_IN",
845
846 /* 71 */
847 "wxID_ZOOM_OUT",
848
849 NULL
850
851 };
852
853
854
855 /** Delete grid header data.
856 @param gh Header data to delete.
857 */
858 static
859 void
dkct_grid_head_delete(DKCT_GRID_HEAD * gh)860 dkct_grid_head_delete(DKCT_GRID_HEAD *gh)
861 {
862 if(gh) {
863 dk3_release(gh->text);
864 gh->elno = 0;
865 dk3_delete(gh);
866 }
867 }
868
869
870 static
871 void
dkct_grid_cell_delete(DKCT_CELL_DATA * cd)872 dkct_grid_cell_delete(DKCT_CELL_DATA *cd)
873 {
874 if (cd) {
875 dk3_release(cd->text);
876 cd->row = cd->col = 0;
877 dk3_delete(cd);
878 }
879 }
880
881
882 /** Create new grid header data.
883 @param txt Text for row or column label.
884 @param no Index number of grid row or column.
885 @param psrc Source structure.
886 */
887 static
888 DKCT_GRID_HEAD *
dkct_grid_head_new(char const * txt,int no,DKCT_SRC * psrc)889 dkct_grid_head_new(char const *txt, int no, DKCT_SRC *psrc)
890 {
891 DKCT_GRID_HEAD *back = NULL;
892 if(txt) {
893 back = dk3_new_app(DKCT_GRID_HEAD,1,psrc->app);
894 if(back) {
895 back->elno = no;
896 back->text = dk3str_c8_dup_app(txt, psrc->app);
897 if(!(back->text)) {
898 dkct_grid_head_delete(back);
899 back = NULL;
900 }
901 }
902 }
903 return back;
904 }
905
906
907
908 static
909 DKCT_CELL_DATA *
dkct_grid_cell_new(char const * txt,int r,int c,DKCT_SRC * psrc)910 dkct_grid_cell_new(char const *txt, int r, int c, DKCT_SRC *psrc)
911 {
912 DKCT_CELL_DATA *back = NULL;
913 if (txt) {
914 back = dk3_new_app(DKCT_CELL_DATA,1,psrc->app);
915 if (back) {
916 back->row = r; back->col = c;
917 back->text = dk3str_c8_dup_app(txt, psrc->app);
918 if (!(back->text)) {
919 dkct_grid_cell_delete(back);
920 back = NULL;
921 }
922 }
923 }
924 return back;
925 }
926
927
928
929 static
930 int
dkct_grid_cell_compare(const void * l,const void * r,int DK3_ARG_UNUSED (cr))931 dkct_grid_cell_compare(const void *l, const void *r, int DK3_ARG_UNUSED(cr) )
932 {
933 DKCT_CELL_DATA *pl;
934 DKCT_CELL_DATA *pr;
935 int back = 0;
936
937 DK3_UNUSED_ARG(cr)
938 if (l) {
939 if (r) {
940 pl = (DKCT_CELL_DATA *)l;
941 pr = (DKCT_CELL_DATA *)r;
942 if (pl->row < pr->row) {
943 back = -1;
944 } else {
945 if (pl->row > pr->row) {
946 back = 1;
947 } else {
948 if (pl->col < pr->col) {
949 back = -1;
950 } else {
951 if (pl->col > pr->col) {
952 back = 1;
953 }
954 }
955 }
956 }
957 } else back = 1;
958 } else {
959 if (r) back = -1;
960 }
961 return back;
962 }
963
964
965 /** Compare two row/column heads.
966 @param l Left object.
967 @param r Right object.
968 @param cr Comparison criteria (ignored).
969 @return Comparison result.
970 */
971 static
972 int
dkct_grid_head_compare(void const * l,void const * r,int DK3_ARG_UNUSED (cr))973 dkct_grid_head_compare(void const *l, void const *r, int DK3_ARG_UNUSED(cr) )
974 {
975 int back = 0;
976 DKCT_GRID_HEAD const *pl;
977 DKCT_GRID_HEAD const *pr;
978
979 DK3_UNUSED_ARG(cr)
980 if(l) {
981 if(r) {
982 pl = (DKCT_GRID_HEAD const *)l; pr = (DKCT_GRID_HEAD const *)r;
983 if(pl->elno > pr->elno) {
984 back = 1;
985 } else {
986 if(pl->elno < pr->elno) {
987 back = -1;
988 }
989 }
990 } else back = 1;
991 } else {
992 if(r) back = -1;
993 }
994 return back;
995 }
996
997
998
999 /** Compare two GUI elements.
1000 @param l Left element.
1001 @param r Right element.
1002 @param cr Comparison criteria (0=elem/elem by name, 1=elem/name,
1003 2=elem/elem by number, 3=elem/number).
1004 @return Comparison result.
1005 */
1006 static
1007 int
dkct_gui_element_compare(void const * l,void const * r,int cr)1008 dkct_gui_element_compare(void const *l, void const *r, int cr)
1009 {
1010 int back = 0; /* Result. */
1011 DKCT_GUI_ELEMENT const *pl; /* Left object pointer. */
1012 DKCT_GUI_ELEMENT const *pr; /* Right object pointer. */
1013 size_t const *pn; /* Right number. */
1014 if(l) {
1015 if(r) {
1016 pl = (DKCT_GUI_ELEMENT const *)l;
1017 pr = (DKCT_GUI_ELEMENT const *)r;
1018 pn = (size_t const *)r;
1019 switch(cr) {
1020 case 3: {
1021 if(pl->number > *pn) {
1022 back = 1;
1023 } else {
1024 if(pl->number < *pn) {
1025 back = -1;
1026 }
1027 }
1028 } break;
1029 case 2: {
1030 if(pl->number > pr->number) {
1031 back = 1;
1032 } else {
1033 if(pl->number < pr->number) {
1034 back = -1;
1035 }
1036 }
1037 } break;
1038 case 1: {
1039 if(pl->name) {
1040 back = dk3str_c8_cmp(pl->name, (char const *)r);
1041 } else { back = -1; }
1042 } break;
1043 default: {
1044 if(pl->name) {
1045 if(pr->name) {
1046 back = dk3str_c8_cmp(pl->name, pr->name);
1047 } else { back = 1; }
1048 } else {
1049 if(pr->name) { back = -1; }
1050 }
1051 } break;
1052 }
1053 } else { back = 1; }
1054 } else {
1055 if(r) { back = -1; }
1056 }
1057 if(back < -1) { back = -1; }
1058 if(back > 1) { back = 1; }
1059 return back;
1060 }
1061
1062
1063
1064 /** Remove all grid heads (row or column heads) from storage
1065 and close storage.
1066 @param sHeads Storage containing the heads.
1067 @param iHeads Iterator through storage.
1068 */
1069 static
1070 void
dkct_remove_grid_heads(dk3_sto_t * sHeads,dk3_sto_it_t * iHeads)1071 dkct_remove_grid_heads(dk3_sto_t *sHeads, dk3_sto_it_t *iHeads)
1072 {
1073 DKCT_GRID_HEAD *gh;
1074
1075 if(sHeads) {
1076 if(iHeads) {
1077 dk3sto_it_reset(iHeads);
1078 while(NULL != (gh = (DKCT_GRID_HEAD *)dk3sto_it_next(iHeads))) {
1079 dkct_grid_head_delete(gh);
1080 }
1081 dk3sto_it_close(iHeads);
1082 }
1083 dk3sto_close(sHeads);
1084 }
1085 }
1086
1087
1088
1089 static
1090 void
dkct_remove_grid_cell_data(dk3_sto_t * scd,dk3_sto_it_t * icd)1091 dkct_remove_grid_cell_data(dk3_sto_t *scd, dk3_sto_it_t *icd)
1092 {
1093 DKCT_CELL_DATA *cd;
1094 if (scd) {
1095 if (icd) {
1096 dk3sto_it_reset(icd);
1097 while (NULL != (cd = (DKCT_CELL_DATA *)dk3sto_it_next(icd))) {
1098 dkct_grid_cell_delete(cd);
1099 }
1100 dk3sto_it_close(icd);
1101 }
1102 dk3sto_close(scd);
1103 }
1104 }
1105
1106
1107
1108
1109 /** Remove growable row or column information.
1110 @param st Storage containing growable row or column data.
1111 @param it Iterator through storage.
1112 */
1113 static
1114 void
dkct_remove_grow_row_col(dk3_sto_t * st,dk3_sto_it_t * it)1115 dkct_remove_grow_row_col(dk3_sto_t *st, dk3_sto_it_t *it)
1116 {
1117 void *ip;
1118 if(st) {
1119 if(it) {
1120 dk3sto_it_reset(it);
1121 while(NULL != (ip = dk3sto_it_next(it))) {
1122 dk3_delete(ip);
1123 }
1124 dk3sto_it_close(it);
1125 }
1126 dk3sto_close(st);
1127 }
1128 }
1129
1130
1131 /** Destroy GUI element, release memory.
1132 @param elp Element to destroy.
1133 */
1134 static
1135 void
dkct_gui_elem_delete(DKCT_GUI_ELEMENT * elp)1136 dkct_gui_elem_delete(DKCT_GUI_ELEMENT *elp)
1137 {
1138
1139 if(elp) {
1140 dkct_remove_grid_cell_data(elp->sCellData, elp->iCellData);
1141 elp->sCellData = NULL; elp->iCellData = NULL;
1142 dkct_remove_grid_heads(elp->sRowHeads, elp->iRowHeads);
1143 dkct_remove_grid_heads(elp->sColumnHeads, elp->iColumnHeads);
1144 elp->sRowHeads = NULL; elp->iRowHeads = NULL;
1145 elp->sColumnHeads = NULL; elp->iColumnHeads = NULL;
1146 dkct_remove_grow_row_col(elp->sGrowRow, elp->iGrowRow);
1147 dkct_remove_grow_row_col(elp->sGrowCol, elp->iGrowCol);
1148 elp->sGrowRow = NULL; elp->iGrowRow = NULL;
1149 elp->sGrowCol = NULL; elp->iGrowCol = NULL;
1150 if(elp->s_contents) {
1151 if(elp->i_contents) {
1152 dk3sto_it_close(elp->i_contents);
1153 }
1154 dk3sto_close(elp->s_contents);
1155 } elp->s_contents = NULL; elp->i_contents = NULL;
1156 dk3_release(elp->ttflag);
1157 dk3_release(elp->gridTable);
1158 dk3_release(elp->validator);
1159 dk3_release(elp->choices);
1160 dk3_release(elp->stbText);
1161 dk3_release(elp->bitmapHover);
1162 dk3_release(elp->bitmapFocus);
1163 dk3_release(elp->bitmapSelected);
1164 dk3_release(elp->bitmapDisabled);
1165 dk3_release(elp->bitmapVarName);
1166 dk3_release(elp->icon);
1167 dk3_release(elp->tipText);
1168 dk3_release(elp->name);
1169 dk3_release(elp->cname);
1170 dk3_release(elp->constructor);
1171 dk3_release(elp->text);
1172 dk3_release(elp->idname);
1173 elp->parent = NULL;
1174
1175 elp->number = 0;
1176
1177 elp->lndef = 0UL;
1178
1179 elp->lndecl = 0UL;
1180 elp->cln = 0;
1181 elp->align = 0x00;
1182 dk3_delete(elp);
1183 }
1184 }
1185
1186
1187
1188 /** Create GUI element, allocate memory.
1189 @param parent Parent GUI element.
1190 @param name New GUI elements name.
1191 @param number Number of new element.
1192 @param psrc Source structure, used for diagnostics.
1193 @param gui GUI description.
1194 @return Pointer to new element on success, NULL on error.
1195 */
1196 static
1197 DKCT_GUI_ELEMENT *
dkct_gui_elem_new(DKCT_GUI_ELEMENT * parent,char const * name,size_t number,DKCT_SRC * psrc,DKCT_GUI * gui)1198 dkct_gui_elem_new(
1199 DKCT_GUI_ELEMENT *parent,
1200 char const *name,
1201 size_t number,
1202 DKCT_SRC *psrc,
1203 DKCT_GUI *gui
1204
1205 )
1206 {
1207 DKCT_GUI_ELEMENT *back = NULL;
1208 int ok = 0; /* Flag: OK so far. */
1209
1210 back = dk3_new_app(DKCT_GUI_ELEMENT,1,psrc->app);
1211 if(back) {
1212 /*
1213 Initialize empty object.
1214 */
1215 back->name = NULL;
1216 back->cname = NULL;
1217 back->idname = NULL;
1218 back->text = NULL;
1219 back->constructor = NULL;
1220 back->tipText = NULL;
1221 back->icon = NULL;
1222 back->bitmapVarName = NULL;
1223 back->bitmapDisabled = NULL;
1224 back->bitmapSelected = NULL;
1225 back->bitmapFocus = NULL;
1226 back->bitmapHover = NULL;
1227 back->stbText = NULL;
1228 back->choices = NULL;
1229 back->validator = NULL;
1230 back->gridTable = NULL;
1231 back->ttflag = NULL;
1232 back->parent = NULL;
1233 back->number = 0;
1234 back->align = 0x00;
1235 if(gui) { back->align = gui->align; }
1236 back->cln = -1;
1237 back->menubar = NULL;
1238 back->toolbar = NULL;
1239 back->passno = 0;
1240 back->posx = 0;
1241 back->posy = 0;
1242 back->spanx = 0;
1243 back->spany = 0;
1244 back->gridcolumns = 1;
1245 back->gridrows = 1;
1246 back->gridgapx = -1;
1247 back->gridgapy = -1;
1248 back->sash = 0;
1249 back->minPaneSize = 0;
1250 back->nChoices = 0;
1251 back->maxRowsCols = 1;
1252 back->rbDirection = DKCT_GUI_RB_DIR_COLUMNS;
1253 back->startGroup = 0x00;
1254 back->curx = 0;
1255 back->cury = 0;
1256 back->sizex = 0;
1257 back->sizey = 0;
1258 back->sizemx = 0;
1259 back->sizemy = 0;
1260 back->stbsz = 0;
1261 back->s_contents = NULL;
1262 back->i_contents = NULL;
1263 back->sRowHeads = NULL;
1264 back->iRowHeads = NULL;
1265 back->sColumnHeads = NULL;
1266 back->iColumnHeads = NULL;
1267 back->sCellData = NULL;
1268 back->iCellData = NULL;
1269 back->sGrowRow = NULL;
1270 back->iGrowRow = NULL;
1271 back->sGrowCol = NULL;
1272 back->iGrowCol = NULL;
1273 back->pseudoobj = 0;
1274 back->lndef = 0UL;
1275 back->lndecl = 0UL;
1276 if(psrc) { back->lndecl = psrc->lineno; }
1277 back->border = -1;
1278 back->borderPos = 0x00;
1279 back->expandFlag = 0x00;
1280 back->nStates = 0x02;
1281 back->state = 0x00;
1282 back->selStyle = DKCT_GUI_SELECTION_STYLE_SINGLE;
1283 back->prost = DKCT_GUI_PROCESSING_STATE_START;
1284 back->proportion = 0;
1285 back->direction = DKCT_GUI_DIRECTION_HORIZONTAL;
1286 back->spinMin = 0;
1287 back->spinMax = 100;
1288 back->spinVal = 0;
1289 back->nRows = 0;
1290 back->nColumns = 0;
1291 back->nRowHeads = 0;
1292 back->nColumnHeads = 0;
1293 back->spinWrap = 0x00;
1294 back->useKeys = 0x00;
1295 back->sliderStyle = 0x00;
1296 back->buttonStyle = 0x00;
1297 back->bitmapbStyle = DKCT_GUI_BBUTTON_AUTODRAW;
1298 back->gaugeStyle = 0x00;
1299 back->menuItemStyle = 0x00;
1300 back->tableOwner = 0x00;
1301 back->notebookStyle = 0U;
1302 back->splitterStyle = DKCT_GUI_SPLITTERW_3D;
1303 back->toolbarStyle = DKCT_GUI_TOOLBAR_FLAT;
1304 back->gridStyle = 0U;
1305 back->textStyle = 0UL;
1306 back->compConst = 0x00;
1307 /*
1308 Allocate memory.
1309 */
1310 back->s_contents = dk3sto_open_app(psrc->app);
1311 if(back->s_contents) {
1312 /* Sorting by number needed. */
1313 dk3sto_set_comp(back->s_contents, dkct_gui_element_compare, 2);
1314 back->i_contents = dk3sto_it_open(back->s_contents);
1315 if(back->i_contents) {
1316 ok = 1;
1317 }
1318 }
1319 /*
1320 Use arguments.
1321 */
1322 back->parent = parent;
1323 if(name) {
1324 back->name = dk3str_c8_dup_app(name, psrc->app);
1325 if(!(back->name)) { ok = 0; }
1326 }
1327 back->number = number;
1328 if(!(ok)) {
1329 dkct_gui_elem_delete(back); back = NULL;
1330 }
1331 }
1332 return back;
1333 }
1334
1335
1336
1337 /** Create next object in GUI description.
1338 @param gui GUI description.
1339 @param name New object name.
1340 @return Pointer to new object on success, NULL on error.
1341 */
1342 static
1343 DKCT_GUI_ELEMENT *
dkct_gui_elem_next(DKCT_GUI * gui,char const * name)1344 dkct_gui_elem_next(DKCT_GUI *gui, char const *name)
1345 {
1346 DKCT_GUI_ELEMENT *back = NULL;
1347
1348 if(name) {
1349 if(*name != '$') {
1350 back = (DKCT_GUI_ELEMENT *)dk3sto_it_find_like(
1351 gui->i_el_by_name, (void *)name, 1
1352 );
1353 }
1354 }
1355 if(back) {
1356 /* Warning: Object already declared! 95/96 */
1357 dkct_to_log_3(gui->psrc, 1, DK3_LL_WARNING, 95, 96, name);
1358 } else {
1359 back = dkct_gui_elem_new(gui->c_el, name, gui->no, gui->psrc, gui);
1360 if(back) {
1361 if(dk3sto_add(gui->s_el_by_name, (void *)back)) {
1362 gui->no += 1;
1363 if(!dk3sto_add(gui->s_el_by_num, (void *)back)) {
1364 back = NULL;
1365 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1366 }
1367 } else {
1368 dkct_gui_elem_delete(back); back = NULL;
1369 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1370 /* ERROR: Memory! */
1371 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
1372 }
1373 } else {
1374 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1375 /* ERROR: Memory! */
1376 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
1377 }
1378 }
1379 return back;
1380 }
1381
1382
1383
1384 DKCT_GUI *
dkct_gui_new(DKCT_SRC * psrc)1385 dkct_gui_new(DKCT_SRC *psrc)
1386 {
1387 DKCT_GUI *back = NULL;
1388 int ok = 0; /* FLag: Success. */
1389 DKCT_GUI_ELEMENT *el; /* New element. */
1390
1391 back = dk3_new_app(DKCT_GUI,1,psrc->app);
1392 if(back) {
1393 /*
1394 Initialize.
1395 */
1396 back->psrc = psrc;
1397 back->c_el = NULL;
1398 back->r_el = NULL;
1399 back->s_el_by_name = NULL; back->i_el_by_name = NULL;
1400 back->s_el_by_num = NULL; back->i_el_by_num = NULL;
1401 back->ttflag = NULL;
1402 back->no = 0;
1403 back->align = 0x00;
1404 /*
1405 Allocate storages.
1406 */
1407 back->s_el_by_name = dk3sto_open_app(psrc->app);
1408 if(back->s_el_by_name) {
1409 dk3sto_set_comp(back->s_el_by_name, dkct_gui_element_compare, 0);
1410 back->i_el_by_name = dk3sto_it_open(back->s_el_by_name);
1411 if(back->i_el_by_name) {
1412 back->s_el_by_num = dk3sto_open_app(psrc->app);
1413 if(back->s_el_by_num) {
1414 dk3sto_set_comp(back->s_el_by_num, dkct_gui_element_compare, 2);
1415 back->i_el_by_num = dk3sto_it_open(back->s_el_by_num);
1416 if(back->i_el_by_num) {
1417 el = dkct_gui_elem_new(NULL, NULL, 0, psrc, back);
1418 if(el) {
1419 back->no = 1;
1420 if(dk3sto_add(back->s_el_by_name, el)) {
1421 if(dk3sto_add(back->s_el_by_num, el)) {
1422 ok = 1;
1423 back->c_el = el;
1424 back->r_el = el;
1425 el->cln = 0;
1426 }
1427 } else {
1428 dkct_gui_elem_delete(el); el = NULL;
1429 }
1430 }
1431 }
1432 }
1433 }
1434 }
1435 if(!(ok)) {
1436 dkct_gui_delete(back); back = NULL;
1437 }
1438 }
1439 return back;
1440 }
1441
1442
1443
1444 void
dkct_gui_delete(DKCT_GUI * pg)1445 dkct_gui_delete(DKCT_GUI *pg)
1446 {
1447 DKCT_GUI_ELEMENT *el; /* Current element to process. */
1448
1449 if(pg) {
1450 pg->psrc = NULL;
1451 pg->c_el = NULL;
1452 pg->no = 0;
1453 if(pg->s_el_by_num) {
1454 if(pg->i_el_by_num) {
1455 dk3sto_it_close(pg->i_el_by_num);
1456 }
1457 dk3sto_close(pg->s_el_by_num);
1458 } pg->s_el_by_num = NULL; pg->i_el_by_num = NULL;
1459 if(pg->s_el_by_name) {
1460 if(pg->i_el_by_name) {
1461 dk3sto_it_reset(pg->i_el_by_name);
1462 while((el = (DKCT_GUI_ELEMENT *)dk3sto_it_next(pg->i_el_by_name))
1463 != NULL)
1464 {
1465 dkct_gui_elem_delete(el);
1466 }
1467 dk3sto_it_close(pg->i_el_by_name);
1468 }
1469 dk3sto_close(pg->s_el_by_name);
1470 } pg->s_el_by_name = NULL; pg->i_el_by_name = NULL;
1471 if (NULL != pg->ttflag) {
1472 dk3_delete(pg->ttflag);
1473 }
1474 pg->ttflag = NULL;
1475 dk3_delete(pg);
1476 }
1477 }
1478
1479
1480
1481 /** Class-depending attribute setup.
1482 @param el New object to set up.
1483 */
1484 static
1485 void
dkct_gui_initialize_object_for_class(DKCT_GUI_ELEMENT * el)1486 dkct_gui_initialize_object_for_class(DKCT_GUI_ELEMENT *el)
1487 {
1488 switch(el->cln) {
1489 case 13: case 47: {
1490 el->direction = DKCT_GUI_DIRECTION_BOTH;
1491 } break;
1492 }
1493 }
1494
1495
1496
1497 /** Start processing of a new object.
1498 @param gui GUI description.
1499 @param il Input line to process.
1500 @return 1 on success, 0 on error.
1501 */
1502 static
1503 int
dkct_gui_start_new_object_definition(DKCT_GUI * gui,char * il)1504 dkct_gui_start_new_object_definition(DKCT_GUI *gui, char *il)
1505 {
1506 int back = 0;
1507 char *p2 = NULL; /* Closing square bracket. */
1508 DKCT_GUI_ELEMENT *elp; /* Element to process. */
1509
1510 gui->c_el = NULL;
1511 p2 = dk3str_c8_rchr(il, ']');
1512 if(p2) {
1513 *p2 = '\0';
1514 p2 = dk3str_c8_next(il, NULL);
1515 if(p2) {
1516 elp = (DKCT_GUI_ELEMENT *)dk3sto_it_find_like(gui->i_el_by_name, p2, 1);
1517 if(!(elp)) {
1518 /* Warning: Undefined element ! */
1519 elp = dkct_gui_elem_new(NULL, p2, gui->no, gui->psrc, gui);
1520 if(elp) {
1521 if(dk3sto_add(gui->s_el_by_name, (void *)elp)) {
1522 gui->no += 1;
1523 if(!dk3sto_add(gui->s_el_by_num, (void *)elp)) {
1524 elp = NULL;
1525 }
1526 } else {
1527 dkct_gui_elem_delete(elp); elp = NULL;
1528 }
1529 }
1530 }
1531 if(elp) {
1532 if(elp->cname) {
1533 /* ERROR: Class name already defined! */
1534 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 45);
1535 } else {
1536 elp->lndef = (gui->psrc)->lineno;
1537 if(elp->lndecl == 0UL) { elp->lndecl = (gui->psrc)->lineno; }
1538 elp->cname = dk3str_c8_dup_app(il, (gui->psrc)->app);
1539 elp->cln = dk3str_c8_array_index(dkct_gui_class_names, il, 1);
1540 dkct_gui_initialize_object_for_class(elp);
1541 if(elp->cname) {
1542 back = 1;
1543 gui->c_el = elp;
1544 } else {
1545 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
1546 }
1547 }
1548 } else {
1549 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1550 /* ERROR: Memory! */
1551 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
1552 }
1553 } else {
1554 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1555 /* ERROR: Syntax (missing object name) */#
1556 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 58);
1557 }
1558 } else {
1559 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1560 /* ERROR: Syntax (missing ']') */
1561 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 59);
1562 }
1563
1564 return back;
1565 }
1566
1567
1568
1569 /** Set menu bar.
1570 @param gui GUI description.
1571 @param il Input line to process.
1572 @return 1 on success, 0 on error.
1573 */
1574 static
1575 int
dkct_gui_set_menu_bar(DKCT_GUI * gui,char * il)1576 dkct_gui_set_menu_bar(DKCT_GUI *gui, char *il)
1577 {
1578 int back = 0;
1579 DKCT_GUI_ELEMENT *elp; /* Element to modify. */
1580
1581 if(gui->c_el) {
1582 if(((gui->c_el)->number != 0) && (!((gui->c_el)->parent))) {
1583
1584 /* Warning: Attribute applicable to root element only! */
1585 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 55);
1586 }
1587 if(!((gui->c_el)->menubar)) {
1588 elp = (DKCT_GUI_ELEMENT *)dk3sto_it_find_like(gui->i_el_by_name, il, 1);
1589 if(!(elp)) {
1590 elp = dkct_gui_elem_next(gui, il);
1591 }
1592 if(elp) {
1593 (gui->c_el)->menubar = (void *)elp;
1594 back = 1;
1595 } else {
1596 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1597 /* ERROR: Memory */
1598 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
1599 }
1600 } else {
1601 DKCT_GUI_ELEMENT *e;
1602 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1603 e = (DKCT_GUI_ELEMENT *)((gui->c_el)->menubar);
1604 if(e->name) {
1605 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 74, 75, e->name);
1606 }
1607 }
1608 }
1609 return back;
1610 }
1611
1612
1613
1614 /** Set tool bar.
1615 @param gui GUI description.
1616 @param il Input line to process.
1617 @return 1 on success, 0 on error.
1618 */
1619 static
1620 int
dkct_gui_set_tool_bar(DKCT_GUI * gui,char * il)1621 dkct_gui_set_tool_bar(DKCT_GUI *gui, char *il)
1622 {
1623 int back = 0;
1624 DKCT_GUI_ELEMENT *elp; /* Toolbar object. */
1625
1626 if(gui->c_el) {
1627 if(((gui->c_el)->number != 0) && (!((gui->c_el)->parent))) {
1628
1629 /* Warning: Attribute applicable to root object only! */
1630 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 55);
1631 }
1632 if(!((gui->c_el)->toolbar)) {
1633 elp = (DKCT_GUI_ELEMENT *)dk3sto_it_find_like(gui->i_el_by_name, il, 1);
1634 if(!(elp)) {
1635 elp = dkct_gui_elem_next(gui, il);
1636 }
1637 if(elp) {
1638 (gui->c_el)->toolbar = (void *)elp;
1639 back = 1;
1640 } else {
1641 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1642 /* ERROR: Memory */
1643 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
1644 }
1645 } else {
1646 DKCT_GUI_ELEMENT *e;
1647 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1648 /* ERROR: Redefinition */
1649 e = (DKCT_GUI_ELEMENT *)((gui->c_el)->toolbar);
1650 if(e->name) {
1651 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 74, 75, e->name);
1652 }
1653 }
1654 }
1655
1656 return back;
1657 }
1658
1659
1660
1661 /** Set status bar.
1662 @param gui GUI description.
1663 @param il Input line to process.
1664 @return 1 on success, 0 on error.
1665 */
1666 static
1667 int
dkct_gui_set_status_bar(DKCT_GUI * gui,char * il)1668 dkct_gui_set_status_bar(DKCT_GUI *gui, char *il)
1669 {
1670 int back = 0;
1671 int num = 0; /* Number of status bar labels. */
1672 char *p1; /* Number of status bar labels. */
1673 char *p2; /* Initial status text. */
1674
1675 if(gui->c_el) {
1676 if(((gui->c_el)->number != 0) && (!((gui->c_el)->parent))) {
1677
1678 /* Warning: Attribute applicable to root element only! */
1679 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 55);
1680 }
1681 p1 = dk3str_c8_start(il, NULL);
1682 if(p1) {
1683 p2 = dk3str_c8_next(p1, NULL);
1684 if(sscanf(p1, "%d", &num) == 1) {
1685 if(num >= 0) {
1686 back = 1;
1687 (gui->c_el)->stbsz = num;
1688 if(p2) {
1689 back = 0;
1690 dk3_release((gui->c_el)->stbText);
1691 (gui->c_el)->stbText = dk3str_c8_dup_app(p2, (gui->psrc)->app);
1692 if((gui->c_el)->stbText) {
1693 back = 1;
1694 } else {
1695 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1696 /* ERROR: Memory */
1697 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
1698 }
1699 }
1700 } else {
1701 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1702 /* ERROR: Out of range! */
1703 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 82, 83, p1);
1704 }
1705 } else {
1706 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1707 /* ERROR: Not a number! */
1708 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 31);
1709 }
1710 }
1711 }
1712
1713 return back;
1714 }
1715
1716
1717
1718 /** Set text for Window ID.
1719 @param gui GUI description.
1720 @param il Value part of input line.
1721 @return 1 on success, 0 on error.
1722 */
1723 static
1724 int
dkct_gui_set_id(DKCT_GUI * gui,char * il)1725 dkct_gui_set_id(DKCT_GUI *gui, char *il)
1726 {
1727 int back = 0;
1728 char *p1; /* Start of text. */
1729
1730 if(gui->c_el) {
1731 switch((gui->c_el)->cln) {
1732 case 5: case 6: case 7: case 8: case 9: case 10: {
1733
1734 /* Warning: Attribute not applicable to class! */
1735 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
1736 } break;
1737 }
1738 if(!((gui->c_el)->idname)) {
1739 p1 = dk3str_c8_start(il, NULL);
1740 if(p1) {
1741 dk3str_c8_delnl(il);
1742 (gui->c_el)->idname = dk3str_c8_dup_app(p1, (gui->psrc)->app);
1743 if((gui->c_el)->idname) {
1744 back = 1;
1745 } else {
1746 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1747 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
1748 }
1749 } else {
1750 /* ERROR: Syntax, empty ID */
1751 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1752 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 71);
1753 }
1754 } else {
1755 /* ERROR: Syntax, ID already defined! */
1756 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1757 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 60);
1758 }
1759 }
1760
1761 return back;
1762 }
1763
1764
1765
1766 /** Set constructor arguments.
1767 @param gui GUI description.
1768 @param il Value part of input line.
1769 @return 1 on success, 0 on error.
1770 */
1771 static
1772 int
dkct_gui_set_constructor(DKCT_GUI * gui,char * il)1773 dkct_gui_set_constructor(DKCT_GUI *gui, char *il)
1774 {
1775 int back = 0;
1776 char *p1; /* Start of text. */
1777
1778 if(gui->c_el) {
1779 if((gui->c_el)->cln >= 0) {
1780 /* Warning: Constructor attribute not recommended for class! */
1781 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
1782 }
1783 if(!((gui->c_el)->constructor)) {
1784 p1 = dk3str_c8_start(il, NULL);
1785 if(p1) {
1786 dk3str_c8_delnl(il);
1787 (gui->c_el)->constructor = dk3str_c8_dup_app(p1, (gui->psrc)->app);
1788 if((gui->c_el)->constructor) {
1789 back = 1;
1790 } else {
1791 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1792 /* ERROR: Memory */
1793 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
1794 }
1795 } else {
1796 /* ERROR: Syntax, empty ID */
1797 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1798 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 61);
1799 }
1800 } else {
1801 /* ERROR: Syntax, ID already defined! */
1802 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1803 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 60);
1804 }
1805 }
1806 return back;
1807 }
1808
1809
1810
1811 /** Set border.
1812 @param gui GUI description.
1813 @param il Value part of input line.
1814 @return 1 on success, 0 on error.
1815 */
1816 static
1817 int
dkct_gui_set_border(DKCT_GUI * gui,char * il)1818 dkct_gui_set_border(DKCT_GUI *gui, char *il)
1819 {
1820 int back = 0;
1821 int i = 0; /* Number of pixels for border. */
1822 char *p1 = NULL; /* Current string to process. */
1823 char *p2 = NULL; /* Next string to process. */
1824
1825 if(gui->c_el) {
1826 switch((gui->c_el)->cln) {
1827 case 0: case 1: case 2: case 3: case 4: {
1828 /* Warning: Attribute not applicable to class! */
1829 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
1830 } break;
1831 }
1832 p1 = dk3str_c8_start(il, NULL);
1833 if(p1) {
1834 p2 = dk3str_c8_next(p1, NULL);
1835 if(sscanf(p1, "%d", &i) == 1) {
1836 if(i >= 0) {
1837 (gui->c_el)->border = i;
1838 back = 1;
1839 if(p2) {
1840 (gui->c_el)->borderPos = DKCT_GUI_BORDER_POSITION_NONE;
1841 while(p2) {
1842 p1 = dk3str_c8_next(p2, NULL);
1843 i = dk3str_c8_array_index(dkct_gui_border_position_names, p2, 0);
1844 switch(i) {
1845 case 0: {
1846 (gui->c_el)->borderPos |= DKCT_GUI_BORDER_POSITION_ALL;
1847 } break;
1848 case 1: {
1849 (gui->c_el)->borderPos |= DKCT_GUI_BORDER_POSITION_TOP;
1850 } break;
1851 case 2: {
1852 (gui->c_el)->borderPos |= DKCT_GUI_BORDER_POSITION_LEFT;
1853 } break;
1854 case 3: {
1855 (gui->c_el)->borderPos |= DKCT_GUI_BORDER_POSITION_RIGHT;
1856 } break;
1857 case 4: {
1858 (gui->c_el)->borderPos |= DKCT_GUI_BORDER_POSITION_BOTTOM;
1859 } break;
1860 default: {
1861 back = 0;
1862 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1863 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p2);
1864 } break;
1865 }
1866 p2 = p1;
1867 }
1868 } else {
1869 (gui->c_el)->borderPos = DKCT_GUI_BORDER_POSITION_ALL;
1870 }
1871 }
1872 }
1873 }
1874 }
1875
1876 return back;
1877 }
1878
1879
1880
1881 /** Set proportion to grow the object.
1882 @param gui GUI description.
1883 @param il Value part of input line.
1884 @return 1 on success, 0 on error.
1885 */
1886 static
1887 int
dkct_gui_set_proportion(DKCT_GUI * gui,char * il)1888 dkct_gui_set_proportion(DKCT_GUI *gui, char *il)
1889 {
1890 int back = 0;
1891 int i; /* Proportion value. */
1892
1893 if(gui->c_el) {
1894 switch((gui->c_el)->cln) {
1895 case 0: case 1: case 2: case 3: {
1896 /* Warning: Attribute not applicable to class! */
1897 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
1898 } break;
1899 }
1900 if(sscanf(il, "%d", &i) == 1) {
1901 if(i >= 0) {
1902 back = 1;
1903 (gui->c_el)->proportion = i;
1904 }
1905 } else {
1906 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1907 dkct_to_log_3(gui->psrc, 1, DK3_LL_WARNING, 76, 77, il);
1908 }
1909 }
1910
1911 return back;
1912 }
1913
1914
1915
1916 /** Set status text.
1917 @param gui GUI description.
1918 @param il Value part of input line.
1919 @return 1 on success, 0 on error.
1920 */
1921 static
1922 int
dkct_gui_set_status_text(DKCT_GUI * gui,char * il)1923 dkct_gui_set_status_text(DKCT_GUI *gui, char *il)
1924 {
1925 DKCT_GUI_ELEMENT *el; /* Element to modify. */
1926 char *p1; /* Start of text. */
1927 int back = 0;
1928
1929 el = gui->c_el;
1930 if(el) {
1931 switch(el->cln) {
1932 case 0:
1933 case 1:
1934 case 2:
1935 case 3:
1936 {
1937 } break;
1938 default: {
1939 /* Warning: Attribute not applicable to class! */
1940 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
1941 } break;
1942 }
1943 {
1944 p1 = dk3str_c8_start(il, NULL);
1945 if(p1) {
1946 if(el->stbText) {
1947 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 74, 75, el->stbText);
1948 }
1949 dk3_release(el->stbText);
1950 el->stbText = dk3str_c8_dup_app(p1, (gui->psrc)->app);
1951 if(el->stbText) {
1952 back = 1;
1953 } else {
1954 (gui->psrc)->ec = DK3_ERROR_MEMORY;
1955 /* ERROR: Memory */
1956 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
1957 }
1958 }
1959 }
1960 }
1961
1962 return back;
1963 }
1964
1965
1966
1967 /** Set expand flag.
1968 @param gui GUI description.
1969 @param il Value part of input line.
1970 @return 1 on success, 0 on error.
1971 */
1972 static
1973 int
dkct_gui_set_expand(DKCT_GUI * gui,char * il)1974 dkct_gui_set_expand(DKCT_GUI *gui, char *il)
1975 {
1976 int back = 0;
1977 char *p1; /* Start of text. */
1978
1979 if(gui->c_el) {
1980 p1 = dk3str_c8_start(il, NULL);
1981 if(p1) {
1982 (void)dk3str_c8_next(p1, NULL);
1983 if(dk3str_c8_is_bool(p1)) {
1984 back = 1;
1985 if(dk3str_c8_is_on(p1)) {
1986 (gui->c_el)->expandFlag = 0x01;
1987 } else {
1988 (gui->c_el)->expandFlag = 0x00;
1989 }
1990 } else {
1991 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
1992 /* ERROR: Not a boolean! */
1993 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 70);
1994 }
1995 }
1996 }
1997 return back;
1998 }
1999
2000
2001 /** Set text for label or button.
2002 @param gui GUI description.
2003 @param il Value part of input line.
2004 @return 1 on success, 0 on error.
2005 */
2006 static
2007 int
dkct_gui_set_text(DKCT_GUI * gui,char * il)2008 dkct_gui_set_text(DKCT_GUI *gui, char *il)
2009 {
2010 int back = 0;
2011 char *p1; /* Start of text. */
2012
2013 if(gui->c_el) {
2014 switch((gui->c_el)->cln) {
2015 case -1:
2016 case 0:
2017 case 1:
2018 case 2:
2019 case 3:
2020 case 4:
2021 case 9:
2022 case 11:
2023 case 15:
2024 case 16:
2025 case 19:
2026 case 20:
2027 case 21:
2028 case 22:
2029 case 23:
2030 case 28:
2031 case 29:
2032 case 31:
2033 case 34:
2034 case 36:
2035 case 37:
2036 case 40:
2037 {
2038 } break;
2039 default: {
2040
2041 /* Warning: Attribute not applicable for class! */
2042 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
2043 } break;
2044 }
2045 if(!((gui->c_el)->text)) {
2046 p1 = dk3str_c8_start(il, NULL);
2047 if(p1) {
2048 dk3str_c8_delnl(il);
2049 (gui->c_el)->text = dk3str_c8_dup_app(p1, (gui->psrc)->app);
2050 if((gui->c_el)->text) {
2051 back = 1;
2052 } else {
2053 (gui->psrc)->ec = DK3_ERROR_MEMORY;
2054 /* ERROR: Memory */
2055 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
2056 }
2057 } else {
2058 /* ERROR: Syntax, empty ID */
2059 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 71);
2060 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2061 }
2062 } else {
2063 /* ERROR: Syntax, ID already defined! */
2064 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2065 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 60);
2066 }
2067 }
2068 return back;
2069 }
2070
2071
2072
2073 /** Set text for label or button.
2074 @param gui GUI description.
2075 @param il Value part of input line.
2076 @return 1 on success, 0 on error.
2077 */
2078 static
2079 int
dkct_gui_set_tip_text(DKCT_GUI * gui,char * il)2080 dkct_gui_set_tip_text(DKCT_GUI *gui, char *il)
2081 {
2082 int back = 0;
2083 char *p1; /* Start of text. */
2084
2085 if(gui->c_el) {
2086 switch((gui->c_el)->cln) {
2087 case -1:
2088 case 15:
2089 case 16:
2090 case 17:
2091 case 18:
2092 case 19:
2093 case 20:
2094 case 21:
2095 case 22:
2096 case 23:
2097 case 25:
2098 case 26:
2099 case 27:
2100 case 28:
2101 case 29:
2102 case 30:
2103 case 31:
2104 case 36:
2105 case 37: /* wxMenuItem */
2106 case 39:
2107 case 40:
2108 case 42:
2109 case 43:
2110 case 44:
2111 case 45:
2112 case 46:
2113 {
2114 } break;
2115 default: {
2116 /* Warning: Attribute not applicable to class! */
2117 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
2118 } break;
2119 }
2120 if(!((gui->c_el)->tipText)) {
2121 p1 = dk3str_c8_start(il, NULL);
2122 if(p1) {
2123 dk3str_c8_delnl(il);
2124 (gui->c_el)->tipText = dk3str_c8_dup_app(p1, (gui->psrc)->app);
2125 if((gui->c_el)->tipText) {
2126 back = 1;
2127 } else {
2128 (gui->psrc)->ec = DK3_ERROR_MEMORY;
2129 /* ERROR: Memory */
2130 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
2131 }
2132 } else {
2133 /* ERROR: Syntax, empty ID */
2134 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 71);
2135 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2136 }
2137 } else {
2138 /* ERROR: Syntax, tip text already defined! */
2139 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2140 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 62);
2141 }
2142 }
2143 return back;
2144 }
2145
2146
2147
2148 /** Set root object type (frame or dialog).
2149 @param gui GUI structure.
2150 @param il Value part of input line.
2151 @return 1 on success, 0 on error.
2152 */
2153 static
2154 int
dkct_gui_set_type(DKCT_GUI * gui,char * il)2155 dkct_gui_set_type(DKCT_GUI *gui, char *il)
2156 {
2157 int back = 0;
2158
2159 if(gui->c_el) {
2160 if(((gui->c_el)->number == 0) && (!((gui->c_el)->parent))) {
2161 switch(dk3str_c8_array_index(dkct_gui_base_type_names, il, 0)) {
2162 case 0: {
2163 (gui->c_el)->cln = 0;
2164 back = 1;
2165 } break;
2166 case 1: {
2167 (gui->c_el)->cln = 1;
2168 back = 1;
2169 } break;
2170 default: {
2171 /* ERROR: Illegal type */
2172 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2173 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 63);
2174 } break;
2175 }
2176 } else {
2177 /* ERROR: Attribute applicable to root element only! */
2178 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 55);
2179 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2180 }
2181 }
2182 return back;
2183 }
2184
2185
2186
2187 /** Read placement int value from text.
2188 The text may be an absolute or relative number or a dot.
2189 @param dest Pointer to destination variable.
2190 @param gui GUI structure.
2191 @param tptr Text to process.
2192 @param oldval Previous value.
2193 @return 1 on success, 0 on error.
2194 */
2195 static
2196 int
dkct_gui_read_number_from_string(int * dest,DKCT_GUI * gui,char * tptr,int oldval)2197 dkct_gui_read_number_from_string(
2198 int *dest,
2199 DKCT_GUI *gui,
2200 char *tptr,
2201 int oldval
2202 )
2203 {
2204 int back = 0;
2205 int i; /* Number read. */
2206
2207 if(dk3str_c8_cmp(tptr, dkct_gui_out_kw[15]) == 0) {
2208 *dest = oldval; back = 1;
2209 } else {
2210 if(*tptr == '+') {
2211 if(sscanf(&(tptr[1]), dkct_gui_out_kw[16], &i) == 1) {
2212 *dest = oldval + i; back = 1;
2213 }
2214 } else {
2215 if(*tptr == '-') {
2216 if(sscanf(&(tptr[1]), dkct_gui_out_kw[16], &i) == 1) {
2217 *dest = oldval - i; back = 1;
2218 }
2219 } else {
2220 if(sscanf(tptr, dkct_gui_out_kw[16], &i) == 1) {
2221 *dest = i; back = 1;
2222 }
2223 }
2224 }
2225 }
2226 if(!(back)) {
2227 /* ERROR: Syntax: Not a numeric value! */
2228 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 64, 65, tptr);
2229 }
2230 return back;
2231 }
2232
2233
2234
2235 /** Apply align specified as text to an object.
2236 @param gui GUI description.
2237 @param oa Alignment as found so far.
2238 @param ptext Text to process.
2239 @return Updated alignment.
2240 */
2241 static
2242 unsigned char
dkct_gui_apply_align(DKCT_GUI * gui,unsigned char oa,char * ptext)2243 dkct_gui_apply_align(DKCT_GUI *gui, unsigned char oa, char *ptext)
2244 {
2245 unsigned char back;
2246 back = oa;
2247
2248 switch(dk3str_c8_array_index(dkct_gui_align_names, ptext, 0)) {
2249 case 0: {
2250 back = (unsigned char)(
2251 (back & (~(DKCT_GUI_ALIGN_H_MASK))) | DKCT_GUI_ALIGN_H_LEFT
2252 );
2253 } break;
2254 case 1: {
2255 back = (back & (~(DKCT_GUI_ALIGN_H_MASK))) | DKCT_GUI_ALIGN_H_RIGHT;
2256 } break;
2257 case 2: {
2258 back = (unsigned char)(
2259 (back & (~(DKCT_GUI_ALIGN_V_MASK))) | DKCT_GUI_ALIGN_V_TOP
2260 );
2261 } break;
2262 case 3: {
2263 back = (back & (~(DKCT_GUI_ALIGN_V_MASK))) | DKCT_GUI_ALIGN_V_BOTTOM;
2264 } break;
2265 case 4: {
2266 back = DKCT_GUI_ALIGN_H_CENTER | DKCT_GUI_ALIGN_V_CENTER;
2267 } break;
2268 case 5: {
2269 back = (unsigned char)(
2270 (back & (~(DKCT_GUI_ALIGN_H_MASK))) | DKCT_GUI_ALIGN_H_CENTER
2271 );
2272 } break;
2273 case 6: {
2274 back = (unsigned char)(
2275 (back & (~(DKCT_GUI_ALIGN_V_MASK))) | DKCT_GUI_ALIGN_V_CENTER
2276 );
2277 } break;
2278 default: {
2279 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, ptext);
2280 /* ERROR: Illegal keyword */
2281 } break;
2282 }
2283 return back;
2284 }
2285
2286
2287
2288 /** Register additional placement information.
2289 Process value part of "contents = element 0 0 1 1 left top" line.
2290 @param gui GUI structure.
2291 @param parent Parent element.
2292 @param gel Element to add.
2293 @param p Texts, starting with element name.
2294 @param szp Number of elements used in \a p.
2295 @return 1 on success, 0 on error.
2296 */
2297 static
2298 int
dkct_gui_add_additional_placement_info(DKCT_GUI * gui,DKCT_GUI_ELEMENT * parent,DKCT_GUI_ELEMENT * gel,char ** p,size_t szp)2299 dkct_gui_add_additional_placement_info(
2300 DKCT_GUI *gui,
2301 DKCT_GUI_ELEMENT *parent,
2302 DKCT_GUI_ELEMENT *gel,
2303 char **p,
2304 size_t szp
2305 )
2306 {
2307 int back = 1;
2308 int x; /* Start column. */
2309 int y; /* Start row. */
2310 int w; /* Number of columns. */
2311 int h; /* Number of rows. */
2312
2313 switch((gui->c_el)->cln) {
2314 case 5: case 9: {
2315 /*
2316 Box sizer / static box sizer.
2317 contents = element [align]
2318 */
2319 if(szp > 1) {
2320 gel->align = 0x00;
2321 gel->align = dkct_gui_apply_align(gui, gel->align, p[1]);
2322 if(szp > 2) {
2323 gel->align = dkct_gui_apply_align(gui, gel->align, p[2]);
2324 }
2325 }
2326 } break;
2327 case 6: case 8: {
2328 /*
2329 Flex grid sizer.
2330 Grid sizer.
2331 contents = element x y [align [align]]
2332 */
2333 back = 0;
2334 if(szp >= 3) {
2335 if(dkct_gui_read_number_from_string(&x, gui, p[1], parent->curx)) {
2336 if(dkct_gui_read_number_from_string(&y, gui, p[2], parent->cury)) {
2337 gel->posx = x; gel->posy = y;
2338 parent->curx = x; parent->cury = y;
2339 back = 1;
2340 if(szp > 3) {
2341 gel->align = 0x00;
2342 gel->align = dkct_gui_apply_align(gui, gel->align, p[3]);
2343 if(szp > 4) {
2344 gel->align = dkct_gui_apply_align(gui, gel->align, p[4]);
2345 }
2346 }
2347 }
2348 }
2349 }
2350 } break;
2351 case 7: {
2352 /*
2353 Gridbag sizer.
2354 contents = element x y w h [align [align]]
2355 */
2356 back = 0;
2357 if(szp >= 5) {
2358 if(dkct_gui_read_number_from_string(&y, gui, p[1], parent->cury)) {
2359 if(dkct_gui_read_number_from_string(&x, gui, p[2], parent->curx)) {
2360 gel->posx = x; gel->posy = y; parent->curx = x; parent->cury = y;
2361 if(sscanf(p[3], dkct_gui_out_kw[16], &h) == 1) {
2362 if(sscanf(p[4], dkct_gui_out_kw[16], &w) == 1) {
2363 gel->spanx = w; gel->spany = h; back = 1;
2364 if(szp > 5) {
2365 gel->align = 0x00;
2366 gel->align = dkct_gui_apply_align(gui, gel->align, p[5]);
2367 if(szp > 6) {
2368 gel->align = dkct_gui_apply_align(gui, gel->align, p[6]);
2369 }
2370 }
2371 }
2372 }
2373 }
2374 }
2375 }
2376 } break;
2377 case 10: {
2378 /*
2379 Standard dialog button sizer.
2380 Ignore anything but the element name.
2381 contents = element
2382 */
2383 } break;
2384 default: {
2385 /*
2386 We don't know whether or not we are a sizer or anything
2387 else. So we ignore anything but the element name.
2388 */
2389 } break;
2390 }
2391 return back;
2392 }
2393
2394
2395
2396 /** Add one contents line.
2397 @param gui GUI structure.
2398 @param il Value part of input line.
2399 @return 1 on success, 0 on error.
2400 */
2401 static
2402 int
dkct_gui_add_contents(DKCT_GUI * gui,char * il)2403 dkct_gui_add_contents(DKCT_GUI *gui, char *il)
2404 {
2405 int back = 0;
2406 char *p[16]; /* Strings in text. */
2407 char *p1; /* Pseudo-object start. */
2408 char *p2; /* Pseudo-object args start. */
2409 char *p3; /* Pseudo-object next arg. */
2410 DKCT_GUI_ELEMENT *gel; /* Element to add. */
2411 size_t szp; /* Number of strings in text. */
2412 int pso; /* Pseudo object value. */
2413 int i;
2414
2415 if(gui->c_el) {
2416 switch((gui->c_el)->cln) {
2417 case 0: /* wxFrame */
2418 case 1: /* wxDiaglog */
2419 case 2: /* wxMDIParentFrame */
2420 case 3: /* wxMDIChildFrame */
2421 case 5: /* wxBoxSizer */
2422 case 6: /* wxFlexGridSizer */
2423 case 7: /* wxGridBagSizer */
2424 case 8: /* wxGridSizer */
2425 case 9: /* wxStaticBoxSizer */
2426 case 10: /* wxStdDialogButtonSizer */
2427 case 11: /* wxPanel */
2428 case 12: /* wxNotebook */
2429 case 13: /* wxScrolledWindow */
2430 case 14: /* wxSplitterWindow */
2431 case 34: /* wxStaticBox */
2432 case 35: /* wxMenuBar */
2433 case 36: /* wxMenu */
2434 case 38: /* wxToolBar */
2435 case 39: /* wxStatusBar */
2436 case 42: /* wxChoicebook */
2437 case 43: /* wxListbook */
2438 case 44: /* wxSimplebook */
2439 case 45: /* wxToolbook */
2440 case 46: /* wxTreebook */
2441 case 47: /* wxScrolled<wxPanel> */
2442 {
2443 } break;
2444 default: {
2445 /* Warning: Attribute not applicable to this class! */
2446 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 125);
2447 } break;
2448 }
2449 for(szp = 0; szp < 16; szp++) { p[szp] = NULL; }
2450 szp = dk3str_c8_explode(p, 15, il, NULL);
2451 if(szp > 0) {
2452 gel = dkct_gui_elem_next(gui, p[0]);
2453 if(gel) {
2454 if(dk3sto_add((gui->c_el)->s_contents, gel)) {
2455 if(*(p[0]) == '$') {
2456 p1 = p[0]; p2 = NULL; p3 = NULL;
2457 p2 = dk3str_c8_chr(p1, '(');
2458 if(p2) {
2459 *(p2++) = '\0';
2460 p3 = dk3str_c8_rchr(p2, ')');
2461 if(p3) {
2462 *p3 = '\0';
2463 }
2464 }
2465 pso = dk3str_c8_array_index(dkct_gui_pseudo_object_names, p[0], 0);
2466 if(pso >= 0) {
2467 gel->pseudoobj = 1 + pso;
2468 back = 1;
2469 }
2470 if(back) {
2471 switch(pso) {
2472 case 0: case 1: {
2473 if(pso == 0) {
2474 gel->proportion = 1;
2475 #if 0
2476 /*
2477 2011-07-30: No wxGROW for stretch/spacer.
2478 */
2479 gel->expandFlag = 0x01;
2480 #endif
2481 }
2482 if(p2) {
2483 p3 = dk3str_c8_chr(p2, ',');
2484 if(p3) *(p3++) = '\0';
2485 if(sscanf(p2, "%d", &i) == 1) {
2486 gel->sizex = i;
2487 gel->sizey = i;
2488 } else {
2489 /* ERROR: Not an integer! */
2490 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2491 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 64, 65, p2);
2492 back = 0;
2493 }
2494 if(p3) {
2495 p2 = dk3str_c8_chr(p3, ',');
2496 if(p2) *(p2++) = '\0';
2497 if(sscanf(p3, "%d", &i) == 1) {
2498 gel->sizey = i;
2499 } else {
2500 /* ERROR: Not an integer! */
2501 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2502 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 64, 65, p2);
2503 back = 0;
2504 }
2505 if(p2) {
2506 if(sscanf(p2, "%d", &i) == 1) {
2507 gel->proportion = i;
2508 } else {
2509 /* ERROR: Not an integer! */
2510 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2511 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 64, 65, p2);
2512 back = 0;
2513 }
2514 }
2515 }
2516 }
2517 } break;
2518 }
2519 }
2520 if(back) {
2521 back = dkct_gui_add_additional_placement_info(
2522 gui, gui->c_el, gel, p, szp
2523 );
2524 }
2525 } else {
2526 back = dkct_gui_add_additional_placement_info(
2527 gui, gui->c_el, gel, p, szp
2528 );
2529 }
2530 } else {
2531 /* ERROR: Memory */
2532 (gui->psrc)->ec = DK3_ERROR_MEMORY;
2533 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
2534 }
2535 } else {
2536 /* ERROR: Memory */
2537 (gui->psrc)->ec = DK3_ERROR_MEMORY;
2538 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
2539 }
2540 } else {
2541 /* ERROR: Empty line */
2542 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2543 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 66);
2544 }
2545 } else {
2546 }
2547 return back;
2548 }
2549
2550
2551
2552 /** Set up grid for current GUI object.
2553 @param gui GUI description.
2554 @param pv Text describing the grid.
2555 @return 1 on success, 0 on error.
2556 */
2557 static
2558 int
dkct_gui_set_grid(DKCT_GUI * gui,char * pv)2559 dkct_gui_set_grid(DKCT_GUI *gui, char *pv)
2560 {
2561 int back = 0;
2562 char *p1 = NULL; /* First text string. */
2563 char *p2 = NULL; /* Second text string. */
2564 char *p3 = NULL; /* Third text string. */
2565 char *p4 = NULL; /* Fourth text string. */
2566 DKCT_GUI_ELEMENT *co; /* Current object to modify. */
2567 int v = 0; /* Number read from string. */
2568 int i1 = 0; /* First int value. */
2569 int i2 = 0; /* Second int value. */
2570 int i3 = 0; /* Third int value. */
2571 int i4 = 0; /* Fourth int value. */
2572
2573 co = gui->c_el;
2574 if(co) {
2575 switch(co->cln) {
2576 case 6: case 7: case 8:
2577 {
2578 } break;
2579 default: {
2580 /* Warning: Attribute not applicable to class! */
2581 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
2582 } break;
2583 }
2584 p1 = dk3str_c8_start(pv, NULL);
2585 if(p1) {
2586 p2 = dk3str_c8_next(p1, NULL);
2587 if(p2) {
2588 p3 = dk3str_c8_next(p2, NULL);
2589 if(p3) {
2590 p4 = dk3str_c8_next(p3, NULL);
2591 if(p4) {
2592 dk3str_c8_next(p4, NULL);
2593 }
2594 }
2595 }
2596 }
2597 if(p1) {
2598 if(sscanf(p1, "%d", &i1) == 1) {
2599 if(i1 > 0) {
2600 v = 1;
2601 if(p2) {
2602 if(sscanf(p2, "%d", &i2) == 1) {
2603 if(i2 > 0) {
2604 v = 2;
2605 if(p3) {
2606 if(sscanf(p3, "%d", &i3) == 1) {
2607 if(i3 >= 0) {
2608 v = 3;
2609 if(p4) {
2610 if(sscanf(p4, "%d", &i4) == 1) {
2611 if(i4 >= 0) {
2612 v = 4;
2613 }
2614 }
2615 }
2616 }
2617 }
2618 }
2619 }
2620 }
2621 }
2622 }
2623 }
2624 }
2625 switch(co->cln) {
2626 case 6: case 8: { /* grid/flexgrid */
2627 if(v >= 2) {
2628 back = 1;
2629 co->gridrows = i1;
2630 co->gridcolumns = i2;
2631 if(v >= 3) {
2632 co->gridgapy = i3;
2633 if(v >= 4) {
2634 co->gridgapx = i4;
2635 }
2636 }
2637 }
2638 if(!(back)) {
2639 /* Syntax error. */
2640 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2641 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 67);
2642 }
2643 } break;
2644 case 7: { /* gridbag */
2645 back = 1;
2646 if(v >= 1) {
2647 co->gridgapy = i1;
2648 if(v >= 2) {
2649 co->gridgapx = i2;
2650 }
2651 }
2652 } break;
2653 default: { back = 1; }
2654 }
2655 } else {
2656 /* ERROR: No current element yet */
2657 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 68);
2658 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2659 }
2660 return back;
2661 }
2662
2663
2664
2665 /** Set sash for splitter window.
2666 @param gui GUI description.
2667 @param pv Text describing the grid.
2668 @return 1 on success, 0 on error.
2669 */
2670 static
2671 int
dkct_gui_set_sash(DKCT_GUI * gui,char * pv)2672 dkct_gui_set_sash(DKCT_GUI *gui, char *pv)
2673 {
2674 DKCT_GUI_ELEMENT *el; /* Element to modify. */
2675 int i; /* Number read from string. */
2676 int back = 0;
2677
2678 el = gui->c_el;
2679 if(el) {
2680 switch(el->cln) {
2681 case 14: {
2682 } break;
2683 default: {
2684 /* Warning: Attribute not applicable to class! */
2685 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
2686 } break;
2687 }
2688 {
2689 i = 0;
2690 if(sscanf(pv, "%d", &i) == 1) {
2691 back = 1;
2692 el->sash = i;
2693 }
2694 }
2695 }
2696
2697 return back;
2698 }
2699
2700
2701
2702 /** Set minimum pane size for splitter window.
2703 @param gui GUI description.
2704 @param pv Text describing the grid.
2705 @return 1 on success, 0 on error.
2706 */
2707 static
2708 int
dkct_gui_set_min_pane_size(DKCT_GUI * gui,char * pv)2709 dkct_gui_set_min_pane_size(DKCT_GUI *gui, char *pv)
2710 {
2711 DKCT_GUI_ELEMENT *el; /* Element to modify. */
2712 int i; /* Number read from string. */
2713 int back = 0;
2714
2715 el = gui->c_el;
2716 if(el) {
2717 switch(el->cln) {
2718 case 14: {
2719 } break;
2720 default: {
2721 /* Warning: Attribute not applicable to class! */
2722 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
2723 } break;
2724 }
2725 i = 0;
2726 if(sscanf(pv, "%d", &i) == 1) {
2727 back = 1;
2728 el->minPaneSize = i;
2729 } else {
2730 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2731 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, pv);
2732 }
2733 }
2734
2735 return back;
2736 }
2737
2738
2739
2740 /** Set flag whether or not the current button is the
2741 start of a new radio button group.
2742 @param gui GUI description.
2743 @param pv Text to process.
2744 @return 1 on success, 0 on error.
2745 */
2746 static
2747 int
dkct_gui_start_radio_button_group(DKCT_GUI * gui,char * pv)2748 dkct_gui_start_radio_button_group(DKCT_GUI *gui, char *pv)
2749 {
2750 int back = 0;
2751 DKCT_GUI_ELEMENT *co; /* Element to modify. */
2752 char *p1; /* Start of text. */
2753
2754 co = gui->c_el;
2755 if(co) {
2756 p1 = dk3str_c8_start(pv, NULL);
2757 if(p1) {
2758 dk3str_c8_delnl(p1);
2759 if(dk3str_c8_is_bool(p1)) {
2760 back = 1;
2761 if(dk3str_c8_is_on(p1)) {
2762 co->startGroup = 0x01;
2763 } else {
2764 co->startGroup = 0x00;
2765 }
2766 } else {
2767 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2768 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 70);
2769 }
2770 } else {
2771 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2772 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 69);
2773 }
2774 } else {
2775 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2776 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 68);
2777 }
2778
2779 return back;
2780 }
2781
2782
2783
2784 /** Set size of current GUI object.
2785 @param gui GUI description.
2786 @param pv Text containing the size.
2787 @return 1 on success, 0 on error.
2788 */
2789 static
2790 int
dkct_gui_set_size_for_object(DKCT_GUI * gui,char * pv)2791 dkct_gui_set_size_for_object(DKCT_GUI *gui, char *pv)
2792 {
2793 DKCT_GUI_ELEMENT *el; /* Element to modify. */
2794 char *p1; /* Width. */
2795 char *p2; /* Height. */
2796 int i1 = 0; /* Width. */
2797 int i2 = 0; /* Height. */
2798 int back = 0;
2799
2800 if(gui->c_el) {
2801 el = gui->c_el;
2802 p1 = dk3str_c8_start(pv, NULL);
2803 if(p1) {
2804 p2 = dk3str_c8_next(p1, NULL);
2805 if(p2) {
2806 if(sscanf(p1, "%d", &i1) == 1) {
2807 if(sscanf(p2, "%d", &i2) == 1) {
2808 if((i1 >= 0) && (i2 >= 0)) {
2809 back = 1;
2810 el->sizex = i1; el->sizey = i2;
2811 }
2812 } else {
2813 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2814 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p2);
2815 }
2816 } else {
2817 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2818 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
2819 }
2820 }
2821 }
2822 }
2823
2824 return back;
2825 }
2826
2827
2828
2829 /** Set spin control direction.
2830 @param gui GUI description.
2831 @param il Value to process.
2832 @return 1 on success, 0 on error.
2833 */
2834 static
2835 int
dkct_gui_set_direction(DKCT_GUI * gui,char * il)2836 dkct_gui_set_direction(DKCT_GUI *gui, char *il)
2837 {
2838 int back = 0;
2839 DKCT_GUI_ELEMENT *el; /* Element to modify. */
2840 char *p1; /* Start of text. */
2841
2842 el = gui->c_el;
2843 if(el) {
2844 p1 = dk3str_c8_start(il, NULL);
2845 if(p1) {
2846 dk3str_c8_next(p1, NULL);
2847 switch(el->cln) {
2848 case 5: /* box sizer */
2849 case 9: /* static box sizer */
2850 case 24: /* scrollbar */
2851 case 25: /* spin button */
2852 case 26: /* spin control */
2853 case 27: /* slider control */
2854 case 13: case 47: /* scrolled window */
2855 case 30: /* gauge */
2856 case 33: /* static line */
2857 {
2858 } break;
2859 default: {
2860 /* Warning: Direction ignored for this class! */
2861 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
2862 } break;
2863 }
2864 switch(dk3str_c8_array_index(dkct_gui_direction_names, p1, 0)) {
2865 case 0: {
2866 el->direction = DKCT_GUI_DIRECTION_HORIZONTAL;
2867 back = 1;
2868 } break;
2869 case 1: {
2870 el->direction = DKCT_GUI_DIRECTION_VERTICAL;
2871 back = 1;
2872 } break;
2873 case 2: {
2874 if((el->cln == 13) || (el->cln == 47)) {
2875 el->direction = DKCT_GUI_DIRECTION_BOTH;
2876 back = 1;
2877 } else {
2878 /* ERROR: Only one direction allowed here! */
2879 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2880 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 72);
2881 }
2882 } break;
2883 default: {
2884 /* ERROR: Unknown direction! */
2885 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2886 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 73);
2887 } break;
2888 }
2889 }
2890 }
2891
2892 return back;
2893 }
2894
2895
2896
2897 /** Set spin control range.
2898 @param gui GUI description.
2899 @param il Value to process.
2900 @return 1 on success, 0 on error.
2901 */
2902 static
2903 int
dkct_gui_set_range(DKCT_GUI * gui,char * il)2904 dkct_gui_set_range(DKCT_GUI *gui, char *il)
2905 {
2906 int back = 0;
2907 DKCT_GUI_ELEMENT *el; /* Element to modify. */
2908 char *p1; /* Minimum. */
2909 char *p2; /* Maximum. */
2910 int i1 = 0; /* Minimum. */
2911 int i2 = 100; /* Maximum. */
2912
2913 el = gui->c_el;
2914 if(el) {
2915 switch(el->cln) {
2916 case 25: /* spin */
2917 case 26: /* spin */
2918 case 27: /* slider */
2919 case 30: /* gauge */
2920 {
2921 } break;
2922 default: {
2923 /* Warning: Range ignored for this class! */
2924 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
2925 } break;
2926 }
2927 p1 = dk3str_c8_start(il, NULL);
2928 if(p1) {
2929 p2 = dk3str_c8_next(p1, NULL);
2930 if(p2) {
2931 if(sscanf(p1, "%d", &i1) == 1) {
2932 if(sscanf(p2, "%d", &i2) == 1) {
2933 el->spinMin = i1; el->spinMax = i2; back = 1;
2934 } else {
2935 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2936 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p2);
2937 }
2938 } else {
2939 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2940 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
2941 }
2942 } else {
2943 if(el->cln == 30) { /* Gauge has only one value */
2944 if(sscanf(p1, "%d", &i1) == 1) {
2945 el->spinMax = i1; el->spinMin = 0; back = 1;
2946 } else {
2947 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2948 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
2949 }
2950 }
2951 }
2952 }
2953 }
2954
2955 return back;
2956 }
2957
2958
2959
2960 /** Set spin control value.
2961 @param gui GUI description.
2962 @param il Value to process.
2963 @return 1 on success, 0 on error.
2964 */
2965 static
2966 int
dkct_gui_set_value(DKCT_GUI * gui,char * il)2967 dkct_gui_set_value(DKCT_GUI *gui, char *il)
2968 {
2969 int back = 0;
2970 DKCT_GUI_ELEMENT *el; /* Element to modify. */
2971 char *p1; /* Start of text. */
2972 int i1 = 0; /* Value. */
2973
2974 el = gui->c_el;
2975 if(el) {
2976 switch(el->cln) {
2977 case 25: /* spin */
2978 case 26: /* spin */
2979 case 27: /* slider */
2980 case 30: /* gauge */
2981 {
2982 } break;
2983 default: {
2984 /* Warning: Range ignored for this class! */
2985 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
2986 } break;
2987 }
2988 p1 = dk3str_c8_start(il, NULL);
2989 if(p1) {
2990 dk3str_c8_next(p1, NULL);
2991 if(sscanf(p1, "%d", &i1) == 1) {
2992 el->spinVal = i1;
2993 back = 1;
2994 } else {
2995 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
2996 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
2997 }
2998 }
2999 }
3000
3001 return back;
3002 }
3003
3004
3005
3006 /** Set spin control wrap flag.
3007 @param gui GUI description.
3008 @param il Value to process.
3009 @return 1 on success, 0 on error.
3010 */
3011 static
3012 int
dkct_gui_set_wrap(DKCT_GUI * gui,char * il)3013 dkct_gui_set_wrap(DKCT_GUI *gui, char *il)
3014 {
3015 int back = 0;
3016 char *p1; /* Start of text. */
3017 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3018
3019 el = gui->c_el;
3020 if(el) {
3021 switch(el->cln) {
3022 case 25: /* spin button */
3023 case 26: /* spin control */
3024 {
3025 } break;
3026 default: {
3027 /* ERROR: Wrap ignored for this class! */
3028 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3029 } break;
3030 }
3031 p1 = dk3str_c8_start(il, NULL);
3032 if(p1) {
3033 dk3str_c8_next(p1, NULL);
3034 if(dk3str_c8_is_bool(p1)) {
3035 back = 1;
3036 if(dk3str_c8_is_on(p1)) {
3037 el->spinWrap = 0x01;
3038 } else {
3039 el->spinWrap = 0x00;
3040 }
3041 } else {
3042 /* ERROR: Not a boolean value! */
3043 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3044 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 70);
3045 }
3046 }
3047 }
3048 return back;
3049 }
3050
3051
3052
3053 /** Set spin use keys flag.
3054 @param gui GUI description.
3055 @param il Value to process.
3056 @return 1 on success, 0 on error.
3057 */
3058 static
3059 int
dkct_gui_set_keys(DKCT_GUI * gui,char * il)3060 dkct_gui_set_keys(DKCT_GUI *gui, char *il)
3061 {
3062 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3063 char *p1; /* Start of text. */
3064 int back = 0;
3065
3066 el = gui->c_el;
3067 if(el) {
3068 switch(el->cln) {
3069 case 25: /* spin button */
3070 case 26: /* spin control */
3071 {
3072 } break;
3073 default: {
3074 /* Warning: Keys setting ignored for this class! */
3075 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3076 } break;
3077 }
3078 p1 = dk3str_c8_start(il, NULL);
3079 if(p1) {
3080 dk3str_c8_next(p1, NULL);
3081 if(dk3str_c8_is_bool(p1)) {
3082 back = 1;
3083 if(dk3str_c8_is_on(p1)) {
3084 el->useKeys = 0x01;
3085 } else {
3086 el->useKeys = 0x00;
3087 }
3088 } else {
3089 /* ERROR: Not a boolean! */
3090 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3091 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 70);
3092 }
3093 }
3094 }
3095 return back;
3096 }
3097
3098
3099
3100 /** Set validator for object.
3101 @param gui GUI description.
3102 @param il Input line to process.
3103 @return 1 on success, 0 on error.
3104 */
3105 static
3106 int
dkct_gui_set_validator(DKCT_GUI * gui,char * il)3107 dkct_gui_set_validator(DKCT_GUI *gui, char *il)
3108 {
3109 DKCT_GUI_ELEMENT *co; /* Element to modify. */
3110 int back = 0;
3111
3112 co = gui->c_el;
3113 if(co) {
3114 switch(co->cln) {
3115 case 15: /* wxButton */
3116 case 16: /* wxBitmapButton */
3117 case 17: /* wxChoice */
3118 case 18: /* wxComboBox */
3119 case 19: /* wxCheckBox */
3120 case 20: /* wxListBox */
3121 case 21: /* wxCheckListBox */
3122 case 22: /* wxRadioBox */
3123 case 23: /* wxRadioButton */
3124 case 24: /* wxScrollBar */
3125 case 25: /* wxSpinButton */
3126 case 26: /* wxSpinCtrl */
3127 case 27: /* wxSlider */
3128 case 28: /* wxTextCtrl */
3129 case 29: /* wxToggleButton */
3130 case 30: /* wxGauge */
3131 {
3132 } break;
3133 default: {
3134 /* Warning: Setting a validator is not recommended! */
3135 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3136 } break;
3137 }
3138 if(co->validator) {
3139 /* Warning: Redefinition of validator */
3140 dkct_to_log_3(gui->psrc, 1, DK3_LL_WARNING, 74, 75, co->validator);
3141 }
3142 dk3_release(co->validator);
3143 co->validator = dk3str_c8_dup_app(il, (gui->psrc)->app);
3144 if(co->validator) {
3145 back = 1;
3146 } else{
3147 (gui->psrc)->ec = DK3_ERROR_MEMORY;
3148 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 29);
3149 }
3150 }
3151
3152 return back;
3153 }
3154
3155
3156
3157 /** Set text style.
3158 @param gui GUI description.
3159 @param il Input line to process.
3160 @return 1 on success, 0 on error.
3161 */
3162 static
3163 int
dkct_gui_set_text_style(DKCT_GUI * gui,char * il)3164 dkct_gui_set_text_style(DKCT_GUI *gui, char *il)
3165 {
3166 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3167 char *p1; /* Current string to process. */
3168 char *p2; /* Next string to process. */
3169 int back = 0;
3170
3171 el = gui->c_el;
3172 if(el) {
3173 switch(el->cln) {
3174 case 28: /* wxTextCtrl */
3175 case 31: /* wxStaticText */
3176 case 41: /* wxGrid (readonly) */
3177 {
3178 } break;
3179 default: {
3180 /* Warning: Attribute not applicable for class! */
3181 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3182 } break;
3183 }
3184 {
3185 p1 = dk3str_c8_start(il, NULL);
3186 if(p1) {
3187 back = 1;
3188 while(p1) {
3189 p2 = dk3str_c8_next(p1, NULL);
3190 switch(dk3str_c8_array_index(dkct_gui_text_style_names, p1, 0)) {
3191 case 0: { /* enter */
3192 el->textStyle |= DKCT_GUI_TEXT_ENTER;
3193 } break;
3194 case 1: { /* tab */
3195 el->textStyle |= DKCT_GUI_TEXT_TAB;
3196 } break;
3197 case 2: { /* multi */
3198 el->textStyle |= DKCT_GUI_TEXT_MULTILINE;
3199 } break;
3200 case 3: { /* password */
3201 el->textStyle |= DKCT_GUI_TEXT_PASSWORD;
3202 } break;
3203 case 4: { /* readonly */
3204 el->textStyle |= DKCT_GUI_TEXT_READONLY;
3205 } break;
3206 case 5: { /* rich */
3207 el->textStyle |= DKCT_GUI_TEXT_RICH;
3208 } break;
3209 case 6: { /* rich2 */
3210 el->textStyle |= DKCT_GUI_TEXT_RICH2;
3211 } break;
3212 case 7: { /* url */
3213 el->textStyle |= DKCT_GUI_TEXT_URL;
3214 } break;
3215 case 8: { /* selection */
3216 el->textStyle |= DKCT_GUI_TEXT_SHOWSEL;
3217 } break;
3218 case 9: { /* left */
3219 el->textStyle |= DKCT_GUI_TEXT_LEFT;
3220 } break;
3221 case 10: { /* centered */
3222 el->textStyle |= DKCT_GUI_TEXT_CENTRE;
3223 } break;
3224 case 11: { /* right */
3225 el->textStyle |= DKCT_GUI_TEXT_RIGHT;
3226 } break;
3227 case 12: { /* nowrap */
3228 el->textStyle |= DKCT_GUI_TEXT_NOWRAP;
3229 } break;
3230 case 13: { /* charwrap */
3231 el->textStyle |= DKCT_GUI_TEXT_CHARWRAP;
3232 } break;
3233 case 14: { /* wordwrap */
3234 el->textStyle |= DKCT_GUI_TEXT_WORDWRAP;
3235 } break;
3236 case 15: { /* bestwrap */
3237 el->textStyle |= DKCT_GUI_TEXT_BESTWRAP;
3238 } break;
3239 case 16: { /* capitalize */
3240 if(el->cln == 31) {
3241 el->textStyle |= DKCT_GUI_TEXT_CAPITALIZE;
3242 }
3243 } break;
3244 case 17: {
3245 el->textStyle |= DKCT_GUI_TEXT_NO_AUTORESIZE;
3246 } break;
3247 default: {
3248 back = 0;
3249 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3250 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3251 } break;
3252 }
3253 p1 = p2;
3254 }
3255 }
3256 }
3257 }
3258
3259 return back;
3260 }
3261
3262
3263
3264 /** Set button style.
3265 @param gui GUI description.
3266 @param il Input line to process.
3267 @return 1 on success, 0 on error.
3268 */
3269 static
3270 int
dkct_gui_set_button_style(DKCT_GUI * gui,char * il)3271 dkct_gui_set_button_style(DKCT_GUI *gui, char *il)
3272 {
3273 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3274 char *p1; /* Current string to process. */
3275 char *p2; /* Next string to process. */
3276 int back = 0;
3277
3278 el = gui->c_el;
3279 if(el) {
3280 p1 = dk3str_c8_start(il, NULL);
3281 if(p1) {
3282 back = 1;
3283 while(p1) {
3284 p2 = dk3str_c8_next(p1, NULL);
3285 switch(dk3str_c8_array_index(dkct_gui_notebook_button_names, p1, 0)) {
3286 case 0: { /* left */
3287 el->buttonStyle |= DKCT_GUI_BUTTON_LEFT;
3288 } break;
3289 case 1: { /* top */
3290 el->buttonStyle |= DKCT_GUI_BUTTON_TOP;
3291 } break;
3292 case 2: { /* right */
3293 el->buttonStyle |= DKCT_GUI_BUTTON_RIGHT;
3294 } break;
3295 case 3: { /* bottom */
3296 el->buttonStyle |= DKCT_GUI_BUTTON_BOTTOM;
3297 } break;
3298 case 4: { /* fit */
3299 el->buttonStyle |= DKCT_GUI_BUTTON_EXACTFIT;
3300 } break;
3301 case 5: { /* no border */
3302 el->buttonStyle |= DKCT_GUI_BUTTON_NO_BORDER;
3303 } break;
3304 default: {
3305 back = 0;
3306 /* ERROR: Unknown keyword. */
3307 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3308 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3309 } break;
3310 }
3311 p1 = p2;
3312 }
3313 }
3314 }
3315
3316 return back;
3317 }
3318
3319
3320
3321 /** Set notebook style.
3322 @param gui GUI description.
3323 @param il Input line to process.
3324 @return 1 on success, 0 on error.
3325 */
3326 static
3327 int
dkct_gui_set_notebook_style(DKCT_GUI * gui,char * il)3328 dkct_gui_set_notebook_style(DKCT_GUI *gui, char *il)
3329 {
3330 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3331 char *p1; /* Current string to process. */
3332 char *p2; /* Next string to process. */
3333 int back = 0;
3334
3335 el = gui->c_el;
3336 if(el) {
3337 switch(el->cln) {
3338 case 12:
3339 case 42: /* 2018-05-29 Further books added */
3340 case 43:
3341 case 44:
3342 case 45:
3343 case 46:
3344 {
3345 } break;
3346 default: {
3347 /* Warning: Attribute not applicable for class! */
3348 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3349 } break;
3350 }
3351 {
3352 p1 = dk3str_c8_start(il, NULL);
3353 if(p1) {
3354 back = 1;
3355 while(p1) {
3356 p2 = dk3str_c8_next(p1, NULL);
3357 switch(dk3str_c8_array_index(dkct_gui_notebook_style_names, p1, 0))
3358 {
3359 case 0: { /* top */
3360 el->notebookStyle |= DKCT_GUI_NB_TOP;
3361 } break;
3362 case 1: { /* left */
3363 el->notebookStyle |= DKCT_GUI_NB_LEFT;
3364 } break;
3365 case 2: { /* right */
3366 el->notebookStyle |= DKCT_GUI_NB_RIGHT;
3367 } break;
3368 case 3: { /* bottom */
3369 el->notebookStyle |= DKCT_GUI_NB_BOTTOM;
3370 } break;
3371 case 4: { /* fixed-width */
3372 el->notebookStyle |= DKCT_GUI_NB_FIXEDWIDTH;
3373 } break;
3374 case 5: { /* multiline */
3375 el->notebookStyle |= DKCT_GUI_NB_MULTILINE;
3376 } break;
3377 case 6: { /* no-theme */
3378 el->notebookStyle |= DKCT_GUI_NB_NOPAGETHEME;
3379 } break;
3380 case 7: { /* flat */
3381 el->notebookStyle |= DKCT_GUI_NB_FLAT;
3382 } break;
3383 default: {
3384 back = 0;
3385 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3386 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3387 } break;
3388 }
3389 p1 = p2;
3390 }
3391 }
3392 }
3393 }
3394
3395 return back;
3396 }
3397
3398
3399
3400 /** Set slider style.
3401 @param gui GUI description.
3402 @param il Input line to process.
3403 @return 1 on success, 0 on error.
3404 */
3405 static
3406 int
dkct_gui_set_slider_style(DKCT_GUI * gui,char * il)3407 dkct_gui_set_slider_style(DKCT_GUI *gui, char *il)
3408 {
3409 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3410 char *p1; /* Current string to process. */
3411 char *p2; /* Next string to process. */
3412 int back = 0;
3413
3414 el = gui->c_el;
3415 if(el) {
3416 switch(el->cln) {
3417 case 27: {
3418 } break;
3419 default: {
3420 /* Warning: Attribute not applicable for class! */
3421 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3422 } break;
3423 }
3424 p1 = dk3str_c8_start(il, NULL);
3425 if(p1) {
3426 back = 1;
3427 while(p1) {
3428 p2 = dk3str_c8_next(p1, NULL);
3429 switch(dk3str_c8_array_index(dkct_gui_slider_style_names, p1, 0)) {
3430 case 0: {
3431 el->sliderStyle |= DKCT_GUI_SL_STYLE_AUTOTICKS;
3432 } break;
3433 case 1: {
3434 el->sliderStyle |= DKCT_GUI_SL_STYLE_LABELS;
3435 } break;
3436 case 2: {
3437 el->sliderStyle |= DKCT_GUI_SL_STYLE_LEFT;
3438 } break;
3439 case 3: {
3440 el->sliderStyle |= DKCT_GUI_SL_STYLE_RIGHT;
3441 } break;
3442 case 4: {
3443 el->sliderStyle |= DKCT_GUI_SL_STYLE_TOP;
3444 } break;
3445 case 5: {
3446 el->sliderStyle |= DKCT_GUI_SL_STYLE_BOTTOM;
3447 } break;
3448 case 6: {
3449 el->sliderStyle |= DKCT_GUI_SL_STYLE_SELRANGE;
3450 } break;
3451 case 7: {
3452 el->sliderStyle |= DKCT_GUI_SL_STYLE_INVERSE;
3453 } break;
3454 default: {
3455 back = 0;
3456 /* ERROR: Syntax, unknown slider style name! */
3457 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3458 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3459 } break;
3460 }
3461 p1 = p2;
3462 }
3463 }
3464 }
3465
3466 return back;
3467 }
3468
3469
3470
3471 /** Set splitter window style.
3472 @param gui GUI description.
3473 @param il Input line to process.
3474 @return 1 on success, 0 on error.
3475 */
3476 static
3477 int
dkct_gui_set_splitter_window_style(DKCT_GUI * gui,char * il)3478 dkct_gui_set_splitter_window_style(DKCT_GUI *gui, char *il)
3479 {
3480 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3481 char *p1; /* Current string to process. */
3482 char *p2; /* Next string to process .*/
3483 int back = 0;
3484
3485 el = gui->c_el;
3486 if(el) {
3487 switch(el->cln) {
3488 case 14: {
3489 } break;
3490 default: {
3491 /* Warning: Attribute not applicable for class! */
3492 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3493 } break;
3494 }
3495 {
3496 p1 = dk3str_c8_start(il, NULL);
3497 if(p1) {
3498 back = 1;
3499 el->splitterStyle = 0U;
3500 while(p1) {
3501 p2 = dk3str_c8_next(p1, NULL);
3502 switch(dk3str_c8_array_index(dkct_gui_splitterw_style_names,p1,0)) {
3503 case 0: {
3504 el->splitterStyle |= DKCT_GUI_SPLITTERW_3D;
3505 } break;
3506 case 1: {
3507 el->splitterStyle |= DKCT_GUI_SPLITTERW_3D_SASH;
3508 } break;
3509 case 2: {
3510 el->splitterStyle |= DKCT_GUI_SPLITTERW_3D_BORDER;
3511 } break;
3512 case 3: {
3513 el->splitterStyle |= DKCT_GUI_SPLITTERW_BORDER;
3514 } break;
3515 case 4: {
3516 el->splitterStyle |= DKCT_GUI_SPLITTERW_NO_BORDER;
3517 } break;
3518 case 5: {
3519 el->splitterStyle |= DKCT_GUI_SPLITTERW_NO_XP_THEME;
3520 } break;
3521 case 6: {
3522 el->splitterStyle |= DKCT_GUI_SPLITTERW_PERMIT_UNSPLIT;
3523 } break;
3524 case 7: {
3525 el->splitterStyle |= DKCT_GUI_SPLITTERW_LIVE_UPDATE;
3526 } break;
3527 default: {
3528 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3529 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3530 } break;
3531 }
3532 p1 = p2;
3533 }
3534 }
3535 }
3536 }
3537
3538 return back;
3539 }
3540
3541
3542
3543 /** Set bitmap button style.
3544 @param gui GUI description.
3545 @param il Input line to process.
3546 @return 1 on success, 0 on error.
3547 */
3548 static
3549 int
dkct_gui_set_bitmap_button_style(DKCT_GUI * gui,char * il)3550 dkct_gui_set_bitmap_button_style(DKCT_GUI *gui, char *il)
3551 {
3552 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3553 char *p1; /* Current string to process. */
3554 char *p2; /* Next string to process. */
3555 int back = 0;
3556
3557 el = gui->c_el;
3558 if(el) {
3559 switch(el->cln) {
3560 case 16:
3561 case 32:
3562 case 40:
3563 {
3564 } break;
3565 default: {
3566 /* Warning: Attribute not applicable to object! */
3567 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3568 } break;
3569 }
3570 {
3571 p1 = dk3str_c8_start(il, NULL);
3572 if(p1) {
3573 back = 1;
3574 el->bitmapbStyle = 0x00;
3575 while(p1) {
3576 p2 = dk3str_c8_next(p1, NULL);
3577 switch(dk3str_c8_array_index(dkct_gui_bitmapb_style_names, p1, 0)) {
3578 case 0: {
3579 el->bitmapbStyle |= DKCT_GUI_BBUTTON_AUTODRAW;
3580 } break;
3581 case 1: {
3582 el->bitmapbStyle |= DKCT_GUI_BBUTTON_LEFT;
3583 } break;
3584 case 2: {
3585 el->bitmapbStyle |= DKCT_GUI_BBUTTON_TOP;
3586 } break;
3587 case 3: {
3588 el->bitmapbStyle |= DKCT_GUI_BBUTTON_RIGHT;
3589 } break;
3590 case 4: {
3591 el->bitmapbStyle |= DKCT_GUI_BBUTTON_BOTTOM;
3592 } break;
3593 default: {
3594 /* ERROR: Unknown style entry! */
3595 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3596 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3597 back = 0;
3598 } break;
3599 }
3600 p1 = p2;
3601 }
3602 }
3603 }
3604 }
3605
3606 return back;
3607 }
3608
3609
3610
3611 /** Set gauge style.
3612 @param gui GUI description.
3613 @param il Input line to process.
3614 @return 1 on success, 0 on error.
3615 */
3616 static
3617 int
dkct_gui_set_gauge_style(DKCT_GUI * gui,char * il)3618 dkct_gui_set_gauge_style(DKCT_GUI *gui, char *il)
3619 {
3620 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3621 char *p1; /* Current string to process. */
3622 char *p2; /* Next string to process. */
3623 int back = 0;
3624
3625 el = gui->c_el;
3626 if(el) {
3627 switch(el->cln) {
3628 case 30: {
3629 } break;
3630 default: {
3631 /* Only allowed for gauge elements! */
3632 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3633 } break;
3634 }
3635 {
3636 p1 = dk3str_c8_start(il, NULL);
3637 if(p1) {
3638 back = 1;
3639 while(p1) {
3640 p2 = dk3str_c8_next(p1, NULL);
3641 switch(dk3str_c8_array_index(dkct_gui_gauge_style_names, p1, 0)) {
3642 case 0: {
3643 el->gaugeStyle |= DKCT_GUI_GAUGE_SMOOTH;
3644 } break;
3645 default: {
3646 /* Illegal keyword */
3647 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3648 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3649 back = 0;
3650 } break;
3651 }
3652 p1 = p2;
3653 }
3654 }
3655 }
3656 }
3657
3658 return back;
3659 }
3660
3661
3662
3663 /** Set icon.
3664 @param gui GUI description.
3665 @param il Input line to process.
3666 @return 1 on success, 0 on error.
3667 */
3668 static
3669 int
dkct_gui_set_icon(DKCT_GUI * gui,char * il)3670 dkct_gui_set_icon(DKCT_GUI *gui, char *il)
3671 {
3672 DKCT_GUI_ELEMENT *el;
3673 char *p1;
3674 int back = 0;
3675
3676 el = gui->c_el;
3677 if(el) {
3678 dk3_release(el->icon);
3679 p1 = dk3str_c8_start(il, NULL);
3680 if(p1) {
3681 dk3str_c8_delnl(p1);
3682 el->icon = dk3str_c8_dup_app(p1, (gui->psrc)->app);
3683 if((el->parent) || (el->number)) {
3684 /* Warning: Icon is recommended for top level windows only! */
3685 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 63);
3686 }
3687 if(el->icon) {
3688 back = 1;
3689 } else {
3690 (gui->psrc)->ec = DK3_ERROR_MEMORY;
3691 /* ERROR: Memory */
3692 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
3693 }
3694 } else {
3695 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3696 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 33);
3697 }
3698 }
3699
3700 return back;
3701 }
3702
3703
3704
3705 /** Set menu item style.
3706 @param gui GUI description.
3707 @param il Input line to process.
3708 @return 1 on success, 0 on error.
3709 */
3710 static
3711 int
dkct_gui_set_menu_item_style(DKCT_GUI * gui,char * il)3712 dkct_gui_set_menu_item_style(DKCT_GUI *gui, char *il)
3713 {
3714 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3715 char *p1; /* Current string to process. */
3716 char *p2; /* Next string to process. */
3717 int back = 0;
3718
3719 el = gui->c_el;
3720 if(el) {
3721 switch(el->cln) {
3722 case 37:
3723 case 40:
3724 {
3725 } break;
3726 default: {
3727 /* Warning: Attribute not applicable for class! */
3728 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3729 } break;
3730 }
3731 {
3732 p1 = dk3str_c8_start(il, NULL);
3733 if(p1) {
3734 back = 1;
3735 while(p1) {
3736 p2 = dk3str_c8_next(p1, NULL);
3737 switch(dk3str_c8_array_index(dkct_gui_menu_item_style_names, p1, 0))
3738 {
3739 case 0: {
3740 el->menuItemStyle = DKCT_GUI_MENU_ITEM_NORMAL;
3741 } break;
3742 case 1: {
3743 el->menuItemStyle = DKCT_GUI_MENU_ITEM_SEPARATOR;
3744 if(el->cln == 40) {
3745 back = 0;
3746 /* ERROR: Not allowed for tool bar buttons */
3747 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3748 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3749 }
3750 } break;
3751 case 2: {
3752 el->menuItemStyle = DKCT_GUI_MENU_ITEM_CHECK;
3753 } break;
3754 case 3: {
3755 el->menuItemStyle = DKCT_GUI_MENU_ITEM_RADIO;
3756 } break;
3757 default: {
3758 back = 0;
3759 /* ERROR: Unknown style! */
3760 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3761 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3762 } break;
3763 }
3764 p1 = p2;
3765 }
3766 }
3767 }
3768 }
3769
3770 return back;
3771 }
3772
3773
3774
3775 /** Set toolbar style.
3776 @param gui GUI description.
3777 @param il Input line to process.
3778 @return 1 on success, 0 on error.
3779 */
3780 static
3781 int
dkct_gui_set_toolbar_style(DKCT_GUI * gui,char * il)3782 dkct_gui_set_toolbar_style(DKCT_GUI *gui, char *il)
3783 {
3784 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3785 char *p1; /* Current string to process. */
3786 char *p2; /* Next string to process. */
3787 int back = 0;
3788
3789 el = gui->c_el;
3790 if(el) {
3791 switch(el->cln) {
3792 case 38: {
3793 } break;
3794 default: {
3795 /* Warning: Attribute not applicable for class! */
3796 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3797 } break;
3798 }
3799 {
3800 p1 = dk3str_c8_start(il, NULL);
3801 if(p1) {
3802 back = 1;
3803 while(p1) {
3804 p2 = dk3str_c8_next(p1, NULL);
3805 switch(dk3str_c8_array_index(dkct_gui_toolbar_style_names,p1,0)) {
3806 case 0: {
3807 el->toolbarStyle |= DKCT_GUI_TOOLBAR_FLAT;
3808 } break;
3809 case 1: {
3810 el->toolbarStyle |= DKCT_GUI_TOOLBAR_DOCKABLE;
3811 } break;
3812 case 2: {
3813 el->toolbarStyle |= DKCT_GUI_TOOLBAR_TEXT;
3814 } break;
3815 case 3: {
3816 el->toolbarStyle |= DKCT_GUI_TOOLBAR_NOICONS;
3817 } break;
3818 case 4: {
3819 el->toolbarStyle |= DKCT_GUI_TOOLBAR_NODIVIDER;
3820 } break;
3821 case 5: {
3822 el->toolbarStyle |= DKCT_GUI_TOOLBAR_HORZ_LAYOUT;
3823 } break;
3824 case 6: {
3825 el->toolbarStyle |= DKCT_GUI_TOOLBAR_NO_TOOLTIPS;
3826 } break;
3827 case 7: {
3828 el->toolbarStyle |= DKCT_GUI_TOOLBAR_BOTTOM;
3829 } break;
3830 case 8: {
3831 el->toolbarStyle |= DKCT_GUI_TOOLBAR_RIGHT;
3832 } break;
3833 default: {
3834 back = 0;
3835 /* ERROR: Unknown style keyword */
3836 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3837 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3838 } break;
3839 }
3840 p1 = p2;
3841 }
3842 }
3843 }
3844 }
3845
3846 return back;
3847 }
3848
3849
3850
3851 /** Set choices for combo, list etc.
3852 @param gui GUI description.
3853 @param il Input line to process.
3854 @return 1 on success, 0 on error.
3855 */
3856 static
3857 int
dkct_gui_set_choices(DKCT_GUI * gui,char * il)3858 dkct_gui_set_choices(DKCT_GUI *gui, char *il)
3859 {
3860 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3861 char *p1; /* Current string to process. */
3862 char *p2; /* Next string to process. */
3863 int i; /* Number read from text. */
3864 int back = 0;
3865
3866 el = gui->c_el;
3867 if(el) {
3868 switch(el->cln) {
3869 case 17: /* wxChoice */
3870 case 18: /* wxComboBox */
3871 case 20: /* wxListBox */
3872 case 21: /* wxCheckListBox */
3873 case 22: /* wxRadioBox */
3874 {
3875 } break;
3876 default: {
3877 /* Warning: Attribute not applicable to class! */
3878 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3879 } break;
3880 }
3881 {
3882 p1 = dk3str_c8_start(il, NULL);
3883 if(p1) {
3884 p2 = dk3str_c8_next(p1, NULL);
3885 if(p2) {
3886 if(sscanf(p1, "%i", &i) == 1) {
3887 if(i > 0) {
3888 el->nChoices = i;
3889 if(el->choices) {
3890 /* Warning: Redefinition */
3891 dkct_to_log_3(gui->psrc,1,DK3_LL_WARNING,74,75,el->choices);
3892 }
3893 dk3_release(el->choices);
3894 el->choices = dk3str_c8_dup_app(p2, (gui->psrc)->app);
3895 if(el->choices) {
3896 back = 1;
3897 } else {
3898 /* ERROR: Memory */
3899 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 29);
3900 (gui->psrc)->ec = DK3_ERROR_MEMORY;
3901 }
3902 }
3903 }
3904 } else {
3905 if(el->choices) {
3906 /* Warning: Redefinition */
3907 dkct_to_log_3(gui->psrc,1,DK3_LL_WARNING,74,75,el->choices);
3908 }
3909 dk3_release(el->choices);
3910 el->nChoices = -1;
3911 el->choices = dk3str_c8_dup_app(p1, (gui->psrc)->app);
3912 if(el->choices) {
3913 back = 1;
3914 } else {
3915 /* ERROR: Memory */
3916 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 29);
3917 (gui->psrc)->ec = DK3_ERROR_MEMORY;
3918 }
3919 }
3920 }
3921 }
3922 }
3923
3924 return back;
3925 }
3926
3927
3928
3929 /** Set style for list box.
3930 @param gui GUI description.
3931 @param il Input line to process.
3932 @return 1 on success, 0 on error.
3933 */
3934 static
3935 int
dkct_gui_set_list_box_style(DKCT_GUI * gui,char * il)3936 dkct_gui_set_list_box_style(DKCT_GUI *gui, char *il)
3937 {
3938 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3939 char *p1; /* Start of text. */
3940 int back = 0;
3941
3942 el = gui->c_el;
3943 if(el) {
3944 switch(el->cln) {
3945 case 20: /* list box */
3946 case 21: /* check list box */
3947 {
3948 } break;
3949 default: {
3950 /* Warning: Attribute not applicable to class! */
3951 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
3952 } break;
3953 }
3954 {
3955 p1 = dk3str_c8_start(il, NULL);
3956 if(p1) {
3957 switch(dk3str_c8_array_index(dkct_gui_cb_sel_names, p1, 0)) {
3958 case 0: {
3959 el->selStyle = DKCT_GUI_SELECTION_STYLE_SINGLE; back = 1;
3960 } break;
3961 case 1: {
3962 el->selStyle = DKCT_GUI_SELECTION_STYLE_MULTIPLE; back = 1;
3963 } break;
3964 case 2: {
3965 el->selStyle = DKCT_GUI_SELECTION_STYLE_EXTENDED; back = 1;
3966 } break;
3967 default: {
3968 /* ERROR: Illegal argument! */
3969 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
3970 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
3971 } break;
3972 }
3973 }
3974 }
3975 }
3976
3977 return back;
3978 }
3979
3980
3981
3982 /** Set max number of rows/columns for radio box.
3983 @param gui GUI description.
3984 @param il Input line to process.
3985 @param how Rows (0), columns (1).
3986 @return 1 on success, 0 on error.
3987 */
3988 static
3989 int
dkct_gui_set_rb_max(DKCT_GUI * gui,char * il,int how)3990 dkct_gui_set_rb_max(DKCT_GUI *gui, char *il, int how)
3991 {
3992 DKCT_GUI_ELEMENT *el; /* Element to modify. */
3993 char *p1; /* Start of text. */
3994 int i; /* Number read from text. */
3995 int back = 0;
3996
3997 el = gui->c_el;
3998 if(el) {
3999 switch(el->cln) {
4000 case 22: case 41:
4001 {
4002 } break;
4003 default: {
4004 /* Warning: Attribute not applicable to class! */
4005 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4006 } break;
4007 }
4008 {
4009 switch(el->cln) {
4010 case 22: {
4011 p1 = dk3str_c8_start(il, NULL);
4012 if(p1) {
4013 if(sscanf(p1, "%d", &i) == 1) {
4014 if(i > 0) {
4015 back = 1;
4016 el->maxRowsCols = i;
4017 if(how) {
4018 el->rbDirection = DKCT_GUI_RB_DIR_COLUMNS;
4019 } else {
4020 el->rbDirection = DKCT_GUI_RB_DIR_ROWS;
4021 }
4022 } else {
4023 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
4024 /* ERROR: Out of range. */
4025 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 82, 83, p1);
4026 }
4027 } else {
4028 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
4029 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
4030 }
4031 } else {
4032 /* ERROR: Missing argument */
4033 }
4034 } break;
4035 case 41: {
4036 p1 = dk3str_c8_start(il, NULL);
4037 if(p1) {
4038 if(sscanf(p1, "%d", &i) == 1) {
4039 if(i > 0) {
4040 back = 1;
4041 if(how) {
4042 el->nColumns = i;
4043 } else {
4044 el->nRows = i;
4045 }
4046 } else {
4047 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
4048 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 82, 83, p1);
4049 }
4050 } else {
4051 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
4052 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p1);
4053 }
4054 }
4055 } break;
4056 }
4057 }
4058 }
4059
4060 return back;
4061 }
4062
4063
4064
4065 /** Set states for checkbox.
4066 @param gui GUI description.
4067 @param il Input line to process.
4068 @return 1 on success, 0 on error.
4069 */
4070 static
4071 int
dkct_gui_set_states(DKCT_GUI * gui,char * il)4072 dkct_gui_set_states(DKCT_GUI *gui, char *il)
4073 {
4074 DKCT_GUI_ELEMENT *el; /* Element to modify. */
4075 char *p1; /* Current string to process. */
4076 char *p2; /* Next string to process. */
4077 int i; /* Number read from text. */
4078 int back = 0;
4079
4080 el = gui->c_el;
4081 if(el) {
4082 switch(el->cln) {
4083 case 19: /* wxCheckBox */
4084 {
4085 } break;
4086 default: {
4087 /* Warning: Attribute not applicable to class! */
4088 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4089 } break;
4090 }
4091 {
4092 i = 0;
4093 p1 = dk3str_c8_start(il, NULL);
4094 if(p1) {
4095 p2 = dk3str_c8_next(p1, NULL);
4096 if(sscanf(p1, "%d", &i) == 1) {
4097 if((i == 2) || (i == 3)) {
4098 if(i == 3) el->nStates = 0x03;
4099 else el->nStates = 0x02;
4100 back = 1;
4101 if(p2) {
4102 switch(dk3str_c8_array_index(dkct_gui_db_state_names, p2, 0)) {
4103 case 0: {
4104 el->state = 0x00;
4105 } break;
4106 case 1: {
4107 el->state = 0x01;
4108 } break;
4109 case 2: {
4110 if(el->nStates == 0x03) {
4111 el->state = 0x02;
4112 } else {
4113 back = 0;
4114 }
4115 } break;
4116 default: {
4117 back = 0;
4118 /* ERROR: Invalid state */
4119 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
4120 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 76, 77, p2);
4121 } break;
4122 }
4123 }
4124 } else {
4125 /* ERROR: Out of range! */
4126 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
4127 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 82, 83, p1);
4128 }
4129 } else {
4130 /* ERROR: Not a number */
4131 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
4132 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 31);
4133 }
4134 }
4135 }
4136 }
4137
4138 return back;
4139 }
4140
4141
4142
4143 /** Set bitmap for bitmap button.
4144 @param gui GUI description.
4145 @param il Input line to process.
4146 @return 1 on success, 0 on error.
4147 */
4148 static
4149 int
dkct_gui_set_bitmap(DKCT_GUI * gui,char * il)4150 dkct_gui_set_bitmap(DKCT_GUI *gui, char *il)
4151 {
4152 DKCT_GUI_ELEMENT *el; /* Element to modify. */
4153 char *p1; /* Start of text. */
4154 int back = 0;
4155
4156 el = gui->c_el;
4157 if(el) {
4158 switch(el->cln) {
4159 case 16:
4160 case 32:
4161 case 37:
4162 case 40:
4163 {
4164 } break;
4165 default: {
4166 /* Warning: Attribute not applicable to class! */
4167 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4168 } break;
4169 }
4170 {
4171 p1 = dk3str_c8_start(il, NULL);
4172 if(p1) {
4173 dk3str_c8_delnl(p1);
4174 dk3_release(el->bitmapVarName);
4175 el->bitmapVarName = dk3str_c8_dup_app(il, (gui->psrc)->app);
4176 if(el->bitmapVarName) {
4177 back = 1;
4178 } else {
4179 (gui->psrc)->ec = DK3_ERROR_MEMORY;
4180 /* ERROR: Memory */
4181 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
4182 }
4183 }
4184 }
4185 }
4186
4187 return back;
4188 }
4189
4190
4191
4192 /** Set disabled bitmap for bitmap button.
4193 @param gui GUI description.
4194 @param il Input line to process.
4195 @return 1 on success, 0 on error.
4196 */
4197 static
4198 int
dkct_gui_set_bitmap_disabled(DKCT_GUI * gui,char * il)4199 dkct_gui_set_bitmap_disabled(DKCT_GUI *gui, char *il)
4200 {
4201 DKCT_GUI_ELEMENT *el; /* Element to modify. */
4202 char *p1; /* Start of text. */
4203 int back = 0;
4204
4205 el = gui->c_el;
4206 if(el) {
4207 if(!((el->cln == 16) || (el->cln == 40))) {
4208 /* Warning: Attribute not applicable to class! */
4209 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4210 }
4211 p1 = dk3str_c8_start(il, NULL);
4212 if(p1) {
4213 dk3str_c8_delnl(p1);
4214 dk3_release(el->bitmapDisabled);
4215 el->bitmapDisabled = dk3str_c8_dup_app(il, (gui->psrc)->app);
4216 if(el->bitmapDisabled) {
4217 back = 1;
4218 } else {
4219 (gui->psrc)->ec = DK3_ERROR_MEMORY;
4220 /* ERROR: Memory */
4221 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
4222 }
4223 }
4224 }
4225
4226 return back;
4227 }
4228
4229
4230
4231 /** Set selected bitmap for bitmap button.
4232 @param gui GUI description.
4233 @param il Input line to process.
4234 @return 1 on success, 0 on error.
4235 */
4236 static
4237 int
dkct_gui_set_bitmap_selected(DKCT_GUI * gui,char * il)4238 dkct_gui_set_bitmap_selected(DKCT_GUI *gui, char *il)
4239 {
4240 DKCT_GUI_ELEMENT *el; /* Element to modify. */
4241 char *p1; /* Value for bitmap. */
4242 int back = 0;
4243
4244 el = gui->c_el;
4245 if(el) {
4246 if(el->cln != 16) {
4247 /* Warning: Attribute not applicable for class! */
4248 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4249 }
4250 {
4251 p1 = dk3str_c8_start(il, NULL);
4252 if(p1) {
4253 dk3str_c8_delnl(p1);
4254 dk3_release(el->bitmapSelected);
4255 el->bitmapSelected = dk3str_c8_dup_app(il, (gui->psrc)->app);
4256 if(el->bitmapSelected) {
4257 back = 1;
4258 } else {
4259 (gui->psrc)->ec = DK3_ERROR_MEMORY;
4260 /* ERROR: Memory */
4261 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
4262 }
4263 }
4264 }
4265 }
4266
4267 return back;
4268 }
4269
4270
4271
4272 /** Set focus bitmap for bitmap button.
4273 @param gui GUI description.
4274 @param il Input line to process.
4275 @return 1 on success, 0 on error.
4276 */
4277 static
4278 int
dkct_gui_set_bitmap_focus(DKCT_GUI * gui,char * il)4279 dkct_gui_set_bitmap_focus(DKCT_GUI *gui, char *il)
4280 {
4281 DKCT_GUI_ELEMENT *el; /* Element to modify. */
4282 char *p1; /* Bitmap value. */
4283 int back = 0;
4284
4285 el = gui->c_el;
4286 if(el) {
4287 if(el->cln != 16) {
4288 /* Warning: Attribute not applicable for class! */
4289 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4290 }
4291 {
4292 p1 = dk3str_c8_start(il, NULL);
4293 if(p1) {
4294 dk3str_c8_delnl(p1);
4295 dk3_release(el->bitmapFocus);
4296 el->bitmapFocus = dk3str_c8_dup_app(il, (gui->psrc)->app);
4297 if(el->bitmapFocus) {
4298 back = 1;
4299 } else {
4300 (gui->psrc)->ec = DK3_ERROR_MEMORY;
4301 /* ERROR: Memory */
4302 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
4303 }
4304 }
4305 }
4306 }
4307
4308 return back;
4309 }
4310
4311
4312
4313 /** Set hover bitmap for bitmap button.
4314 @param gui GUI description.
4315 @param il Input line to process.
4316 @return 1 on success, 0 on error.
4317 */
4318 static
4319 int
dkct_gui_set_bitmap_hover(DKCT_GUI * gui,char * il)4320 dkct_gui_set_bitmap_hover(DKCT_GUI *gui, char *il)
4321 {
4322 DKCT_GUI_ELEMENT *el; /* Element to modify. */
4323 char *p1; /* Bitmap value. */
4324 int back = 0;
4325
4326 el = gui->c_el;
4327 if(el) {
4328 if(el->cln != 16) {
4329 /* Warning: Attribute not applicable for class! */
4330 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4331 }
4332 {
4333 p1 = dk3str_c8_start(il, NULL);
4334 if(p1) {
4335 dk3str_c8_delnl(p1);
4336 dk3_release(el->bitmapHover);
4337 el->bitmapHover = dk3str_c8_dup_app(il, (gui->psrc)->app);
4338 if(el->bitmapHover) {
4339 back = 1;
4340 } else {
4341 (gui->psrc)->ec = DK3_ERROR_MEMORY;
4342 /* ERROR: Memory */
4343 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 57);
4344 }
4345 }
4346 }
4347 }
4348
4349 return back;
4350 }
4351
4352
4353
4354 /** Add row/column head.
4355 @param gui GUI description.
4356 @param pv Text for head.
4357 @param how Direction (0=row head, 1=column head).
4358 @return 1 on success, 0 on error.
4359 */
4360 static
4361 int
dkct_add_grid_head(DKCT_GUI * gui,char const * pv,int how)4362 dkct_add_grid_head(DKCT_GUI *gui, char const *pv, int how)
4363 {
4364 DKCT_GRID_HEAD *gh;
4365 int back = 0;
4366
4367 if((gui->c_el) && (pv)) {
4368 switch((gui->c_el)->cln) {
4369 case 41: {
4370 if(how) {
4371 if(!((gui->c_el)->sColumnHeads)) {
4372 (gui->c_el)->sColumnHeads = dk3sto_open_app((gui->psrc)->app);
4373 if((gui->c_el)->sColumnHeads) {
4374 dk3sto_set_comp(
4375 (gui->c_el)->sColumnHeads, dkct_grid_head_compare, 0
4376 );
4377 }
4378 }
4379 if(!((gui->c_el)->iColumnHeads)) {
4380 if((gui->c_el)->sColumnHeads) {
4381 (gui->c_el)->iColumnHeads =
4382 dk3sto_it_open((gui->c_el)->sColumnHeads);
4383 }
4384 }
4385 if(((gui->c_el)->sColumnHeads) && ((gui->c_el)->iColumnHeads)) {
4386 gh = dkct_grid_head_new(pv, (gui->c_el)->nColumnHeads, gui->psrc);
4387 if(gh) {
4388 if(dk3sto_add((gui->c_el)->sColumnHeads, gh)) {
4389 back = 1 ;
4390 (gui->c_el)->nColumnHeads += 1;
4391 } else {
4392 dkct_grid_head_delete(gh);
4393 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4394 }
4395 } else {
4396 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4397 }
4398 } else {
4399 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4400 }
4401 } else {
4402 if(!((gui->c_el)->sRowHeads)) {
4403 (gui->c_el)->sRowHeads = dk3sto_open_app((gui->psrc)->app);
4404 if((gui->c_el)->sRowHeads) {
4405 dk3sto_set_comp((gui->c_el)->sRowHeads,dkct_grid_head_compare,0);
4406 }
4407 }
4408 if(!((gui->c_el)->iRowHeads)) {
4409 if((gui->c_el)->sRowHeads) {
4410 (gui->c_el)->iRowHeads = dk3sto_it_open((gui->c_el)->sRowHeads);
4411 }
4412 }
4413 if(((gui->c_el)->sRowHeads) && ((gui->c_el)->iRowHeads)) {
4414 gh = dkct_grid_head_new(pv, (gui->c_el)->nRowHeads, gui->psrc);
4415 if(gh) {
4416 if(dk3sto_add((gui->c_el)->sRowHeads, gh)) {
4417 back = 1;
4418 (gui->c_el)->nRowHeads += 1;
4419 } else {
4420 dkct_grid_head_delete(gh);
4421 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4422 }
4423 } else {
4424 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4425 }
4426 } else {
4427 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4428 }
4429 }
4430 } break;
4431 default: {
4432 /* Warning: Attribute not applicable for class! */
4433 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4434 } break;
4435 }
4436 }
4437 return back;
4438 }
4439
4440
4441
4442 /** Add cell data.
4443 @param gui GUI description.
4444 @param pv Text to process (Row no, column no, text).
4445 @return 1 on success, 0 on error.
4446 */
4447 static
4448 int
dkct_add_grid_cell_data(DKCT_GUI * gui,char * pv)4449 dkct_add_grid_cell_data(DKCT_GUI *gui, char *pv)
4450 {
4451 char *p1;
4452 char *p2;
4453 char *p3;
4454 DKCT_CELL_DATA *pcd;
4455 int row = 0;
4456 int col = 0;
4457 int back = 0;
4458 if((gui->c_el) && (pv)) {
4459 switch((gui->c_el)->cln) {
4460 case 41: {
4461 p1 = dk3str_c8_start(pv, NULL);
4462 if (p1) {
4463 p2 = dk3str_c8_next(p1, NULL);
4464 if (p2) {
4465 p3 = dk3str_c8_next(p2, NULL);
4466 if (p3) {
4467 if (0 != dk3ma_i_from_c8_string(&row, p1, NULL)) {
4468 if (0 != dk3ma_i_from_c8_string(&col, p2, NULL)) {
4469 if ((0 <= row) && (0 <= col)) {
4470 if (!((gui->c_el)->sCellData)) {
4471 (gui->c_el)->sCellData =
4472 dk3sto_open_app((gui->psrc)->app);
4473 if ((gui->c_el)->sCellData) {
4474 dk3sto_set_comp(
4475 (gui->c_el)->sCellData, dkct_grid_cell_compare, 0
4476 );
4477 }
4478 }
4479 if (((gui->c_el)->sCellData) && (!((gui->c_el)->iCellData)))
4480 {
4481 (gui->c_el)->iCellData =
4482 dk3sto_it_open((gui->c_el)->sCellData);
4483 }
4484 if (((gui->c_el)->sCellData) && ((gui->c_el)->iCellData)) {
4485 pcd = dkct_grid_cell_new(p3, row, col, gui->psrc);
4486 if (pcd) {
4487 if (dk3sto_add((gui->c_el)->sCellData, pcd)) {
4488 back = 1;
4489 } else {
4490 dkct_grid_cell_delete(pcd);
4491 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4492 }
4493 } else {
4494 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4495 }
4496 } else {
4497 /* ERROR: Memory */
4498 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4499 }
4500 } else {
4501 /* !!!!! ERROR: Syntax (negative) */
4502 }
4503 } else {
4504 /* !!!!! ERROR: Syntax (not a number) */
4505 }
4506 } else {
4507 /* !!!!! ERROR: Syntax (not a number) */
4508 }
4509 } else {
4510 /* !!!!! ERROR: No text to save */
4511 }
4512 } else {
4513 /* !!!!! ERROR: No column */
4514 }
4515 } else {
4516 /* !!!!! ERROR: No text */
4517 }
4518 } break;
4519 default: {
4520 /* Warning: Attribute not applicable for class! */
4521 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4522 } break;
4523 }
4524 }
4525 return back;
4526 }
4527
4528
4529
4530 /** Set grid style.
4531 @param gui GUI description.
4532 @param pv Text to process (Row no, column no, text).
4533 @return 1 on success, 0 on error.
4534 */
4535 static
4536 int
dkct_set_grid_style(DKCT_GUI * gui,char * pv)4537 dkct_set_grid_style(DKCT_GUI *gui, char *pv)
4538 {
4539 int back = 0;
4540 char *p1;
4541 char *p2;
4542 if((gui->c_el) && (pv)) {
4543 switch((gui->c_el)->cln) {
4544 case 41: {
4545 back = 1;
4546 p1 = dk3str_c8_start(pv, NULL);
4547 while (p1) {
4548 p2 = dk3str_c8_next(p1, NULL);
4549 switch (dk3str_c8_array_index(dkct_gui_grid_style_names, p1, 1)) {
4550 case 0: {
4551 (gui->c_el)->gridStyle |= DKCT_GUI_GRID_AS_DATA;
4552 } break;
4553 case 1: {
4554 (gui->c_el)->gridStyle |= DKCT_GUI_GRID_AS_LABEL_ROWS;
4555 } break;
4556 case 2: {
4557 (gui->c_el)->gridStyle |= DKCT_GUI_GRID_AS_LABEL_COLS;
4558 } break;
4559 case 3: {
4560 (gui->c_el)->gridStyle |=
4561 (DKCT_GUI_GRID_AS_LABEL_ROWS | DKCT_GUI_GRID_AS_LABEL_COLS);
4562 } break;
4563 default : {
4564 /* !!!!! ERROR: Syntax */
4565 } break;
4566 }
4567 p1 = p2;
4568 }
4569 } break;
4570 default: {
4571 /* Warning: Attribute not applicable for class! */
4572 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4573 } break;
4574 }
4575 }
4576 return back;
4577 }
4578
4579
4580
4581 /** Set tooltip flag for element.
4582 @param gui GUI description.
4583 @param pv Text value.
4584 @return 1 on success, 0 on error.
4585 */
4586 static
4587 int
dkct_set_tooltip_flag(DKCT_GUI * gui,char * pv)4588 dkct_set_tooltip_flag(DKCT_GUI *gui, char *pv)
4589 {
4590 char *p1 = NULL;
4591 int back = 0;
4592 if ((NULL != gui) && (NULL != pv)) {
4593 dk3str_c8_delnl(pv);
4594 p1 = dk3str_c8_dup_app(pv, (gui->psrc)->app);
4595 if (NULL != p1) {
4596 back = 1;
4597 if (0 == (gui->c_el)->number) {
4598 if (NULL != gui->ttflag) {
4599 /* Warning: Redefinition of tooltip flag */
4600 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 115);
4601 }
4602 dk3_release(gui->ttflag);
4603 gui->ttflag = p1;
4604 } else {
4605 if (NULL != (gui->c_el)->ttflag) {
4606 /* Warning: Redefinition of tooltip flag */
4607 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 115);
4608 }
4609 dk3_release((gui->c_el)->ttflag);
4610 (gui->c_el)->ttflag = p1;
4611 }
4612 }
4613 }
4614 return back;
4615 }
4616
4617
4618
4619
4620 /** Set gridTable entry for current object.
4621 @param gui GUI description.
4622 @param pv Text to process.
4623 @return 1 on success, 0 on error.
4624 */
4625 static
4626 int
dkct_set_table_for_grid(DKCT_GUI * gui,char * pv)4627 dkct_set_table_for_grid(DKCT_GUI *gui, char *pv)
4628 {
4629 char *p1 = NULL;
4630 char *p2 = NULL;
4631 int back = 0;
4632 if(gui->c_el) {
4633 switch((gui->c_el)->cln) {
4634 case 41: {
4635 p1 = dk3str_c8_start(pv, NULL);
4636 if(p1) {
4637 p2 = dk3str_c8_next(p1, NULL);
4638 if((gui->c_el)->gridTable) {
4639 dkct_to_log_3(
4640 gui->psrc, 1, DK3_LL_ERROR, 74, 75, (gui->c_el)->gridTable
4641 );
4642 }
4643 dk3_release((gui->c_el)->gridTable);
4644 (gui->c_el)->gridTable = dk3str_c8_dup_app(pv, (gui->psrc)->app);
4645 if((gui->c_el)->gridTable) {
4646 back = 1;
4647 if(p2) {
4648 if(dk3str_c8_is_on(p2)) {
4649 (gui->c_el)->tableOwner = 0x01;
4650 }
4651 }
4652 } else {
4653 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4654 }
4655 } else {
4656 /* ERROR: Empty text! */
4657 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 69);
4658 }
4659 } break;
4660 default: {
4661 /* Warning: Attribute not applicable for class! */
4662 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 56);
4663 } break;
4664 }
4665 }
4666 return back;
4667 }
4668
4669
4670
4671 /** Set minimum size for an object.
4672 @param gui GUI description.
4673 @param pv Text containing the size in pixels.
4674 @return 1 on success, 0 on error.
4675 */
4676 static
4677 int
dkct_set_minimum_size(DKCT_GUI * gui,char * pv)4678 dkct_set_minimum_size(DKCT_GUI *gui, char *pv)
4679 {
4680 char *p1;
4681 char *p2;
4682 int i1;
4683 int i2;
4684 int back = 0;
4685 p1 = dk3str_c8_start(pv, NULL);
4686 if(p1) {
4687 p2 = dk3str_c8_next(p1, NULL);
4688 if(p2) {
4689 if(1 == sscanf(p1, "%d", &i1)) {
4690 if(1 == sscanf(p2, "%d", &i2)) {
4691 if(i1 < 0) i1 = 0;
4692 if(i2 < 0) i2 = 0;
4693 back = 1;
4694 if(gui->c_el) {
4695 (gui->c_el)->sizemx = i1;
4696 (gui->c_el)->sizemy = i2;
4697 }
4698 } else {
4699 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 64, 65, p2);
4700 }
4701 } else {
4702 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 64, 65, p1);
4703 }
4704 } else {
4705 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4706 }
4707 } else {
4708 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 69);
4709 }
4710 return back;
4711 }
4712
4713
4714
4715 /** Compare two int pointers by number, reverse sort order.
4716 @param l Left pointer.
4717 @param r Right pointer.
4718 @param cr Comparison criteria, ignored.
4719 @return Comparison result for inverted sort order.
4720 */
4721 static
4722 int
dkct_int_compare(void const * l,void const * r,int DK3_ARG_UNUSED (cr))4723 dkct_int_compare(void const *l, void const *r, int DK3_ARG_UNUSED(cr) )
4724 {
4725 int const *pl;
4726 int const *pr;
4727 int back = 0;
4728
4729 DK3_UNUSED_ARG(cr)
4730 pl = (int const *)l; pr = (int const *)r;
4731 if(pl) {
4732 if(pr) {
4733 if(*pl > *pr) back = -1;
4734 else {
4735 if(*pl < *pr) back = 1;
4736 }
4737 } else back = -1;
4738 } else {
4739 if(pr) back = 1;
4740 }
4741 return back;
4742 }
4743
4744
4745
4746 /** Note information about a growable row.
4747 @param gui GUI description.
4748 @param pv Text containing the row number.
4749 @return 1 on success, 0 on error.
4750 */
4751 static
4752 int
dkct_add_growable_row(DKCT_GUI * gui,char * pv)4753 dkct_add_growable_row(DKCT_GUI *gui, char *pv)
4754 {
4755 int *ip;
4756 int back = 0;
4757 int i;
4758 if(gui->c_el) {
4759 if(1 == sscanf(pv, "%d", &i)) {
4760 if(i >= 0) {
4761 if(!((gui->c_el)->sGrowRow)) {
4762 (gui->c_el)->sGrowRow = dk3sto_open_app((gui->psrc)->app);
4763 if((gui->c_el)->sGrowRow) {
4764 dk3sto_set_comp((gui->c_el)->sGrowRow, dkct_int_compare, 0);
4765 }
4766 }
4767 if(!((gui->c_el)->iGrowRow)) {
4768 if((gui->c_el)->sGrowRow) {
4769 (gui->c_el)->iGrowRow = dk3sto_it_open((gui->c_el)->sGrowRow);
4770 }
4771 }
4772 if(((gui->c_el)->sGrowRow) && ((gui->c_el)->iGrowRow)) {
4773 ip = dk3_new_app(int,1,(gui->psrc)->app);
4774 if(ip) {
4775 *ip = i;
4776 if(dk3sto_add((gui->c_el)->sGrowRow, (void *)ip)) {
4777 back = 1;
4778 } else {
4779 dk3_delete(ip);
4780 /* ERROR: Memory */
4781 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4782 }
4783 } else {
4784 /* ERROR: Memory */
4785 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4786 }
4787 } else {
4788 /* ERROR: Memory */
4789 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4790 }
4791 } else {
4792 /* ERROR: Syntax */
4793 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 112);
4794 }
4795 } else {
4796 /* ERROR: Not a number! */
4797 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 64, 65, pv);
4798 }
4799 }
4800 return back;
4801 }
4802
4803
4804
4805 /** Note information about a growable row.
4806 @param gui GUI description.
4807 @param pv Text containing the row number.
4808 @return 1 on success, 0 on error.
4809 */
4810 static
4811 int
dkct_add_growable_column(DKCT_GUI * gui,char * pv)4812 dkct_add_growable_column(DKCT_GUI *gui, char *pv)
4813 {
4814 int *ip;
4815 int back = 0;
4816 int i;
4817 if(gui->c_el) {
4818 if(1 == sscanf(pv, "%d", &i)) {
4819 if(i >= 0) {
4820 if(!((gui->c_el)->sGrowCol)) {
4821 (gui->c_el)->sGrowCol = dk3sto_open_app((gui->psrc)->app);
4822 if((gui->c_el)->sGrowCol) {
4823 dk3sto_set_comp((gui->c_el)->sGrowCol, dkct_int_compare, 0);
4824 }
4825 }
4826 if(!((gui->c_el)->iGrowCol)) {
4827 if((gui->c_el)->sGrowCol) {
4828 (gui->c_el)->iGrowCol = dk3sto_it_open((gui->c_el)->sGrowCol);
4829 }
4830 }
4831 if(((gui->c_el)->sGrowCol) && ((gui->c_el)->iGrowCol)) {
4832 ip = dk3_new_app(int,1,(gui->psrc)->app);
4833 if(ip) {
4834 *ip = i;
4835 if(dk3sto_add((gui->c_el)->sGrowCol, (void *)ip)) {
4836 back = 1;
4837 } else {
4838 dk3_delete(ip);
4839 /* ERROR: Memory */
4840 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4841 }
4842 } else {
4843 /* ERROR: Memory */
4844 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4845 }
4846 } else {
4847 /* ERROR: Memory */
4848 dkct_to_log_1(gui->psrc, 0, DK3_LL_ERROR, 29);
4849 }
4850 } else {
4851 /* ERROR: Syntax */
4852 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 112);
4853 }
4854 } else {
4855 /* ERROR: Not numeric! */
4856 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 64, 65, pv);
4857 }
4858 }
4859 return back;
4860 }
4861
4862
4863
4864 /** Set "complete constructor specified" attribute.
4865 @param gui GUI description.
4866 @param pv Text to process.
4867 @return 1 on success, 0 on error.
4868 */
4869 static
4870 int
dkct_set_complete_constructor_specified(DKCT_GUI * gui,char * pv)4871 dkct_set_complete_constructor_specified(DKCT_GUI *gui, char *pv)
4872 {
4873 int back = 0;
4874 if(gui->c_el) {
4875 if(pv) {
4876 if(dk3str_c8_is_bool(pv)) {
4877 back = 1;
4878 if(dk3str_c8_is_on(pv)) {
4879 (gui->c_el)->compConst = 0x01;
4880 } else {
4881 (gui->c_el)->compConst = 0x00;
4882 }
4883 } else {
4884 /* ERROR: Not a boolean value! */
4885 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 70);
4886 }
4887 } else {
4888 (gui->c_el)->compConst = 0x00;
4889 back = 1;
4890 }
4891 }
4892 return back;
4893 }
4894
4895
4896
4897 /** Process one line containing object details.
4898 @param gui GUI description.
4899 @param il Input line to process.
4900 @return 1 on success, 0 on error.
4901 */
4902 static
4903 int
dkct_gui_process_object_line(DKCT_GUI * gui,char * il)4904 dkct_gui_process_object_line(DKCT_GUI *gui, char *il)
4905 {
4906 int back = 1;
4907 char *pv; /* Value. */
4908 int action; /* Attribute index. */
4909
4910 if(gui->c_el) {
4911 pv = dk3str_c8_chr(il, '=');
4912 if(pv) {
4913 *(pv++) = '\0';
4914 pv = dk3str_c8_start(pv, NULL);
4915 if(pv) {
4916 dk3str_c8_normalize(il, NULL, '-');
4917 action = dk3str_c8_array_index(dkct_gui_attribute_keys, il, 0);
4918 switch(action) {
4919 case 0: case 23: {
4920 back = dkct_gui_set_expand(gui, pv);
4921 } break;
4922 case 1: {
4923 back = dkct_gui_set_type(gui, pv);
4924 } break;
4925 case 2: {
4926 back = dkct_gui_set_menu_bar(gui, pv);
4927 } break;
4928 case 3: {
4929 back = dkct_gui_set_tool_bar(gui, pv);
4930 } break;
4931 case 4: {
4932 back = dkct_gui_set_status_bar(gui, pv);
4933 } break;
4934 case 5: {
4935 back = dkct_gui_add_contents(gui, pv);
4936 } break;
4937 case 6: {
4938 back = dkct_gui_set_text(gui, pv);
4939 } break;
4940 case 7: {
4941 back = dkct_gui_set_id(gui, pv);
4942 } break;
4943 case 8: {
4944 back = dkct_gui_set_tip_text(gui, pv);
4945 } break;
4946 case 9: {
4947 back = dkct_gui_set_proportion(gui, pv);
4948 } break;
4949 case 10: {
4950 back = dkct_gui_set_status_text(gui, pv);
4951 } break;
4952 case 11: {
4953 back = dkct_gui_set_border(gui, pv);
4954 } break;
4955 case 12: {
4956 back = dkct_gui_set_constructor(gui, pv);
4957 } break;
4958 case 13: {
4959 back = dkct_gui_set_grid(gui, pv);
4960 } break;
4961 case 14: {
4962 back = dkct_gui_set_sash(gui, pv);
4963 } break;
4964 case 15: {
4965 back = dkct_gui_set_min_pane_size(gui, pv);
4966 } break;
4967 case 16: {
4968 back = dkct_gui_set_bitmap(gui, pv);
4969 } break;
4970 case 17: {
4971 back = dkct_gui_set_choices(gui, pv);
4972 } break;
4973 case 18: {
4974 back = dkct_gui_set_states(gui, pv);
4975 } break;
4976 case 19: {
4977 back = dkct_gui_set_size_for_object(gui, pv);
4978 } break;
4979 case 20: {
4980 back = dkct_gui_set_list_box_style(gui, pv);
4981 } break;
4982 case 21: {
4983 back = dkct_gui_set_rb_max(gui, pv, 0);
4984 } break;
4985 case 22: {
4986 back = dkct_gui_set_rb_max(gui, pv, 1);
4987 } break;
4988 case 24: {
4989 back = dkct_gui_start_radio_button_group(gui, pv);
4990 } break;
4991 case 25: {
4992 back = dkct_gui_set_direction(gui, pv);
4993 } break;
4994 case 26: {
4995 back = dkct_gui_set_range(gui, pv);
4996 } break;
4997 case 27: {
4998 back = dkct_gui_set_wrap(gui, pv);
4999 } break;
5000 case 28: {
5001 back = dkct_gui_set_keys(gui, pv);
5002 } break;
5003 case 29: {
5004 back = dkct_gui_set_validator(gui, pv);
5005 } break;
5006 case 30: {
5007 back = dkct_gui_set_value(gui, pv);
5008 } break;
5009 case 31: {
5010 back = dkct_gui_set_slider_style(gui, pv);
5011 } break;
5012 case 32: {
5013 back = dkct_gui_set_notebook_style(gui, pv);
5014 } break;
5015 case 33: {
5016 back = dkct_gui_set_text_style(gui, pv);
5017 } break;
5018 case 34: {
5019 back = dkct_gui_set_button_style(gui, pv);
5020 } break;
5021 case 35: {
5022 back = dkct_gui_set_splitter_window_style(gui, pv);
5023 } break;
5024 case 36: {
5025 back = dkct_gui_set_bitmap_button_style(gui, pv);
5026 } break;
5027 case 37: {
5028 back = dkct_gui_set_bitmap_disabled(gui, pv);
5029 } break;
5030 case 38: {
5031 back = dkct_gui_set_bitmap_selected(gui, pv);
5032 } break;
5033 case 39: {
5034 back = dkct_gui_set_bitmap_focus(gui, pv);
5035 } break;
5036 case 40: {
5037 back = dkct_gui_set_bitmap_hover(gui, pv);
5038 } break;
5039 case 41: {
5040 back = dkct_gui_set_gauge_style(gui, pv);
5041 } break;
5042 case 42: case 44: {
5043 back = dkct_gui_set_menu_item_style(gui, pv);
5044 } break;
5045 case 43: {
5046 back = dkct_gui_set_toolbar_style(gui, pv);
5047 } break;
5048 case 45: {
5049 back = dkct_gui_set_icon(gui, pv);
5050 } break;
5051 case 46: {
5052 back = dkct_add_grid_head(gui, pv, 1);
5053 } break;
5054 case 47: {
5055 back = dkct_add_grid_head(gui, pv, 0);
5056 } break;
5057 case 48: {
5058 back = dkct_set_table_for_grid(gui, pv);
5059 } break;
5060 case 49: {
5061 back = dkct_set_minimum_size(gui, pv);
5062 } break;
5063 case 50: {
5064 back = dkct_add_growable_row(gui, pv);
5065 } break;
5066 case 51: {
5067 back = dkct_add_growable_column(gui, pv);
5068 } break;
5069 case 52: {
5070 back = dkct_set_complete_constructor_specified(gui, pv);
5071 } break;
5072 case 53: {
5073 back = dkct_add_grid_cell_data(gui, pv);
5074 } break;
5075 case 54: {
5076 back = dkct_set_grid_style(gui, pv);
5077 } break;
5078 case 55: {
5079 back = dkct_set_tooltip_flag(gui, pv);
5080 } break;
5081 default: {
5082 /* ERROR: Syntax */
5083 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
5084 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 10, 11, il);
5085 } break;
5086 }
5087 if(action >= 0) {
5088 if(!(back)) {
5089 if(!((gui->psrc)->ec)) {
5090 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
5091 /* ERROR: Syntax */
5092 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 33);
5093 }
5094 }
5095 }
5096 } else {
5097 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
5098 /* ERROR: Syntax */
5099 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 9);
5100 }
5101 } else {
5102 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
5103 /* ERROR: Syntax */
5104 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 9);
5105 }
5106 }
5107
5108 return back;
5109 }
5110
5111
5112
5113 /** Process one input line containing an option.
5114 @param gui GUI description.
5115 @param il Input line to process.
5116 @return 1 on success, 0 on error.
5117 */
5118 static
5119 int
dkct_gui_process_option(DKCT_GUI * gui,char * il)5120 dkct_gui_process_option(DKCT_GUI *gui, char *il)
5121 {
5122 int back = 1;
5123 char *pv; /* Attribute value. */
5124 char *p1; /* Current string to process. */
5125 char *p2; /* Next string to process. */
5126
5127 if(gui->c_el) {
5128 pv = dk3str_c8_chr(il, '=');
5129 if(pv) {
5130 *(pv++) = '\0';
5131 pv = dk3str_c8_start(pv, NULL);
5132 if(pv) {
5133 dk3str_c8_normalize(il, NULL, '-');
5134 switch(dk3str_c8_array_index(dkct_gui_option_keys, il, 0)) {
5135 case 0: {
5136 gui->align = 0x00;
5137 p1 = dk3str_c8_start(pv, NULL);
5138 while(p1) {
5139 p2 = dk3str_c8_next(p1, NULL);
5140 gui->align = dkct_gui_apply_align(gui, gui->align, p1);
5141 p1 = p2;
5142 }
5143 } break;
5144 default: {
5145 /* ERROR: Unknown option "..."! */
5146 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 10, 11, il);
5147 } break;
5148 }
5149 } else {
5150 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
5151 /* ERROR: Syntax */
5152 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 9);
5153 }
5154 } else {
5155 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
5156 /* ERROR: Syntax */
5157 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 9);
5158 }
5159 }
5160
5161 return back;
5162 }
5163
5164
5165
5166 /** Add one input file line to GUI description.
5167 @param gui GUI description.
5168 @param il Input line to process.
5169 @return 1 on success, 0 on error.
5170 */
5171 int
dkct_gui_add_line(DKCT_GUI * gui,char * il)5172 dkct_gui_add_line(DKCT_GUI *gui, char *il)
5173 {
5174 int back = 1;
5175 char *p1; /* Start of input line. */
5176
5177 p1 = dk3str_c8_start(il, NULL);
5178 if(p1) {
5179 switch(*p1) {
5180 case '#': {
5181 back = 1;
5182 } break;
5183 case '.': {
5184 p1++;
5185 p1 = dk3str_c8_start(p1, NULL);
5186 if(p1) {
5187 back = dkct_gui_process_option(gui, p1);
5188 } else {
5189 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
5190 /* ERROR: Syntax */
5191 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 9);
5192 }
5193 } break;
5194 case '[': {
5195 p1++;
5196 p1 = dk3str_c8_start(p1, NULL);
5197 if(p1) {
5198 back = dkct_gui_start_new_object_definition(gui, p1);
5199 } else {
5200 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
5201 /* ERROR: Syntax */
5202 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 37);
5203 }
5204 } break;
5205 default: {
5206 back = dkct_gui_process_object_line(gui, p1);
5207 } break;
5208 }
5209 }
5210
5211 return back;
5212 }
5213
5214
5215
5216 /** Get number of content elements.
5217 @param el Element to check.
5218 @return Number of content elements.
5219 */
5220 static
5221 size_t
dkct_gui_get_number_contents(DKCT_GUI_ELEMENT * el)5222 dkct_gui_get_number_contents(DKCT_GUI_ELEMENT *el)
5223 {
5224 size_t back = 0;
5225 dk3sto_it_reset(el->i_contents);
5226 while(dk3sto_it_next(el->i_contents)) { back++; }
5227 dk3sto_it_reset(el->i_contents);
5228 return back;
5229 }
5230
5231
5232
5233 /** Report illegal child.
5234 @param co Current object.
5235 @param dp Direct parent.
5236 @param psrc Source structure.
5237 */
5238 static
5239 void
dkct_gui_report_illegal_parent_child(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * dp,DKCT_SRC * psrc)5240 dkct_gui_report_illegal_parent_child(
5241 DKCT_GUI_ELEMENT *co,
5242 DKCT_GUI_ELEMENT *dp,
5243 DKCT_SRC *psrc
5244 )
5245 {
5246 char const *cname;
5247 char const *pname;
5248
5249 cname = pname = dkct_gui_out_kw[197];
5250 if(co) {
5251 if(co->cln >= 0) {
5252 cname = dkct_gui_class_names[co->cln];
5253 }
5254 }
5255 if(dp) {
5256 if(dp->cln >= 0) {
5257 pname = dkct_gui_class_names[dp->cln];
5258 }
5259 }
5260 dkct_to_log_5(psrc, 1, DK3_LL_ERROR, 88, 89, 90, pname, cname);
5261
5262 }
5263
5264
5265
5266 static
5267 int
dkct_gui_is_stock_element(DKCT_GUI_ELEMENT * el)5268 dkct_gui_is_stock_element(DKCT_GUI_ELEMENT *el)
5269 {
5270 int back = 0;
5271
5272 if ((15 == el->cln) || (37 == el->cln)) {
5273 if (NULL != el->idname) {
5274 if (0 < dk3str_c8_array_index(dkct_gui_stock_item_names, el->idname, 1)) {
5275 back = 1;
5276 }
5277 }
5278 }
5279
5280 return back;
5281 }
5282
5283
5284
5285 /** Check GUI element setup.
5286 @param el Element to check.
5287 @param psrc Source structure.
5288 @return 1 on success (element setup ok), 0 on error.
5289 */
5290 static
5291 int
dkct_gui_element_check(DKCT_GUI_ELEMENT * el,DKCT_SRC * psrc)5292 dkct_gui_element_check(DKCT_GUI_ELEMENT *el, DKCT_SRC *psrc)
5293 {
5294 size_t nco; /* Number of contents elements. */
5295 DKCT_GUI_ELEMENT *dp; /* Direct parent. */
5296 DKCT_GUI_ELEMENT *sizer = NULL; /* Sizer. */
5297 int back = 1;
5298 int szfound = 0; /* Flag: Sizer found. */
5299
5300 dp = (DKCT_GUI_ELEMENT *)(el->parent);
5301 psrc->lineno = ((el->lndef) > 0UL) ? (el->lndef) : (el->lndecl);
5302 dk3app_set_source_line(psrc->app, psrc->lineno);
5303 /*
5304 Check contents.
5305 */
5306 switch(el->cln) {
5307 case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
5308 case 9: case 10: case 11: case 12: case 13: case 14: case 35: case 36:
5309 case 38:
5310 case 42: case 43: case 44: case 45: case 46: case 47: /* 2018-05-29 */
5311 {
5312 back = 0;
5313 nco = dkct_gui_get_number_contents(el);
5314 if(nco > 0) {
5315 if(el->cln == 14) {
5316 if(nco == 2) {
5317 back = 1;
5318 } else {
5319 /* ERROR: Splitter window must have exactly 2 children! */
5320 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 47);
5321 }
5322 } else {
5323 back = 1;
5324 }
5325 } else {
5326 /* ERROR: Missing contents! */
5327 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 48);
5328 }
5329 if(!(back)) {
5330 }
5331 } break;
5332 }
5333 /*
5334 Text.
5335 */
5336 if(back) {
5337 switch(el->cln) {
5338 case 15: case 19: case 23: case 25: case 28: case 29:
5339 case 31: case 36: case 37: case 40:
5340 {
5341 if(!(el->text)) {
5342 if(((el->cln != 37) && (el->cln != 40))
5343 || (el->menuItemStyle != DKCT_GUI_MENU_ITEM_SEPARATOR)
5344 )
5345 {
5346 if((el->cln == 28) || (0 != dkct_gui_is_stock_element(el))) {
5347 /* Info: Missing text! */
5348
5349 #if 0
5350 /* 2018-05-28 Removed
5351 Do not issue message about wxTextCtrl, wxMenuItem, wxButton
5352 without text.
5353 For wxTextCtrl the field is empty, user should type text.
5354 For wxMenuItem and wxButton create stock objects if
5355 no text present.
5356 */
5357 dkct_to_log_1(psrc, 1, DK3_LL_INFO, 49);
5358 #endif
5359 } else {
5360 back = 0;
5361 /* ERROR: Missing text! */
5362
5363 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 49);
5364 }
5365 }
5366 }
5367 } break;
5368 }
5369 }
5370 /*
5371 ID.
5372 */
5373 if(back) {
5374 switch(el->cln) {
5375 case 15: case 16: case 23: case 25: case 29: case 37: case 40:
5376 {
5377 if(!(el->idname)) {
5378 back = 0;
5379 /* ERROR: Missing ID! */
5380 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 46);
5381 }
5382 } break;
5383 }
5384 }
5385 /*
5386 Grid.
5387 */
5388 if(back) {
5389 switch(el->cln) {
5390 case 6: case 8: {
5391 if(el->gridcolumns == 0) {
5392 back = 0;
5393 /* ERROR: Missing grid! */
5394 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 50);
5395 }
5396 } break;
5397 }
5398 }
5399 /*
5400 Bitmap.
5401 */
5402 if(back) {
5403 switch(el->cln) {
5404 case 16: /* wxBitmapButton */
5405 case 40: /* wxToolBarToolBase */
5406 {
5407 if(!(el->bitmapVarName)) {
5408 if((el->cln != 40)
5409 || (el->menuItemStyle != DKCT_GUI_MENU_ITEM_SEPARATOR)
5410 )
5411 {
5412 back = 0;
5413 /* ERROR: Missing bitmap! */
5414 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 51);
5415 }
5416 }
5417 } break;
5418 }
5419 }
5420 /*
5421 Choices.
5422 */
5423 if(back) {
5424 switch(el->cln) {
5425 case 17: case 18: case 20: case 21: {
5426 if((!(el->choices)) || (el->nChoices == 0)) {
5427 back = 0;
5428 /* ERROR: Missing choices! */
5429 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 52);
5430 }
5431 } break;
5432 }
5433 }
5434 /*
5435 Size.
5436 */
5437 if(back) {
5438 switch(el->cln) {
5439 /*
5440 2018-05-29 Removed case 12 branch
5441 Requiring a size is not necessary for a wxNotebook.
5442 */
5443 case 13: case 47: case 28: {
5444 if(!((el->sizex > 0) && (el->sizey > 0))) {
5445 if(el->cln == 28) {
5446 /*
5447 Warning: Missing size.
5448 Not for single-line text with given text.
5449 */
5450 if(((el->textStyle) & DKCT_GUI_TEXT_MULTILINE) || (!(el->text))) {
5451 dkct_to_log_1(psrc, 1, DK3_LL_WARNING, 53);
5452 }
5453 } else {
5454 back = 0;
5455 /* ERROR: Missing size! */
5456 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 53);
5457 }
5458 }
5459 } break;
5460 }
5461 }
5462 /*
5463 Rows or columns for radio box.
5464 */
5465 if(back) {
5466 switch(el->cln) {
5467 case 22: {
5468 if(el->maxRowsCols < 1) {
5469 back = 0;
5470 /* ERROR: Missing rows or columns maximum! */
5471 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 54);
5472 }
5473 } break;
5474 }
5475 }
5476 /*
5477 Parent/child relationships
5478 */
5479 switch(el->cln) {
5480 case 40: { /* wxToolBarToolBase */
5481 if(dp) {
5482 if(dp->cln == 38) {
5483 if(dp->name) {
5484 } else {
5485 back = 0;
5486 /* ERROR: Missing name for parent */
5487 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 91);
5488 }
5489 } else {
5490 back = 0;
5491 /* ERROR: Illegal parent/child combination. */
5492 dkct_gui_report_illegal_parent_child(el, dp, psrc);
5493 }
5494 } else {
5495 back = 0;
5496 /* ERROR: No parent. */
5497 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 92);
5498 }
5499 } break;
5500 case 37: { /* wxMenuItem */
5501 if(dp) {
5502 if(dp->cln == 36) {
5503 if(dp->name) {
5504 } else {
5505 back = 0;
5506 /* ERROR: Missing name for parent */
5507 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 91);
5508 }
5509 } else {
5510 back = 0;
5511 /* ERROR: Illegal parent/child combination. */
5512 dkct_gui_report_illegal_parent_child(el, dp, psrc);
5513 }
5514 } else {
5515 back = 0;
5516 /* ERROR: No parent */
5517 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 92);
5518 }
5519 } break;
5520 case 36: { /* wxMenu */
5521 if(dp) {
5522 if((dp->cln == 35) || (dp->cln == 36)) {
5523 } else {
5524 /* ERROR: Illegal parent/child combination. */
5525 dkct_gui_report_illegal_parent_child(el, dp, psrc);
5526 }
5527 } else {
5528 back = 0;
5529 /* ERROR: No parent */
5530 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 92);
5531 }
5532 } break;
5533 }
5534 /*
5535 Root element must have a sizer as the only content.
5536 */
5537 if((el->number == 0) && (!(el->parent))) {
5538 sizer = NULL; szfound = 0;
5539 if(dkct_gui_get_number_contents(el) == 1) {
5540 dk3sto_it_reset(el->i_contents);
5541 sizer = (DKCT_GUI_ELEMENT *)dk3sto_it_next(el->i_contents);
5542 if(sizer) {
5543 switch(sizer->cln) {
5544 case 5: case 6: case 7: case 8: case 9: case 10: {
5545 szfound = 1;
5546 } break;
5547 }
5548 }
5549 }
5550 if(!(szfound)) {
5551 back = 0;
5552 /* ERROR: Root element must have one sizer as contents */
5553 dkct_to_log_1(psrc, 1, DK3_LL_ERROR, 97);
5554 }
5555 }
5556 return back;
5557 }
5558
5559
5560
5561 /** Check whether each object has a class name.
5562 @param psrc Source structure.
5563 @return 1 on success, 0 on error.
5564 */
5565 static
5566 int
dkct_gui_classnames_check(DKCT_SRC * psrc)5567 dkct_gui_classnames_check(DKCT_SRC *psrc)
5568 {
5569 DKCT_GUI *gui; /* GUI description. */
5570 DKCT_GUI_ELEMENT *el; /* Current element to check. */
5571 int back = 1;
5572
5573 if(psrc->gui) {
5574 gui = (DKCT_GUI *)(psrc->gui);
5575 dk3sto_it_reset(gui->i_el_by_num);
5576 while((el = (DKCT_GUI_ELEMENT *)dk3sto_it_next(gui->i_el_by_num)) != NULL) {
5577 psrc->lineno = ((el->lndef) > 0UL) ? (el->lndef) : (el->lndecl);
5578 dk3app_set_source_line(psrc->app, psrc->lineno);
5579 if(el->number != 0) {
5580 if(el->pseudoobj == 0) {
5581 if(!(el->name)) {
5582 back = 0;
5583 /* ERROR: Missing object name! */
5584 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 58);
5585 }
5586 if(!(el->cname)) {
5587 back = 0;
5588 /* ERROR: Missing object class name! */
5589 if(el->name) {
5590 dkct_to_log_3(gui->psrc, 1, DK3_LL_ERROR, 93, 94, el->name);
5591 } else {
5592 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 78);
5593 }
5594 }
5595 }
5596 }
5597 if(!dkct_gui_element_check(el, psrc)) {
5598 back = 0;
5599 psrc->ec = DK3_ERROR_SYNTAX;
5600 }
5601 }
5602 }
5603 return back;
5604 }
5605
5606
5607
5608 /** Check for circular dependencies.
5609 @param psrc Source structure.
5610 @return 1 on success (no circular dependencies), 0 on error.
5611 */
5612 static
5613 int
dkct_gui_dependency_check(DKCT_SRC * psrc)5614 dkct_gui_dependency_check(DKCT_SRC *psrc)
5615 {
5616 int back = 0;
5617 dk3_bm_t *bm; /* Dependency matrix. */
5618 DKCT_GUI *gui; /* GUI description. */
5619 DKCT_GUI_ELEMENT *gel; /* Element to check. */
5620 DKCT_GUI_ELEMENT *pp; /* Parent element. */
5621 DKCT_GUI_ELEMENT *pm; /* Menu bar/contents element. */
5622 DKCT_GUI_ELEMENT *pt; /* Toolbar element. */
5623 size_t i; /* Current index to check. */
5624
5625 if(psrc->gui) {
5626 gui = (DKCT_GUI *)(psrc->gui);
5627 bm = dk3bm_open(gui->no, gui->no, psrc->app);
5628 if(bm) {
5629 back = 1;
5630 dk3sto_it_reset(gui->i_el_by_name);
5631 while(
5632 (gel = (DKCT_GUI_ELEMENT *)dk3sto_it_next(gui->i_el_by_name))
5633 != NULL
5634 )
5635 {
5636
5637 psrc->lineno = ((gel->lndef) > 0UL) ? (gel->lndef) : (gel->lndecl);
5638 dk3app_set_source_line(psrc->app, psrc->lineno);
5639 pp = pm = pt = NULL;
5640 if(gel->parent) { pp = (DKCT_GUI_ELEMENT *)(gel->parent); }
5641 if(gel->menubar) { pm = (DKCT_GUI_ELEMENT *)(gel->menubar); }
5642 if(gel->toolbar) { pt = (DKCT_GUI_ELEMENT *)(gel->toolbar); }
5643 if(pp) {
5644 dk3bm_set(bm, pp->number, gel->number, 1);
5645 }
5646 if(pm) {
5647 dk3bm_set(bm, gel->number, pm->number, 1);
5648 }
5649 if(pt) {
5650 dk3bm_set(bm, gel->number, pt->number, 1);
5651 }
5652 dk3sto_it_reset(gel->i_contents);
5653 while(
5654 (pm = (DKCT_GUI_ELEMENT *)dk3sto_it_next(gel->i_contents))
5655 != NULL
5656 )
5657 {
5658 dk3bm_set(bm, gel->number, pm->number, 1);
5659 }
5660 }
5661 dk3bm_expand(bm);
5662 for(i = 0; i < gui->no; i++) {
5663 if(dk3bm_get(bm, i, i)) {
5664 psrc->lineno = 0UL;
5665 dk3app_set_source_line(psrc->app, 0UL);
5666 /* ERROR: Dependency loop */
5667 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 79);
5668 back = 0;
5669 }
5670 }
5671 dk3bm_close(bm);
5672 }
5673 }
5674 return back;
5675 }
5676
5677
5678
5679 int
dkct_gui_check(DKCT_SRC * psrc)5680 dkct_gui_check(DKCT_SRC *psrc)
5681 {
5682 int back = 0;
5683
5684 if(dkct_gui_classnames_check(psrc)) {
5685 if(dkct_gui_dependency_check(psrc)) {
5686 back = 1;
5687 }
5688 }
5689 return back;
5690 }
5691
5692
5693
5694 /** Check whether we need a wxPanel in the root object.
5695 @param gui GUI description.
5696 @return 1 for wxPanel needed (frame), 0 for not needed (wxDialog).
5697 */
5698 static
5699 int
dkct_gui_need_contents_panel(DKCT_GUI * gui)5700 dkct_gui_need_contents_panel(DKCT_GUI *gui)
5701 {
5702 int back = 1;
5703 if(gui->r_el) {
5704 if((gui->r_el)->cln == 1) {
5705 back = 0;
5706 }
5707 }
5708 return back;
5709 }
5710
5711
5712
5713 /** Decide whether or not to write a class member and a
5714 constructor method.
5715 @param co Current object.
5716 @return 1 to write a constructor, 0 for no constructor.
5717 */
5718 static
5719 int
dkct_gui_need_element_constructor(DKCT_GUI_ELEMENT * co)5720 dkct_gui_need_element_constructor(
5721 DKCT_GUI_ELEMENT *co
5722 #if 0
5723 DKCT_GUI_ELEMENT *dp,
5724 DKCT_GUI_ELEMENT *pw,
5725 DKCT_SRC *psrc,
5726 DKCT_GUI *gui
5727 #endif
5728 )
5729 {
5730 int back = 1;
5731 switch(co->cln) {
5732 case 37: /* wxMenuItem */
5733 case 40: /* wxToolBarTool */
5734 {
5735 if(co->menuItemStyle == DKCT_GUI_MENU_ITEM_SEPARATOR) {
5736 back = 0;
5737 }
5738 } break;
5739 }
5740 return back;
5741 }
5742
5743
5744
5745 void
dkct_gui_class_variables(DKCT_SRC * psrc)5746 dkct_gui_class_variables(DKCT_SRC *psrc)
5747 {
5748 DKCT_GUI *gui; /* GUI description. */
5749 DKCT_GUI_ELEMENT *el; /* Current element to check. */
5750 if(psrc->gui) {
5751 gui = (DKCT_GUI *)(psrc->gui);
5752 dk3sto_it_reset(gui->i_el_by_num);
5753 fputs(dkct_gui_out_kw[7], psrc->fipo);
5754 if(dkct_gui_need_contents_panel(gui)) {
5755 fputs(dkct_gui_out_kw[17], psrc->fipo);
5756 }
5757 while((el = (DKCT_GUI_ELEMENT *)dk3sto_it_next(gui->i_el_by_num)) != NULL) {
5758 if(el->number != 0) {
5759 if(el->pseudoobj == 0) {
5760 if(dkct_gui_need_element_constructor(el)) {
5761 if((el->name) && (el->cname)) {
5762 fputs(dkct_gui_out_kw[5], psrc->fipo);
5763 fputs(el->name, psrc->fipo);
5764 fputs(dkct_gui_out_kw[6], psrc->fipo);
5765 if((psrc->dkcto).lnn) {
5766 psrc->lineno = el->lndef;
5767 dkct_tr_show_source_line(psrc, 0);
5768 }
5769 fputs(dkct_gui_out_kw[2], psrc->fipo);
5770 fputs(el->cname, psrc->fipo);
5771 fputs(dkct_gui_out_kw[1], psrc->fipo);
5772 fputs(dkct_gui_out_kw[3], psrc->fipo);
5773 fputs(el->name, psrc->fipo);
5774 fputs(dkct_gui_out_kw[4], psrc->fipo);
5775 fputs(dkct_gui_out_kw[0], psrc->fipo);
5776 fputs(dkct_gui_out_kw[0], psrc->fipo);
5777 }
5778 }
5779 }
5780 }
5781 }
5782 /*
5783 Write line number.
5784 */
5785 }
5786 }
5787
5788
5789
5790 /** Check whether an object is a sizer.
5791 @param gel Object to check.
5792 @return 1 for sizer, 0 for non-sizer object.
5793 */
5794 static
5795 int
dkct_gui_is_sizer(DKCT_GUI_ELEMENT * gel)5796 dkct_gui_is_sizer(DKCT_GUI_ELEMENT *gel)
5797 {
5798 int back = 0;
5799 if(gel) {
5800 if(gel->cln < 11) {
5801 if(gel->cln > 4) {
5802 back = 1;
5803 }
5804 }
5805 }
5806 return back;
5807 }
5808
5809
5810
5811 /** Find parent window object.
5812 @param startelem Direct parent of object.
5813 @return Parent representing a non-sizer object or NULL.
5814 */
5815 static
5816 DKCT_GUI_ELEMENT *
dkct_gui_find_real_parent(DKCT_GUI_ELEMENT * startelem)5817 dkct_gui_find_real_parent(DKCT_GUI_ELEMENT *startelem)
5818 {
5819 DKCT_GUI_ELEMENT *back = NULL;
5820 DKCT_GUI_ELEMENT *c; /* Element to check. */
5821 c = startelem;
5822 while((!(back)) && (c)) {
5823 if(dkct_gui_is_sizer(c)) {
5824 c = (DKCT_GUI_ELEMENT *)(c->parent);
5825 } else {
5826 back = c;
5827 }
5828 }
5829 return back;
5830 }
5831
5832
5833
5834 /** Write flags to add object to sizer.
5835 @param fipo Output file.
5836 @param co Current object.
5837 */
5838 static
5839 void
dkct_gui_write_flags(FILE * fipo,DKCT_GUI_ELEMENT * co)5840 dkct_gui_write_flags(FILE *fipo, DKCT_GUI_ELEMENT *co)
5841 {
5842 int found = 0; /* Flag: Already found. */
5843
5844 if((co->border >= 0) && (co->borderPos)) {
5845 if(co->borderPos == DKCT_GUI_BORDER_POSITION_ALL) {
5846 fputs(dkct_gui_out_kw[39], fipo);
5847 found = 1;
5848 } else {
5849 if((co->borderPos) & DKCT_GUI_BORDER_POSITION_TOP) {
5850 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5851 found = 1;
5852 fputs(dkct_gui_out_kw[40], fipo);
5853 }
5854 if((co->borderPos) & DKCT_GUI_BORDER_POSITION_LEFT) {
5855 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5856 found = 1;
5857 fputs(dkct_gui_out_kw[41], fipo);
5858 }
5859 if((co->borderPos) & DKCT_GUI_BORDER_POSITION_RIGHT) {
5860 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5861 found = 1;
5862 fputs(dkct_gui_out_kw[42], fipo);
5863 }
5864 if((co->borderPos) & DKCT_GUI_BORDER_POSITION_BOTTOM) {
5865 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5866 found = 1;
5867 fputs(dkct_gui_out_kw[43], fipo);
5868 }
5869 }
5870 }
5871 if((co->align) & DKCT_GUI_ALIGN_H_MASK) {
5872 switch((co->align) & DKCT_GUI_ALIGN_H_MASK) {
5873 case DKCT_GUI_ALIGN_H_LEFT: {
5874 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5875 found = 1;
5876 fputs(dkct_gui_out_kw[45], fipo);
5877 } break;
5878 case DKCT_GUI_ALIGN_H_CENTER: {
5879 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5880 found = 1;
5881 fputs(dkct_gui_out_kw[46], fipo);
5882 } break;
5883 case DKCT_GUI_ALIGN_H_RIGHT: {
5884 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5885 found = 1;
5886 fputs(dkct_gui_out_kw[47], fipo);
5887 } break;
5888 }
5889 }
5890 if((co->align) & DKCT_GUI_ALIGN_V_MASK) {
5891 switch((co->align) & DKCT_GUI_ALIGN_V_MASK) {
5892 case DKCT_GUI_ALIGN_V_TOP: {
5893 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5894 found = 1;
5895 fputs(dkct_gui_out_kw[48], fipo);
5896 } break;
5897 case DKCT_GUI_ALIGN_V_CENTER: {
5898 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5899 found = 1;
5900 fputs(dkct_gui_out_kw[49], fipo);
5901 } break;
5902 case DKCT_GUI_ALIGN_V_BOTTOM: {
5903 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5904 found = 1;
5905 fputs(dkct_gui_out_kw[50], fipo);
5906 } break;
5907 }
5908 }
5909 if(co->expandFlag) {
5910 if(found) { fputs(dkct_gui_out_kw[44], fipo); }
5911 found = 1;
5912 fputs(dkct_gui_out_kw[51], fipo);
5913 }
5914 if(!(found)) {
5915 fputs(dkct_gui_out_kw[52], fipo);
5916 }
5917 }
5918
5919
5920
5921 /** Check whether we need to write commands for flags.
5922 @param co Current object.
5923 @return 1 to configure flags, 0 to skip.
5924 */
5925 static
5926 int
dkct_gui_need_flags(DKCT_GUI_ELEMENT * co)5927 dkct_gui_need_flags(DKCT_GUI_ELEMENT *co)
5928 {
5929 int back = 0;
5930 if((co->border >= 0) && (co->borderPos)) {
5931 back = 0;
5932 }
5933 if((co->borderPos) & DKCT_GUI_BORDER_POSITION_TOP) {
5934 back = 1;
5935 }
5936 if((co->borderPos) & DKCT_GUI_BORDER_POSITION_LEFT) {
5937 back = 1;
5938 }
5939 if((co->borderPos) & DKCT_GUI_BORDER_POSITION_RIGHT) {
5940 back = 1;
5941 }
5942 if((co->borderPos) & DKCT_GUI_BORDER_POSITION_BOTTOM) {
5943 back = 1;
5944 }
5945 if((co->align) & DKCT_GUI_ALIGN_H_MASK) {
5946 back = 1;
5947 }
5948 if((co->align) & DKCT_GUI_ALIGN_V_MASK) {
5949 back = 1;
5950 }
5951 if(co->expandFlag) {
5952 back = 1;
5953 }
5954 return back;
5955 }
5956
5957
5958
5959 /** Write border for object.
5960 @param fipo Output file.
5961 @param co Current object.
5962 */
5963 static
5964 void
dkct_gui_write_border(FILE * fipo,DKCT_GUI_ELEMENT * co)5965 dkct_gui_write_border(FILE *fipo, DKCT_GUI_ELEMENT *co)
5966 {
5967 int b = 0; /* Border size. */
5968 char bu[32]; /* Buffer for integer variables. */
5969
5970 if((co->border >= 0) && (co->borderPos)) {
5971 b = co->border;
5972 }
5973 sprintf(bu, "%d", b);
5974 fputs(bu, fipo);
5975 }
5976
5977
5978
5979 /** Write growable rows and columns.
5980 @param co Current object.
5981 @param st Storage for growable rows/columns.
5982 @param it Iterator for growable rows/columns.
5983 @param rowcol Flag: Row=0 or column=1.
5984 @param psrc Source structure.
5985 */
5986 static
5987 void
dkct_write_growable_rows_cols(DKCT_GUI_ELEMENT * co,dk3_sto_t * st,dk3_sto_it_t * it,int rowcol,DKCT_SRC * psrc)5988 dkct_write_growable_rows_cols(
5989 DKCT_GUI_ELEMENT *co,
5990 dk3_sto_t *st,
5991 dk3_sto_it_t *it,
5992 int rowcol,
5993 DKCT_SRC *psrc
5994 )
5995 {
5996 int *ip;
5997 if((st) && (it)) {
5998 dk3sto_it_reset(it);
5999 while(NULL != (ip = (int *)dk3sto_it_next(it))) {
6000 fputs(dkct_gui_out_kw[8], psrc->fipo);
6001 fputs(co->name, psrc->fipo);
6002 fputs(dkct_gui_out_kw[(rowcol) ? 206 : 207], psrc->fipo);
6003 fprintf(psrc->fipo, "%d", *ip);
6004 fputs(dkct_gui_out_kw[24], psrc->fipo);
6005 fputs(dkct_gui_out_kw[0], psrc->fipo);
6006 }
6007 }
6008 }
6009
6010
6011
6012 /** Add one object to the parent which is a sizer.
6013 @param co Current object.
6014 @param pa Parent (a sizer object).
6015 @param psrc Source structure.
6016 @param gui GUI description.
6017 */
6018 static
6019 void
dkct_gui_add_object_to_sizer(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * pa,DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))6020 dkct_gui_add_object_to_sizer(
6021 DKCT_GUI_ELEMENT *co,
6022 DKCT_GUI_ELEMENT *pa,
6023 DKCT_SRC *psrc,
6024 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
6025 )
6026 {
6027 char bu[64]; /* Buffer for integer values. */
6028 int det = 0; /* Details to use. */
6029
6030 DK3_UNUSED_ARG(gui)
6031 /*
6032 Last modifications to object before adding it to parent.
6033 */
6034 switch(co->cln) {
6035 case 7: {
6036 /* Growable rows and columns for wxGridBagSizer */
6037 dkct_write_growable_rows_cols(co, co->sGrowRow, co->iGrowRow, 0, psrc);
6038 dkct_write_growable_rows_cols(co, co->sGrowCol, co->iGrowCol, 1, psrc);
6039 } break;
6040 }
6041 /*
6042 Add object to parent.
6043 */
6044 switch(pa->cln) {
6045 case 7: {
6046 /* sizer */
6047 if(dkct_gui_need_flags(co)) {
6048 det = 1;
6049 }
6050 if((co->border >= 0) && (co->borderPos)) {
6051 det = 2;
6052 }
6053 fputs(dkct_gui_out_kw[8], psrc->fipo);
6054 fputs(pa->name, psrc->fipo);
6055 /* -> */
6056 fputs(dkct_gui_out_kw[31], psrc->fipo);
6057 /* Add( */
6058 fputs(dkct_gui_out_kw[36], psrc->fipo);
6059 /* object */
6060 fputs(dkct_gui_out_kw[2], psrc->fipo);
6061 fputs(co->name, psrc->fipo);
6062 /* , */
6063 fputs(dkct_gui_out_kw[38], psrc->fipo);
6064 /* wxGBPosition */
6065 fputs(dkct_gui_out_kw[2], psrc->fipo);
6066 fputs(dkct_gui_out_kw[53], psrc->fipo);
6067 sprintf(bu, "%d", co->posy);
6068 fputs(bu, psrc->fipo);
6069 fputs(dkct_gui_out_kw[55], psrc->fipo);
6070 sprintf(bu, "%d", co->posx);
6071 fputs(bu, psrc->fipo);
6072 fputs(dkct_gui_out_kw[56], psrc->fipo);
6073 /* , */
6074 fputs(dkct_gui_out_kw[38], psrc->fipo);
6075 /* wxGBSpan */
6076 fputs(dkct_gui_out_kw[2], psrc->fipo);
6077 fputs(dkct_gui_out_kw[54], psrc->fipo);
6078 sprintf(bu, "%d", co->spany);
6079 fputs(bu, psrc->fipo);
6080 fputs(dkct_gui_out_kw[55], psrc->fipo);
6081 sprintf(bu, "%d", co->spanx);
6082 fputs(bu, psrc->fipo);
6083 fputs(dkct_gui_out_kw[56], psrc->fipo);
6084 #if 0
6085 /* , */
6086 fputs(dkct_gui_out_kw[38], psrc->fipo);
6087 /*
6088 Proportion not printed for wxGridBagSizer elements.
6089 */
6090 /* proportion */
6091 fputs(dkct_gui_out_kw[2], psrc->fipo);
6092 sprintf(bu, "%d", ((co->proportion >= 0) ? (co->proportion) : 0));
6093 fputs(bu, psrc->fipo);
6094 #endif
6095 if(det) {
6096 /* , */
6097 fputs(dkct_gui_out_kw[38], psrc->fipo);
6098 /* flags */
6099 fputs(dkct_gui_out_kw[2], psrc->fipo);
6100 dkct_gui_write_flags(psrc->fipo, co);
6101 if(det > 1) {
6102 /* , */
6103 fputs(dkct_gui_out_kw[38], psrc->fipo);
6104 /* border */
6105 fputs(dkct_gui_out_kw[2], psrc->fipo);
6106 dkct_gui_write_border(psrc->fipo, co);
6107 }
6108 }
6109 /* ); */
6110 fputs(dkct_gui_out_kw[0], psrc->fipo);
6111 fputs(dkct_gui_out_kw[37], psrc->fipo);
6112 } break;
6113 case 5: case 6: case 8: case 9: case 10: {
6114 /*
6115 sizer->Add(object, proportion, flags, border);
6116 */
6117 /* sizer */
6118 if(co->proportion) {
6119 det = 1;
6120 }
6121 if(dkct_gui_need_flags(co)) {
6122 det = 2;
6123 }
6124 if((co->border >= 0) && (co->borderPos)) {
6125 det = 3;
6126 }
6127 fputs(dkct_gui_out_kw[8], psrc->fipo);
6128 fputs(pa->name, psrc->fipo);
6129 /* -> */
6130 fputs(dkct_gui_out_kw[31], psrc->fipo);
6131 /* Add( */
6132 switch(pa->cln) {
6133 /*
6134 wxStdButtonSizer.
6135 */
6136 case 10: {
6137 switch(co->cln) {
6138 case 15: case 16: { /* Buttons. */
6139 fputs(dkct_gui_out_kw[208], psrc->fipo);
6140 } break;
6141 default: { /* Other elements. */
6142 fputs(dkct_gui_out_kw[36], psrc->fipo);
6143 } break;
6144 }
6145 } break;
6146 /*
6147 All other containers and sizers.
6148 */
6149 default: {
6150 fputs(dkct_gui_out_kw[36], psrc->fipo);
6151 } break;
6152 }
6153 /* object */
6154 fputs(dkct_gui_out_kw[2], psrc->fipo);
6155 fputs(co->name, psrc->fipo);
6156 if(det) {
6157 /* , */
6158 fputs(dkct_gui_out_kw[38], psrc->fipo);
6159 /* proportion */
6160 fputs(dkct_gui_out_kw[2], psrc->fipo);
6161 sprintf(bu, "%d", ((co->proportion >= 0) ? (co->proportion) : 0));
6162 fputs(bu, psrc->fipo);
6163 if(det > 1) {
6164 /* , */
6165 fputs(dkct_gui_out_kw[38], psrc->fipo);
6166 /* flags */
6167 fputs(dkct_gui_out_kw[2], psrc->fipo);
6168 dkct_gui_write_flags(psrc->fipo, co);
6169 if(det > 2) {
6170 /* , */
6171 fputs(dkct_gui_out_kw[38], psrc->fipo);
6172 /* border */
6173 fputs(dkct_gui_out_kw[2], psrc->fipo);
6174 dkct_gui_write_border(psrc->fipo, co);
6175 }
6176 }
6177 }
6178 /* ); */
6179 fputs(dkct_gui_out_kw[0], psrc->fipo);
6180 fputs(dkct_gui_out_kw[37], psrc->fipo);
6181 } break;
6182 }
6183
6184 }
6185
6186
6187
6188 /** Use the current object as the parents sizer object.
6189 @param co Current object.
6190 @param pa Parent (a sizer object).
6191 @param psrc Source structure.
6192 @param gui GUI description.
6193 */
6194 static
6195 void
dkct_gui_set_parents_sizer(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * pa,DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))6196 dkct_gui_set_parents_sizer(
6197 DKCT_GUI_ELEMENT *co,
6198 DKCT_GUI_ELEMENT *pa,
6199 DKCT_SRC *psrc,
6200 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
6201 )
6202 {
6203 char const *pname = NULL; /* Parent object name. */
6204
6205 DK3_UNUSED_ARG(gui)
6206 if(pa) { pname = pa->name; }
6207 if(!(pname)) {
6208 if (pa) {
6209 if(pa->cln != 1) {
6210 pname = dkct_gui_out_kw[30];
6211 }
6212 } else {
6213 pname = dkct_gui_out_kw[30];
6214 }
6215 }
6216 fputs(dkct_gui_out_kw[8], psrc->fipo);
6217 if(pname) {
6218 fputs(pname, psrc->fipo);
6219 fputs(dkct_gui_out_kw[31], psrc->fipo);
6220 }
6221 fputs(dkct_gui_out_kw[32], psrc->fipo);
6222 fputs(co->name, psrc->fipo);
6223 fputs(dkct_gui_out_kw[24], psrc->fipo);
6224 fputs(dkct_gui_out_kw[0], psrc->fipo);
6225
6226 }
6227
6228
6229
6230 /** Write objects parents name.
6231 @param pw Parent object.
6232 @param psrc Source structure.
6233 @param gui GUI description.
6234 */
6235 static
6236 void
dkct_gui_write_parent_name(DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6237 dkct_gui_write_parent_name(
6238 DKCT_GUI_ELEMENT *pw,
6239 DKCT_SRC *psrc,
6240 DKCT_GUI *gui
6241 )
6242 {
6243 char *pname = NULL; /* Parent object name. */
6244
6245 if(pw) { pname = pw->name; }
6246 if(pname) {
6247 fputs(pname, psrc->fipo);
6248 } else {
6249 if(dkct_gui_need_contents_panel(gui)) {
6250 fputs(dkct_gui_out_kw[30], psrc->fipo);
6251 } else {
6252 fputs(dkct_gui_out_kw[65], psrc->fipo);
6253 }
6254 }
6255 }
6256
6257
6258
6259 /** Switch to next argument.
6260 @param psrc Source structure.
6261 */
6262 static
6263 void
dkct_gui_next_argument(DKCT_SRC * psrc)6264 dkct_gui_next_argument(DKCT_SRC *psrc)
6265 {
6266 fputs(dkct_gui_out_kw[38], psrc->fipo);
6267 fputs(dkct_gui_out_kw[2], psrc->fipo);
6268 }
6269
6270
6271
6272 /** Write ID attribute.
6273 @param co Current object.
6274 @param psrc Source structure.
6275 */
6276 static
6277 void
dkct_gui_write_idname(DKCT_GUI_ELEMENT * co,DKCT_SRC * psrc)6278 dkct_gui_write_idname(DKCT_GUI_ELEMENT *co, DKCT_SRC *psrc)
6279 {
6280 if(co->idname) {
6281 fputs(co->idname, psrc->fipo);
6282 } else {
6283 fputs(dkct_gui_out_kw[66], psrc->fipo);
6284 }
6285 }
6286
6287
6288
6289 /** Write size attribute.
6290 @param psrc Source structure.
6291 @param w Object width.
6292 @param h Object height.
6293 @param rec Flag: Size attribute recommended.
6294 @param co Current object.
6295 */
6296 static
6297 void
dkct_gui_write_size(DKCT_SRC * psrc,int w,int h,int rec,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (co))6298 dkct_gui_write_size(
6299 DKCT_SRC *psrc, int w, int h, int rec,
6300 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(co)
6301 )
6302 {
6303 char bu[256];
6304 DK3_UNUSED_ARG(co)
6305 if((w > 0) && (h > 0)) {
6306 sprintf(bu, "%d, %d", w, h);
6307 fputs(dkct_gui_out_kw[81], psrc->fipo);
6308 fputs(bu, psrc->fipo);
6309 fputs(dkct_gui_out_kw[56], psrc->fipo);
6310 } else {
6311 fputs(dkct_gui_out_kw[75], psrc->fipo);
6312 if(rec) {
6313 /* WARNING: Size not specified! */
6314 dkct_to_log_1(psrc, 1, DK3_LL_WARNING, 53);
6315 }
6316 }
6317 }
6318
6319
6320
6321 /** Write constructor arguments for wxFrame or wxDialog.
6322 */
6323 static
6324 void
dkct_gui_constructor_frame_dialog(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6325 dkct_gui_constructor_frame_dialog(
6326 DKCT_GUI_ELEMENT *co,
6327 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6328 DKCT_GUI_ELEMENT *pw,
6329 DKCT_SRC *psrc,
6330 DKCT_GUI *gui
6331 )
6332 {
6333 int det = 0; /* Details level. */
6334
6335 DK3_UNUSED_ARG(dp)
6336 if(co->text) det = 1;
6337 if((co->sizex > 0) && (co->sizey > 0)) det = 2;
6338 fputs(dkct_gui_out_kw[2], psrc->fipo);
6339 dkct_gui_write_parent_name(pw, psrc, gui);
6340 dkct_gui_next_argument(psrc);
6341 dkct_gui_write_idname(co, psrc);
6342 if(det) {
6343 dkct_gui_next_argument(psrc);
6344 if(co->text) {
6345 fputs(co->text, psrc->fipo);
6346 } else {
6347 fputs(dkct_gui_out_kw[73], psrc->fipo);
6348 }
6349 if(det > 1) {
6350 dkct_gui_next_argument(psrc);
6351 fputs(dkct_gui_out_kw[74], psrc->fipo);
6352 dkct_gui_next_argument(psrc);
6353 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
6354 }
6355 }
6356 fputs(dkct_gui_out_kw[0], psrc->fipo);
6357 }
6358
6359
6360
6361 /** Write constructor for box sizer.
6362 @param co Current object.
6363 @param dp Direct parent.
6364 @param pw Parent window object.
6365 @param psrc Source structure.
6366 @param gui GUI description.
6367 */
6368 static
6369 void
dkct_gui_constructor_boxsizer(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))6370 dkct_gui_constructor_boxsizer(
6371 DKCT_GUI_ELEMENT *co,
6372 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6373 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
6374 DKCT_SRC *psrc,
6375 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
6376 )
6377 {
6378 DK3_UNUSED_ARG(dp)
6379 DK3_UNUSED_ARG(pw)
6380 DK3_UNUSED_ARG(gui)
6381 fputs(dkct_gui_out_kw[2], psrc->fipo);
6382 switch(co->direction) {
6383 case DKCT_GUI_DIRECTION_VERTICAL: {
6384 fputs(dkct_gui_out_kw[35], psrc->fipo);
6385 } break;
6386 default: {
6387 fputs(dkct_gui_out_kw[34], psrc->fipo);
6388 } break;
6389 }
6390 fputs(dkct_gui_out_kw[0], psrc->fipo);
6391 }
6392
6393
6394
6395 #if 0
6396 /** Write constructor arguments for wxPanel.
6397 */
6398 static
6399 void
6400 dkct_gui_constructor_parent_and_id(
6401 DKCT_GUI_ELEMENT *co,
6402 DKCT_GUI_ELEMENT *dp,
6403 DKCT_GUI_ELEMENT *pw,
6404 DKCT_SRC *psrc,
6405 DKCT_GUI *gui
6406 )
6407 {
6408 fputs(dkct_gui_out_kw[2], psrc->fipo);
6409 dkct_gui_write_parent_name(pw, psrc, gui);
6410 dkct_gui_next_argument(psrc);
6411 dkct_gui_write_idname(co, psrc);
6412 fputs(dkct_gui_out_kw[0], psrc->fipo);
6413 }
6414 #endif
6415
6416
6417
6418 /** Write constructor for grid sizer.
6419 @param co Current object.
6420 @param dp Direct parent.
6421 @param pw Parent window object.
6422 @param psrc Source structure.
6423 @param gui GUI description.
6424 */
6425 static
6426 void
dkct_gui_constructor_gridsizer(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))6427 dkct_gui_constructor_gridsizer(
6428 DKCT_GUI_ELEMENT *co,
6429 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6430 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
6431 DKCT_SRC *psrc,
6432 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
6433 )
6434 {
6435 char bu[256]; /* Buffer for integer values. */
6436 int c = 0; /* Columns. */
6437 int r = 0; /* Rows. */
6438 int y = 0; /* Start row. */
6439 int x = 0; /* Start column. */
6440
6441 DK3_UNUSED_ARG(dp)
6442 DK3_UNUSED_ARG(pw)
6443 DK3_UNUSED_ARG(gui)
6444 c = co->gridcolumns;
6445 r = co->gridrows;
6446 x = co->gridgapx;
6447 y = co->gridgapy;
6448 bu[0] = '\0';
6449 fputs(dkct_gui_out_kw[2], psrc->fipo);
6450 if(r > 0) {
6451 if(x < 0) { x = 0; } if(y < 0) { y = 0; }
6452 sprintf(bu, "%d, %d, %d, %d", c, r, y, x);
6453 } else {
6454 if((x > -1) || (y > -1)) {
6455 if(x > -1) {
6456 sprintf(bu, "%d, %d, %d", c, ((y > -1) ? y : 0), ((x > -1) ? x : 0));
6457 } else {
6458 sprintf(bu, "%d, %d", c, y);
6459 }
6460 } else {
6461 sprintf(bu, "%d", c);
6462 }
6463 }
6464 fputs(bu, psrc->fipo);
6465 fputs(dkct_gui_out_kw[0], psrc->fipo);
6466 }
6467
6468
6469
6470 /** Write constructor for gridbag sizer.
6471 @param co Current object.
6472 @param dp Direct parent.
6473 @param pw Parent window object.
6474 @param psrc Source structure.
6475 @param gui GUI description.
6476 */
6477 static
6478 void
dkct_gui_constructor_gridbagsizer(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))6479 dkct_gui_constructor_gridbagsizer(
6480 DKCT_GUI_ELEMENT *co,
6481 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6482 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
6483 DKCT_SRC *psrc,
6484 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
6485 )
6486 {
6487 char bu[128]; /* Buffer for integer values. */
6488
6489 DK3_UNUSED_ARG(dp)
6490 DK3_UNUSED_ARG(pw)
6491 DK3_UNUSED_ARG(gui)
6492 bu[0] = '\0';
6493 if((co->gridgapx > -1) || (co->gridgapy > -1)) {
6494 fputs(dkct_gui_out_kw[2], psrc->fipo);
6495 if(co->gridgapx > -1) {
6496 sprintf(
6497 bu, "%d, %d",
6498 ((co->gridgapy > -1) ? co->gridgapy : 0),
6499 ((co->gridgapx > -1) ? co->gridgapx : 0)
6500 );
6501 } else {
6502 sprintf(bu, "%d", co->gridgapy);
6503 }
6504 fputs(bu, psrc->fipo);
6505 fputs(dkct_gui_out_kw[0], psrc->fipo);
6506 }
6507 }
6508
6509
6510
6511 /** Write element constructor for static box sizer.
6512 @param co Current object.
6513 @param dp Direct parent.
6514 @param pw Parent window.
6515 @param psrc Source structure.
6516 @param gui GUI description.
6517 */
6518 static
6519 void
dkct_gui_constructor_staticboxsizer(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6520 dkct_gui_constructor_staticboxsizer(
6521 DKCT_GUI_ELEMENT *co,
6522 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6523 DKCT_GUI_ELEMENT *pw,
6524 DKCT_SRC *psrc,
6525 DKCT_GUI *gui
6526 )
6527 {
6528 DK3_UNUSED_ARG(dp)
6529 fputs(dkct_gui_out_kw[2], psrc->fipo);
6530 fputs(dkct_gui_out_kw[(co->direction) ? 35 : 34], psrc->fipo);
6531 dkct_gui_next_argument(psrc);
6532 dkct_gui_write_parent_name(pw, psrc, gui);
6533 if(co->text) {
6534 dkct_gui_next_argument(psrc);
6535 fputs(co->text, psrc->fipo);
6536 }
6537 fputs(dkct_gui_out_kw[0], psrc->fipo);
6538 }
6539
6540
6541
6542 /** Write constructor for a panel.
6543 @param co Current object.
6544 @param dp Direct parent.
6545 @param pw Parent window object.
6546 @param psrc Source structure.
6547 @param gui GUI description.
6548 */
6549 static
6550 void
dkct_gui_constructor_panel(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6551 dkct_gui_constructor_panel(
6552 DKCT_GUI_ELEMENT *co,
6553 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6554 DKCT_GUI_ELEMENT *pw,
6555 DKCT_SRC *psrc,
6556 DKCT_GUI *gui
6557 )
6558 {
6559 int det = 0; /* Details level. */
6560
6561 DK3_UNUSED_ARG(dp)
6562 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
6563 fputs(dkct_gui_out_kw[2], psrc->fipo);
6564 dkct_gui_write_parent_name(pw, psrc, gui);
6565 dkct_gui_next_argument(psrc);
6566 dkct_gui_write_idname(co, psrc);
6567 if(det) {
6568 dkct_gui_next_argument(psrc);
6569 fputs(dkct_gui_out_kw[74], psrc->fipo);
6570 dkct_gui_next_argument(psrc);
6571 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
6572 if(det > 1) {
6573 }
6574 }
6575 fputs(dkct_gui_out_kw[0], psrc->fipo);
6576 }
6577
6578
6579
6580 /** Write constructor for notebook.
6581 @param co Current object.
6582 @param dp Direct parent.
6583 @param pw Parent window object.
6584 @param psrc Source structure.
6585 @param gui GUI description.
6586 */
6587 static
6588 void
dkct_gui_constructor_notebook(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6589 dkct_gui_constructor_notebook(
6590 DKCT_GUI_ELEMENT *co,
6591 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6592 DKCT_GUI_ELEMENT *pw,
6593 DKCT_SRC *psrc,
6594 DKCT_GUI *gui
6595 )
6596 {
6597 int det = 0; /* Details level. */
6598 int fe = 0; /* Flag: Found elements. */
6599
6600 DK3_UNUSED_ARG(dp)
6601 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
6602 if(co->notebookStyle) det = 2;
6603 fputs(dkct_gui_out_kw[2], psrc->fipo);
6604 dkct_gui_write_parent_name(pw, psrc, gui);
6605 dkct_gui_next_argument(psrc);
6606 dkct_gui_write_idname(co, psrc);
6607 if(det) {
6608 dkct_gui_next_argument(psrc);
6609 fputs(dkct_gui_out_kw[74], psrc->fipo);
6610 dkct_gui_next_argument(psrc);
6611 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
6612 if(det > 1) {
6613 if((co->notebookStyle) & DKCT_GUI_NB_TOP) {
6614 switch (co->cln) {
6615 case 12: {
6616 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6617 fputs(dkct_gui_out_kw[113], psrc->fipo);
6618 } break;
6619 case 42: {
6620 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6621 fputs(dkct_gui_out_kw[221], psrc->fipo);
6622 } break;
6623 case 43: {
6624 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6625 fputs(dkct_gui_out_kw[222], psrc->fipo);
6626 } break;
6627 }
6628 } else {
6629 if((co->notebookStyle) & DKCT_GUI_NB_LEFT) {
6630 switch (co->cln) {
6631 case 12: {
6632 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6633 fputs(dkct_gui_out_kw[114], psrc->fipo);
6634 } break;
6635 case 42: {
6636 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6637 fputs(dkct_gui_out_kw[223], psrc->fipo);
6638 } break;
6639 case 43: {
6640 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6641 fputs(dkct_gui_out_kw[224], psrc->fipo);
6642 } break;
6643 }
6644 } else {
6645 if((co->notebookStyle) & DKCT_GUI_NB_RIGHT) {
6646 switch (co->cln) {
6647 case 12: {
6648 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6649 fputs(dkct_gui_out_kw[115], psrc->fipo);
6650 } break;
6651 case 42: {
6652 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6653 fputs(dkct_gui_out_kw[225], psrc->fipo);
6654 } break;
6655 case 43: {
6656 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6657 fputs(dkct_gui_out_kw[226], psrc->fipo);
6658 } break;
6659 }
6660 } else {
6661 if((co->notebookStyle) & DKCT_GUI_NB_BOTTOM) {
6662 switch (co->cln) {
6663 case 12: {
6664 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6665 fputs(dkct_gui_out_kw[116], psrc->fipo);
6666 } break;
6667 case 42: {
6668 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6669 fputs(dkct_gui_out_kw[227], psrc->fipo);
6670 } break;
6671 case 43: {
6672 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6673 fputs(dkct_gui_out_kw[228], psrc->fipo);
6674 } break;
6675 }
6676 }
6677 }
6678 }
6679 }
6680 if (12 == co->cln) {
6681 if((co->notebookStyle) & DKCT_GUI_NB_FIXEDWIDTH) {
6682 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6683 fputs(dkct_gui_out_kw[117], psrc->fipo);
6684 }
6685 if((co->notebookStyle) & DKCT_GUI_NB_MULTILINE) {
6686 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6687 fputs(dkct_gui_out_kw[118], psrc->fipo);
6688 }
6689 if((co->notebookStyle) & DKCT_GUI_NB_NOPAGETHEME) {
6690 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6691 fputs(dkct_gui_out_kw[119], psrc->fipo);
6692 }
6693 if((co->notebookStyle) & DKCT_GUI_NB_FLAT) {
6694 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6695 fputs(dkct_gui_out_kw[120], psrc->fipo);
6696 }
6697 }
6698 if(!(fe)) { fputs(dkct_gui_out_kw[52], psrc->fipo); }
6699 }
6700 }
6701 fputs(dkct_gui_out_kw[0], psrc->fipo);
6702 }
6703
6704
6705
6706 /** Write constructor for scrolled window.
6707 @param co Current object.
6708 @param dp Direct parent.
6709 @param pw Parent window object.
6710 @param psrc Source structure.
6711 @param gui GUI description.
6712 */
6713 static
6714 void
dkct_gui_constructor_scrolledwindow(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6715 dkct_gui_constructor_scrolledwindow(
6716 DKCT_GUI_ELEMENT *co,
6717 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6718 DKCT_GUI_ELEMENT *pw,
6719 DKCT_SRC *psrc,
6720 DKCT_GUI *gui
6721 )
6722 {
6723 int det = 0; /* Details level. */
6724
6725 DK3_UNUSED_ARG(dp)
6726 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
6727 if(co->direction != DKCT_GUI_DIRECTION_BOTH) det = 2;
6728 fputs(dkct_gui_out_kw[2], psrc->fipo);
6729 dkct_gui_write_parent_name(pw, psrc, gui);
6730 dkct_gui_next_argument(psrc);
6731 dkct_gui_write_idname(co, psrc);
6732 if(det) {
6733 dkct_gui_next_argument(psrc);
6734 fputs(dkct_gui_out_kw[74], psrc->fipo);
6735 dkct_gui_next_argument(psrc);
6736 dkct_gui_write_size(psrc, co->sizex, co->sizey, 1, co);
6737 if(det > 1) {
6738 dkct_gui_next_argument(psrc);
6739 switch(co->direction) {
6740 case DKCT_GUI_DIRECTION_HORIZONTAL: {
6741 fputs(dkct_gui_out_kw[138], psrc->fipo);
6742 } break;
6743 case DKCT_GUI_DIRECTION_VERTICAL: {
6744 fputs(dkct_gui_out_kw[139], psrc->fipo);
6745 } break;
6746 default: {
6747 fputs(dkct_gui_out_kw[140], psrc->fipo);
6748 } break;
6749 }
6750 }
6751 }
6752 fputs(dkct_gui_out_kw[0], psrc->fipo);
6753 }
6754
6755
6756
6757 /** Write constructor for splitter window.
6758 @param co Current object.
6759 @param dp Direct parent.
6760 @param pw Parent window object.
6761 @param psrc Source structure.
6762 @param gui GUI description.
6763 */
6764 static
6765 void
dkct_gui_constructor_splitterwindow(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6766 dkct_gui_constructor_splitterwindow(
6767 DKCT_GUI_ELEMENT *co,
6768 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6769 DKCT_GUI_ELEMENT *pw,
6770 DKCT_SRC *psrc,
6771 DKCT_GUI *gui
6772 )
6773 {
6774 int det = 0; /* Details level. */
6775 int fe = 0; /* Flag: Found an element. */
6776
6777 DK3_UNUSED_ARG(dp)
6778 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
6779 if(co->splitterStyle != DKCT_GUI_SPLITTERW_3D) det = 2;
6780 fputs(dkct_gui_out_kw[2], psrc->fipo);
6781 dkct_gui_write_parent_name(pw, psrc, gui);
6782 dkct_gui_next_argument(psrc);
6783 dkct_gui_write_idname(co, psrc);
6784 if(det) {
6785 dkct_gui_next_argument(psrc);
6786 fputs(dkct_gui_out_kw[74], psrc->fipo);
6787 dkct_gui_next_argument(psrc);
6788 dkct_gui_write_size(psrc, co->sizex, co->sizey, 1, co);
6789 if(det > 1) {
6790 dkct_gui_next_argument(psrc);
6791 if((co->splitterStyle) & DKCT_GUI_SPLITTERW_3D) {
6792 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6793 fputs(dkct_gui_out_kw[147], psrc->fipo);
6794 } else {
6795 if((co->splitterStyle) & DKCT_GUI_SPLITTERW_3D_SASH) {
6796 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6797 fputs(dkct_gui_out_kw[148], psrc->fipo);
6798 }
6799 if((co->splitterStyle) & DKCT_GUI_SPLITTERW_3D_BORDER) {
6800 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6801 fputs(dkct_gui_out_kw[149], psrc->fipo);
6802 }
6803 }
6804 if((co->splitterStyle) & DKCT_GUI_SPLITTERW_BORDER) {
6805 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6806 fputs(dkct_gui_out_kw[150], psrc->fipo);
6807 }
6808 if((co->splitterStyle) & DKCT_GUI_SPLITTERW_NO_BORDER) {
6809 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6810 fputs(dkct_gui_out_kw[151], psrc->fipo);
6811 }
6812 if((co->splitterStyle) & DKCT_GUI_SPLITTERW_NO_XP_THEME) {
6813 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6814 fputs(dkct_gui_out_kw[152], psrc->fipo);
6815 }
6816 if((co->splitterStyle) & DKCT_GUI_SPLITTERW_PERMIT_UNSPLIT) {
6817 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6818 fputs(dkct_gui_out_kw[153], psrc->fipo);
6819 }
6820 if((co->splitterStyle) & DKCT_GUI_SPLITTERW_LIVE_UPDATE) {
6821 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); }
6822 #if 0
6823 /* Re-activate when adding further contents.
6824 */
6825 fe = 1;
6826 #endif
6827 fputs(dkct_gui_out_kw[154], psrc->fipo);
6828 }
6829 }
6830 }
6831 fputs(dkct_gui_out_kw[0], psrc->fipo);
6832 }
6833
6834
6835
6836 /** Write constructor for button.
6837 @param co Current object.
6838 @param dp Direct parent.
6839 @param pw Parent window object.
6840 @param psrc Source structure.
6841 @param gui GUI description.
6842 */
6843 static
6844 void
dkct_gui_constructor_button(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6845 dkct_gui_constructor_button(
6846 DKCT_GUI_ELEMENT *co,
6847 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6848 DKCT_GUI_ELEMENT *pw,
6849 DKCT_SRC *psrc,
6850 DKCT_GUI *gui
6851 )
6852 {
6853 int det = 0; /* Details level. */
6854 int fe = 0; /* Flag: Found an entry. */
6855
6856 DK3_UNUSED_ARG(dp)
6857 if(co->text) det = 1;
6858 if((co->sizex > 0) && (co->sizey > 0)) det = 2;
6859 if(co->buttonStyle) det = 3;
6860 if(co->validator) det = 4;
6861 fputs(dkct_gui_out_kw[2], psrc->fipo);
6862 dkct_gui_write_parent_name(pw, psrc, gui);
6863 dkct_gui_next_argument(psrc);
6864 dkct_gui_write_idname(co, psrc);
6865 if(det) {
6866 dkct_gui_next_argument(psrc);
6867 if(co->text) {
6868 fputs(co->text, psrc->fipo);
6869 } else {
6870 fputs(dkct_gui_out_kw[73], psrc->fipo);
6871 }
6872 if(det > 1) {
6873 dkct_gui_next_argument(psrc);
6874 fputs(dkct_gui_out_kw[74], psrc->fipo);
6875 dkct_gui_next_argument(psrc);
6876 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
6877 if(det > 2) {
6878 dkct_gui_next_argument(psrc);
6879 if((co->buttonStyle) & DKCT_GUI_BUTTON_LEFT) {
6880 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6881 fputs(dkct_gui_out_kw[141], psrc->fipo);
6882 }
6883 if((co->buttonStyle) & DKCT_GUI_BUTTON_TOP) {
6884 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6885 fputs(dkct_gui_out_kw[142], psrc->fipo);
6886 }
6887 if((co->buttonStyle) & DKCT_GUI_BUTTON_RIGHT) {
6888 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6889 fputs(dkct_gui_out_kw[143], psrc->fipo);
6890 }
6891 if((co->buttonStyle) & DKCT_GUI_BUTTON_BOTTOM) {
6892 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6893 fputs(dkct_gui_out_kw[144], psrc->fipo);
6894 }
6895 if((co->buttonStyle) & DKCT_GUI_BUTTON_EXACTFIT) {
6896 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6897 fputs(dkct_gui_out_kw[145], psrc->fipo);
6898 }
6899 if((co->buttonStyle) & DKCT_GUI_BUTTON_NO_BORDER) {
6900 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); }
6901 #if 0
6902 /* Re-activate when adding further contents later.
6903 */
6904 fe = 1;
6905 #endif
6906 fputs(dkct_gui_out_kw[146], psrc->fipo);
6907 }
6908 if(det > 3) {
6909 dkct_gui_next_argument(psrc);
6910 }
6911 }
6912 }
6913 }
6914 fputs(dkct_gui_out_kw[0], psrc->fipo);
6915 }
6916
6917
6918
6919 /** Write constructor for bitmap button.
6920 @param co Current object.
6921 @param dp Direct parent.
6922 @param pw Parent window object.
6923 @param psrc Source structure.
6924 @param gui GUI description.
6925 */
6926 static
6927 void
dkct_gui_constructor_bitmapbutton(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)6928 dkct_gui_constructor_bitmapbutton(
6929 DKCT_GUI_ELEMENT *co,
6930 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
6931 DKCT_GUI_ELEMENT *pw,
6932 DKCT_SRC *psrc,
6933 DKCT_GUI *gui
6934 )
6935 {
6936 int det = 0; /* Details level. */
6937 int fe = 0; /* Flag: Found entry. */
6938
6939 DK3_UNUSED_ARG(dp)
6940 if(co->bitmapVarName) {
6941 det = 1;
6942 if((co->sizex > 0) && (co->sizey > 0)) det = 2;
6943 if(co->bitmapbStyle != DKCT_GUI_BBUTTON_AUTODRAW) det = 3;
6944 if(co->validator) det = 4;
6945
6946 fputs(dkct_gui_out_kw[2], psrc->fipo);
6947 dkct_gui_write_parent_name(pw, psrc, gui);
6948 dkct_gui_next_argument(psrc);
6949 dkct_gui_write_idname(co, psrc);
6950 dkct_gui_next_argument(psrc);
6951 fputs(co->bitmapVarName, psrc->fipo);
6952 if(det > 1) {
6953 dkct_gui_next_argument(psrc);
6954 fputs(dkct_gui_out_kw[74], psrc->fipo);
6955 dkct_gui_next_argument(psrc);
6956 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
6957 if(det > 2) {
6958 if((co->bitmapbStyle) & DKCT_GUI_BBUTTON_AUTODRAW) {
6959 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6960 fputs(dkct_gui_out_kw[155], psrc->fipo);
6961 }
6962 if((co->bitmapbStyle) & DKCT_GUI_BBUTTON_LEFT) {
6963 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6964 fputs(dkct_gui_out_kw[141], psrc->fipo);
6965 }
6966 if((co->bitmapbStyle) & DKCT_GUI_BBUTTON_TOP) {
6967 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6968 fputs(dkct_gui_out_kw[142], psrc->fipo);
6969 }
6970 if((co->bitmapbStyle) & DKCT_GUI_BBUTTON_RIGHT) {
6971 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6972 fputs(dkct_gui_out_kw[143], psrc->fipo);
6973 }
6974 if((co->bitmapbStyle) & DKCT_GUI_BBUTTON_BOTTOM) {
6975 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
6976 fputs(dkct_gui_out_kw[144], psrc->fipo);
6977 }
6978 if(!(fe)) { fputs(dkct_gui_out_kw[52], psrc->fipo); }
6979 if(det > 3) {
6980 dkct_gui_next_argument(psrc);
6981 fputs(co->validator, psrc->fipo);
6982 }
6983 }
6984 }
6985 fputs(dkct_gui_out_kw[0], psrc->fipo);
6986 } else {
6987 /* ERROR: No bitmap name specified! */
6988 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 51);
6989 }
6990 }
6991
6992
6993
6994 /** Write element constructor for choice and combo box.
6995 @param co Current object.
6996 @param dp Direct parent.
6997 @param pw Parent window.
6998 @param psrc Source structure.
6999 @param gui GUI description.
7000 @param iscombo Flag: Combo box.
7001 */
7002 static
7003 void
dkct_gui_constructor_choice_combo(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui,int iscombo)7004 dkct_gui_constructor_choice_combo(
7005 DKCT_GUI_ELEMENT *co,
7006 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7007 DKCT_GUI_ELEMENT *pw,
7008 DKCT_SRC *psrc,
7009 DKCT_GUI *gui,
7010 int iscombo
7011 )
7012 {
7013 char bu[64]; /* Buffer for integer values. */
7014 int details = 0; /* Details level. */
7015 DK3_UNUSED_ARG(dp)
7016 /*
7017 parent, id, pos, size (1) , n (2), texts (3), validator (4)
7018 parent, id, text, pos, size (1), n (2), texts (3), validator (4)
7019 */
7020 if((co->sizex > 0) && (co->sizey > 0)) details = 1;
7021 if((co->nChoices > 0) || (co->nChoices == -1)) details = 2;
7022 if(co->choices) details = 3;
7023 if(co->validator) details = 4;
7024 fputs(dkct_gui_out_kw[2], psrc->fipo);
7025 dkct_gui_write_parent_name(pw, psrc, gui);
7026 dkct_gui_next_argument(psrc);
7027 dkct_gui_write_idname(co, psrc);
7028 if(iscombo) {
7029 dkct_gui_next_argument(psrc);
7030 if(co->text) {
7031 fputs(co->text, psrc->fipo);
7032 } else {
7033 fputs(dkct_gui_out_kw[73], psrc->fipo);
7034 }
7035 }
7036 if(details) {
7037 dkct_gui_next_argument(psrc);
7038 fputs(dkct_gui_out_kw[74], psrc->fipo);
7039 dkct_gui_next_argument(psrc);
7040 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7041 if(details > 1) {
7042 if(co->nChoices != -1) {
7043 dkct_gui_next_argument(psrc);
7044 sprintf(bu, "%d", co->nChoices);
7045 fputs(bu, psrc->fipo);
7046 }
7047 if(details > 2) {
7048 dkct_gui_next_argument(psrc);
7049 if(co->choices) {
7050 fputs(co->choices, psrc->fipo);
7051 } else {
7052 fputs(dkct_gui_out_kw[100], psrc->fipo);
7053 }
7054 if(details > 3) {
7055 dkct_gui_next_argument(psrc);
7056 fputs(co->validator, psrc->fipo);
7057 }
7058 }
7059 }
7060 }
7061 fputs(dkct_gui_out_kw[0], psrc->fipo);
7062 }
7063
7064
7065
7066 /** Write element constructor for checkbox.
7067 @param co Current object.
7068 @param dp Direct parent.
7069 @param pw Parent window.
7070 @param psrc Source structure.
7071 @param gui GUI description.
7072 */
7073 static
7074 void
dkct_gui_constructor_checkbox(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7075 dkct_gui_constructor_checkbox(
7076 DKCT_GUI_ELEMENT *co,
7077 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7078 DKCT_GUI_ELEMENT *pw,
7079 DKCT_SRC *psrc,
7080 DKCT_GUI *gui
7081 )
7082 {
7083 int need_full_arguments = 0; /* Details level. */
7084
7085 DK3_UNUSED_ARG(dp)
7086 if(co->text) need_full_arguments = 1;
7087 if((co->sizex > 0) && (co->sizey > 0)) { need_full_arguments = 2; }
7088 if(co->nStates == 0x03) {
7089 need_full_arguments = 3;
7090 }
7091 if(((co->align) & DKCT_GUI_ALIGN_H_MASK) == DKCT_GUI_ALIGN_H_RIGHT) {
7092 need_full_arguments = 3;
7093 }
7094 if(co->validator) need_full_arguments = 4;
7095 fputs(dkct_gui_out_kw[2], psrc->fipo);
7096 dkct_gui_write_parent_name(pw, psrc, gui);
7097 dkct_gui_next_argument(psrc);
7098 dkct_gui_write_idname(co, psrc);
7099 if(need_full_arguments) {
7100 dkct_gui_next_argument(psrc);
7101 if(co->text) {
7102 fputs(co->text, psrc->fipo);
7103 } else {
7104 fputs(dkct_gui_out_kw[73], psrc->fipo);
7105 }
7106 if(need_full_arguments > 1) {
7107 dkct_gui_next_argument(psrc);
7108 fputs(dkct_gui_out_kw[74], psrc->fipo);
7109 dkct_gui_next_argument(psrc);
7110 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7111 if(need_full_arguments > 2) {
7112 dkct_gui_next_argument(psrc);
7113 if(co->nStates == 0x03) {
7114 fputs(dkct_gui_out_kw[76], psrc->fipo);
7115 if(((co->align) & DKCT_GUI_ALIGN_H_MASK) == DKCT_GUI_ALIGN_H_RIGHT) {
7116 fputs(dkct_gui_out_kw[44], psrc->fipo);
7117 fputs(dkct_gui_out_kw[47], psrc->fipo);
7118 } else {
7119 }
7120 } else {
7121 if(((co->align) & DKCT_GUI_ALIGN_H_MASK) == DKCT_GUI_ALIGN_H_RIGHT) {
7122 fputs(dkct_gui_out_kw[47], psrc->fipo);
7123 } else {
7124 fputs(dkct_gui_out_kw[52], psrc->fipo);
7125 }
7126 }
7127 if(need_full_arguments > 3) {
7128 dkct_gui_next_argument(psrc);
7129 fputs(co->validator, psrc->fipo);
7130 }
7131 }
7132 }
7133 }
7134 fputs(dkct_gui_out_kw[0], psrc->fipo);
7135 }
7136
7137
7138
7139 /** Write element constructor for listbox.
7140 @param co Current object.
7141 @param dp Direct parent.
7142 @param pw Parent window.
7143 @param psrc Source structure.
7144 @param gui GUI description.
7145 */
7146 static
7147 void
dkct_gui_constructor_listbox(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7148 dkct_gui_constructor_listbox(
7149 DKCT_GUI_ELEMENT *co,
7150 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7151 DKCT_GUI_ELEMENT *pw,
7152 DKCT_SRC *psrc,
7153 DKCT_GUI *gui
7154 )
7155 {
7156 char bu[64]; /* Buffer for numeric values. */
7157
7158 DK3_UNUSED_ARG(dp)
7159 fputs(dkct_gui_out_kw[2], psrc->fipo);
7160 dkct_gui_write_parent_name(pw, psrc, gui);
7161 dkct_gui_next_argument(psrc);
7162 dkct_gui_write_idname(co, psrc);
7163 dkct_gui_next_argument(psrc);
7164 fputs(dkct_gui_out_kw[74], psrc->fipo);
7165 dkct_gui_next_argument(psrc);
7166 dkct_gui_write_size(psrc, co->sizex, co->sizey, 1, co);
7167 if(co->nChoices != -1) {
7168 dkct_gui_next_argument(psrc);
7169 sprintf(bu, "%d", co->nChoices);
7170 fputs(bu, psrc->fipo);
7171 }
7172 dkct_gui_next_argument(psrc);
7173 if(co->choices) {
7174 fputs(co->choices, psrc->fipo);
7175 } else {
7176 fputs(dkct_gui_out_kw[100], psrc->fipo);
7177 }
7178 /* Style */
7179 dkct_gui_next_argument(psrc);
7180 switch(co->selStyle) {
7181 case DKCT_GUI_SELECTION_STYLE_EXTENDED: {
7182 fputs(dkct_gui_out_kw[84], psrc->fipo);
7183 } break;
7184 case DKCT_GUI_SELECTION_STYLE_MULTIPLE: {
7185 fputs(dkct_gui_out_kw[83], psrc->fipo);
7186 } break;
7187 default: {
7188 fputs(dkct_gui_out_kw[82], psrc->fipo);
7189 } break;
7190 }
7191 fputs(dkct_gui_out_kw[85], psrc->fipo);
7192 if(co->validator) {
7193 dkct_gui_next_argument(psrc);
7194 fputs(co->validator, psrc->fipo);
7195 }
7196 fputs(dkct_gui_out_kw[0], psrc->fipo);
7197 }
7198
7199
7200
7201 /** Write element constructor for checklistbox.
7202 @param co Current object.
7203 @param dp Direct parent.
7204 @param pw Parent window.
7205 @param psrc Source structure.
7206 @param gui GUI description.
7207 */
7208 static
7209 void
dkct_gui_constructor_checklistbox(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * dp,DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7210 dkct_gui_constructor_checklistbox(
7211 DKCT_GUI_ELEMENT *co,
7212 DKCT_GUI_ELEMENT *dp,
7213 DKCT_GUI_ELEMENT *pw,
7214 DKCT_SRC *psrc,
7215 DKCT_GUI *gui
7216 )
7217 {
7218 dkct_gui_constructor_listbox(co, dp, pw, psrc, gui);
7219 }
7220
7221
7222
7223 /** Write element constructor for radio box.
7224 @param co Current object.
7225 @param dp Direct parent.
7226 @param pw Parent window.
7227 @param psrc Source structure.
7228 @param gui GUI description.
7229 */
7230 static
7231 void
dkct_gui_constructor_radiobox(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7232 dkct_gui_constructor_radiobox(
7233 DKCT_GUI_ELEMENT *co,
7234 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7235 DKCT_GUI_ELEMENT *pw,
7236 DKCT_SRC *psrc,
7237 DKCT_GUI *gui
7238 )
7239 {
7240 /*
7241 parent, id, label, pos, size (1), n (2), choices (3),
7242 majordim (4), style (5), validator (6)
7243 */
7244 int det = 0; /* Details level. */
7245 char bu[64]; /* Buffer for numeric values. */
7246
7247 DK3_UNUSED_ARG(dp)
7248 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
7249 if((co->nChoices > 0) || (co->nChoices == -1)) det = 2;
7250 if(co->choices) det = 3;
7251 if(co->maxRowsCols > 0) det = 4;
7252 if(co->rbDirection != DKCT_GUI_RB_DIR_COLUMNS) det = 5;
7253 if(co->validator) det = 6;
7254
7255 fputs(dkct_gui_out_kw[2], psrc->fipo);
7256 dkct_gui_write_parent_name(pw, psrc, gui);
7257 dkct_gui_next_argument(psrc);
7258 dkct_gui_write_idname(co, psrc);
7259 dkct_gui_next_argument(psrc);
7260 if(co->text) {
7261 fputs(co->text, psrc->fipo);
7262 } else {
7263 fputs(dkct_gui_out_kw[73], psrc->fipo);
7264 }
7265 if(det) {
7266 dkct_gui_next_argument(psrc);
7267 fputs(dkct_gui_out_kw[74], psrc->fipo);
7268 dkct_gui_next_argument(psrc);
7269 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7270 if(det > 1) {
7271 if(co->nChoices != -1) {
7272 dkct_gui_next_argument(psrc);
7273 sprintf(bu, "%d", ((co->nChoices > 0) ? co->nChoices : 0));
7274 fputs(bu, psrc->fipo);
7275 }
7276 if(det > 2) {
7277 dkct_gui_next_argument(psrc);
7278 if(co->choices) {
7279 fputs(co->choices, psrc->fipo);
7280 } else {
7281 fputs(dkct_gui_out_kw[100], psrc->fipo);
7282 }
7283 if(det > 3) {
7284 /* Majordim */
7285 dkct_gui_next_argument(psrc);
7286 sprintf(bu, "%d", (co->maxRowsCols >= 0) ? co->maxRowsCols : 0);
7287 fputs(bu, psrc->fipo);
7288 if(det > 4) {
7289 /* Style */
7290 dkct_gui_next_argument(psrc);
7291 if(co->rbDirection == DKCT_GUI_RB_DIR_COLUMNS) {
7292 fputs(dkct_gui_out_kw[87], psrc->fipo);
7293 } else {
7294 fputs(dkct_gui_out_kw[86], psrc->fipo);
7295 }
7296 if(det > 5) {
7297 dkct_gui_next_argument(psrc);
7298 fputs(co->validator, psrc->fipo);
7299 }
7300 }
7301 }
7302 }
7303 }
7304 }
7305 fputs(dkct_gui_out_kw[0], psrc->fipo);
7306 }
7307
7308
7309
7310 /** Write element constructor for radio button.
7311 @param co Current object.
7312 @param dp Direct parent.
7313 @param pw Parent window.
7314 @param psrc Source structure.
7315 @param gui GUI description.
7316 */
7317 static
7318 void
dkct_gui_constructor_radiobutton(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7319 dkct_gui_constructor_radiobutton(
7320 DKCT_GUI_ELEMENT *co,
7321 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7322 DKCT_GUI_ELEMENT *pw,
7323 DKCT_SRC *psrc,
7324 DKCT_GUI *gui
7325 )
7326 {
7327 int det = 0; /* Details level. */
7328
7329 DK3_UNUSED_ARG(dp)
7330 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
7331 if(co->startGroup) det = 2;
7332 if(co->validator) det = 3;
7333 fputs(dkct_gui_out_kw[2], psrc->fipo);
7334 dkct_gui_write_parent_name(pw, psrc, gui);
7335 dkct_gui_next_argument(psrc);
7336 dkct_gui_write_idname(co, psrc);
7337 dkct_gui_next_argument(psrc);
7338 if(co->text) {
7339 fputs(co->text, psrc->fipo);
7340 } else {
7341 fputs(dkct_gui_out_kw[73], psrc->fipo);
7342 }
7343 if(det) {
7344 dkct_gui_next_argument(psrc);
7345 fputs(dkct_gui_out_kw[74], psrc->fipo);
7346 dkct_gui_next_argument(psrc);
7347 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7348 if(det > 1) {
7349 dkct_gui_next_argument(psrc);
7350 if(co->startGroup) {
7351 fputs(dkct_gui_out_kw[88], psrc->fipo);
7352 } else {
7353 fputs(dkct_gui_out_kw[52], psrc->fipo);
7354 }
7355 if(det > 2) {
7356 dkct_gui_next_argument(psrc);
7357 fputs(co->validator, psrc->fipo);
7358 }
7359 }
7360 }
7361 fputs(dkct_gui_out_kw[0], psrc->fipo);
7362 }
7363
7364
7365
7366 /** Write element constructor for scrollbar.
7367 @param co Current object.
7368 @param dp Direct parent.
7369 @param pw Parent window.
7370 @param psrc Source structure.
7371 @param gui GUI description.
7372 */
7373 static
7374 void
dkct_gui_constructor_scrollbar(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7375 dkct_gui_constructor_scrollbar(
7376 DKCT_GUI_ELEMENT *co,
7377 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7378 DKCT_GUI_ELEMENT *pw,
7379 DKCT_SRC *psrc,
7380 DKCT_GUI *gui
7381 )
7382 {
7383 int must_write_details = 0; /* Details level. */
7384
7385 DK3_UNUSED_ARG(dp)
7386 fputs(dkct_gui_out_kw[2], psrc->fipo);
7387 dkct_gui_write_parent_name(pw, psrc, gui);
7388 dkct_gui_next_argument(psrc);
7389 dkct_gui_write_idname(co, psrc);
7390 must_write_details = 0;
7391 if((co->sizex > 0) && (co->sizey > 0)) {
7392 must_write_details = 1;
7393 }
7394 if(co->direction != DKCT_GUI_DIRECTION_HORIZONTAL) {
7395 must_write_details = 2;
7396 }
7397 if(co->validator) {
7398 must_write_details = 3;
7399 }
7400 if(must_write_details) {
7401 dkct_gui_next_argument(psrc);
7402 fputs(dkct_gui_out_kw[74], psrc->fipo);
7403 dkct_gui_next_argument(psrc);
7404 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7405 if(must_write_details > 1) {
7406 dkct_gui_next_argument(psrc);
7407 if(co->direction == DKCT_GUI_DIRECTION_HORIZONTAL) {
7408 fputs(dkct_gui_out_kw[101], psrc->fipo);
7409 } else {
7410 fputs(dkct_gui_out_kw[102], psrc->fipo);
7411 }
7412 if(must_write_details > 2) {
7413 dkct_gui_next_argument(psrc);
7414 fputs(co->validator, psrc->fipo);
7415 }
7416 }
7417 }
7418 fputs(dkct_gui_out_kw[0], psrc->fipo);
7419 }
7420
7421
7422
7423 /** Write element constructor for spin button.
7424 @param co Current object.
7425 @param dp Direct parent.
7426 @param pw Parent window.
7427 @param psrc Source structure.
7428 @param gui GUI description.
7429 */
7430 static
7431 void
dkct_gui_constructor_spinbutton(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7432 dkct_gui_constructor_spinbutton(
7433 DKCT_GUI_ELEMENT *co,
7434 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7435 DKCT_GUI_ELEMENT *pw,
7436 DKCT_SRC *psrc,
7437 DKCT_GUI *gui
7438 )
7439 {
7440 int need_details = 0; /* Details level. */
7441
7442 DK3_UNUSED_ARG(dp)
7443 if(co->sizex > 0) { need_details = 1; }
7444 if(co->sizey > 0) { need_details = 1; }
7445 if(co->direction != DKCT_GUI_DIRECTION_HORIZONTAL) { need_details = 2; }
7446 if(co->useKeys) { need_details = 2; }
7447 if(co->spinWrap) { need_details = 2; }
7448 fputs(dkct_gui_out_kw[2], psrc->fipo);
7449 dkct_gui_write_parent_name(pw, psrc, gui);
7450 dkct_gui_next_argument(psrc);
7451 dkct_gui_write_idname(co, psrc);
7452 if(need_details) {
7453 dkct_gui_next_argument(psrc);
7454 fputs(dkct_gui_out_kw[74], psrc->fipo);
7455 dkct_gui_next_argument(psrc);
7456 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7457 if(need_details > 1) {
7458 dkct_gui_next_argument(psrc);
7459 if(co->direction == DKCT_GUI_DIRECTION_HORIZONTAL) {
7460 fputs(dkct_gui_out_kw[92], psrc->fipo);
7461 } else {
7462 fputs(dkct_gui_out_kw[93], psrc->fipo);
7463 }
7464 if(co->useKeys) {
7465 fputs(dkct_gui_out_kw[94], psrc->fipo);
7466 }
7467 if(co->spinWrap) {
7468 fputs(dkct_gui_out_kw[95], psrc->fipo);
7469 }
7470 }
7471 }
7472 fputs(dkct_gui_out_kw[0], psrc->fipo);
7473 }
7474
7475
7476
7477 /** Write element constructor for spin control.
7478 @param co Current object.
7479 @param dp Direct parent.
7480 @param pw Parent window.
7481 @param psrc Source structure.
7482 @param gui GUI description.
7483 */
7484 static
7485 void
dkct_gui_constructor_spincontrol(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7486 dkct_gui_constructor_spincontrol(
7487 DKCT_GUI_ELEMENT *co,
7488 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7489 DKCT_GUI_ELEMENT *pw,
7490 DKCT_SRC *psrc,
7491 DKCT_GUI *gui
7492 )
7493 {
7494 char bu[64]; /* Buffer for numeric values. */
7495 int need_details = 0; /* Details level. */
7496
7497 DK3_UNUSED_ARG(dp)
7498 if(co->text) { need_details = 1; }
7499 if((co->sizex > 0) && (co->sizey > 0)) { need_details = 2; }
7500 if(co->useKeys) { need_details = 3; }
7501 if(co->spinWrap) { need_details = 3; }
7502 if(co->spinMin != 0) { need_details = 4; }
7503 if(co->spinMax != 100) { need_details = 5; }
7504 if(co->spinVal != 0) { need_details = 6; }
7505 fputs(dkct_gui_out_kw[2], psrc->fipo);
7506 dkct_gui_write_parent_name(pw, psrc, gui);
7507 dkct_gui_next_argument(psrc);
7508 dkct_gui_write_idname(co, psrc);
7509 if(need_details) {
7510 dkct_gui_next_argument(psrc);
7511 if(co->text) {
7512 fputs(co->text, psrc->fipo);
7513 } else {
7514 fputs(dkct_gui_out_kw[73], psrc->fipo);
7515 }
7516 if(need_details > 1) {
7517 dkct_gui_next_argument(psrc);
7518 fputs(dkct_gui_out_kw[74], psrc->fipo);
7519 dkct_gui_next_argument(psrc);
7520 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7521 if(need_details > 2) {
7522 dkct_gui_next_argument(psrc);
7523 if(co->useKeys) {
7524 if(co->spinWrap) {
7525 fputs(dkct_gui_out_kw[96], psrc->fipo);
7526 } else {
7527 fputs(dkct_gui_out_kw[97], psrc->fipo);
7528 }
7529 } else {
7530 if(co->spinWrap) {
7531 fputs(dkct_gui_out_kw[98], psrc->fipo);
7532 } else {
7533 fputs(dkct_gui_out_kw[52], psrc->fipo);
7534 }
7535 }
7536 if(need_details > 3) {
7537 dkct_gui_next_argument(psrc);
7538 sprintf(bu, "%d", co->spinMin);
7539 fputs(bu, psrc->fipo);
7540 if(need_details > 4) {
7541 dkct_gui_next_argument(psrc);
7542 sprintf(bu, "%d", co->spinMax);
7543 fputs(bu, psrc->fipo);
7544 if(need_details > 5) {
7545 dkct_gui_next_argument(psrc);
7546 sprintf(bu, "%d", co->spinVal);
7547 fputs(bu, psrc->fipo);
7548 }
7549 }
7550 }
7551 }
7552 }
7553 }
7554 fputs(dkct_gui_out_kw[0], psrc->fipo);
7555 }
7556
7557
7558
7559 /** Write integer value.
7560 @param fipo Output file.
7561 @param i Value to write.
7562 */
7563 static
7564 void
dkct_gui_write_int_arg(FILE * fipo,int i)7565 dkct_gui_write_int_arg(FILE *fipo, int i)
7566 {
7567 char bu[64];
7568 sprintf(bu, "%d", i);
7569 fputs(bu, fipo);
7570 }
7571
7572
7573
7574
7575
7576 /** Write element constructor for slider.
7577 @param co Current object.
7578 @param dp Direct parent.
7579 @param pw Parent window.
7580 @param psrc Source structure.
7581 @param gui GUI description.
7582 */
7583 static
7584 void
dkct_gui_constructor_slider(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7585 dkct_gui_constructor_slider(
7586 DKCT_GUI_ELEMENT *co,
7587 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7588 DKCT_GUI_ELEMENT *pw,
7589 DKCT_SRC *psrc,
7590 DKCT_GUI *gui
7591 )
7592 {
7593 int det = 0; /* Details level. */
7594 /*
7595 parent, id, value, min, max, pos, size (1), style (2), validator (3)
7596 */
7597 DK3_UNUSED_ARG(dp)
7598 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
7599 if(co->sliderStyle) det = 2;
7600 if(co->direction != DKCT_GUI_DIRECTION_HORIZONTAL) det = 2;
7601 if(co->validator) det = 3;
7602 fputs(dkct_gui_out_kw[2], psrc->fipo);
7603 dkct_gui_write_parent_name(pw, psrc, gui);
7604 dkct_gui_next_argument(psrc);
7605 dkct_gui_write_idname(co, psrc);
7606 dkct_gui_next_argument(psrc);
7607 dkct_gui_write_int_arg(psrc->fipo, co->spinVal);
7608 dkct_gui_next_argument(psrc);
7609 dkct_gui_write_int_arg(psrc->fipo, co->spinMin);
7610 dkct_gui_next_argument(psrc);
7611 dkct_gui_write_int_arg(psrc->fipo, co->spinMax);
7612 if(det) {
7613 dkct_gui_next_argument(psrc);
7614 fputs(dkct_gui_out_kw[74], psrc->fipo);
7615 dkct_gui_next_argument(psrc);
7616 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7617 if(det > 1) {
7618 dkct_gui_next_argument(psrc);
7619 if(co->direction == DKCT_GUI_DIRECTION_HORIZONTAL) {
7620 fputs(dkct_gui_out_kw[103], psrc->fipo);
7621 } else {
7622 fputs(dkct_gui_out_kw[104], psrc->fipo);
7623 }
7624 if((co->sliderStyle) & DKCT_GUI_SL_STYLE_AUTOTICKS) {
7625 fputs(dkct_gui_out_kw[105], psrc->fipo);
7626 }
7627 if((co->sliderStyle) & DKCT_GUI_SL_STYLE_LABELS) {
7628 fputs(dkct_gui_out_kw[106], psrc->fipo);
7629 }
7630 if((co->sliderStyle) & DKCT_GUI_SL_STYLE_LEFT) {
7631 fputs(dkct_gui_out_kw[107], psrc->fipo);
7632 }
7633 if((co->sliderStyle) & DKCT_GUI_SL_STYLE_RIGHT) {
7634 fputs(dkct_gui_out_kw[108], psrc->fipo);
7635 }
7636 if((co->sliderStyle) & DKCT_GUI_SL_STYLE_TOP) {
7637 fputs(dkct_gui_out_kw[109], psrc->fipo);
7638 }
7639 if((co->sliderStyle) & DKCT_GUI_SL_STYLE_BOTTOM) {
7640 fputs(dkct_gui_out_kw[110], psrc->fipo);
7641 }
7642 if((co->sliderStyle) & DKCT_GUI_SL_STYLE_SELRANGE) {
7643 fputs(dkct_gui_out_kw[111], psrc->fipo);
7644 }
7645 if((co->sliderStyle) & DKCT_GUI_SL_STYLE_INVERSE) {
7646 fputs(dkct_gui_out_kw[112], psrc->fipo);
7647 }
7648 if(det > 2) {
7649 dkct_gui_next_argument(psrc);
7650 fputs(co->validator, psrc->fipo);
7651 }
7652 }
7653 }
7654 fputs(dkct_gui_out_kw[0], psrc->fipo);
7655 }
7656
7657
7658
7659 /** Write element constructor text control
7660 @param co Current object.
7661 @param dp Direct parent.
7662 @param pw Parent window.
7663 @param psrc Source structure.
7664 @param gui GUI description.
7665 */
7666 static
7667 void
dkct_gui_constructor_textctrl(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7668 dkct_gui_constructor_textctrl(
7669 DKCT_GUI_ELEMENT *co,
7670 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7671 DKCT_GUI_ELEMENT *pw,
7672 DKCT_SRC *psrc,
7673 DKCT_GUI *gui
7674 )
7675 {
7676 int det = 0; /* Details level. */
7677 int fe = 0; /* Flag: Found entry. */
7678 /*
7679 parent, id, value (1), pos, size (2), style (3), validator (4)
7680 */
7681 DK3_UNUSED_ARG(dp)
7682 if(co->text) det = 1;
7683 if((co->sizex > 0) && (co->sizey > 0)) det = 2;
7684 if(co->textStyle) det = 3;
7685 if(co->validator) det = 4;
7686 fputs(dkct_gui_out_kw[2], psrc->fipo);
7687 dkct_gui_write_parent_name(pw, psrc, gui);
7688 dkct_gui_next_argument(psrc);
7689 dkct_gui_write_idname(co, psrc);
7690 if(det) {
7691 dkct_gui_next_argument(psrc);
7692 if(co->text) {
7693 fputs(co->text, psrc->fipo);
7694 } else {
7695 fputs(dkct_gui_out_kw[73], psrc->fipo);
7696 }
7697 if(det > 1) {
7698 dkct_gui_next_argument(psrc);
7699 fputs(dkct_gui_out_kw[74], psrc->fipo);
7700 dkct_gui_next_argument(psrc);
7701 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7702 if(det > 2) {
7703 dkct_gui_next_argument(psrc);
7704 if((co->textStyle) & DKCT_GUI_TEXT_ENTER) {
7705 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7706 fputs(dkct_gui_out_kw[121], psrc->fipo);
7707 }
7708 if((co->textStyle) & DKCT_GUI_TEXT_TAB) {
7709 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7710 fputs(dkct_gui_out_kw[122], psrc->fipo);
7711 }
7712 if((co->textStyle) & DKCT_GUI_TEXT_MULTILINE) {
7713 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7714 fputs(dkct_gui_out_kw[123], psrc->fipo);
7715 }
7716 if((co->textStyle) & DKCT_GUI_TEXT_PASSWORD) {
7717 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7718 fputs(dkct_gui_out_kw[124], psrc->fipo);
7719 }
7720 if((co->textStyle) & DKCT_GUI_TEXT_READONLY) {
7721 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7722 fputs(dkct_gui_out_kw[125], psrc->fipo);
7723 }
7724 if((co->textStyle) & DKCT_GUI_TEXT_RICH) {
7725 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7726 fputs(dkct_gui_out_kw[126], psrc->fipo);
7727 }
7728 if((co->textStyle) & DKCT_GUI_TEXT_RICH2) {
7729 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7730 fputs(dkct_gui_out_kw[127], psrc->fipo);
7731 }
7732 if((co->textStyle) & DKCT_GUI_TEXT_URL) {
7733 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7734 fputs(dkct_gui_out_kw[128], psrc->fipo);
7735 }
7736 if((co->textStyle) & DKCT_GUI_TEXT_SHOWSEL) {
7737 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7738 fputs(dkct_gui_out_kw[129], psrc->fipo);
7739 }
7740 if((co->textStyle) & DKCT_GUI_TEXT_LEFT) {
7741 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7742 fputs(dkct_gui_out_kw[130], psrc->fipo);
7743 }
7744 if((co->textStyle) & DKCT_GUI_TEXT_CENTRE) {
7745 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7746 fputs(dkct_gui_out_kw[131], psrc->fipo);
7747 }
7748 if((co->textStyle) & DKCT_GUI_TEXT_RIGHT) {
7749 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7750 fputs(dkct_gui_out_kw[132], psrc->fipo);
7751 }
7752 if((co->textStyle) & DKCT_GUI_TEXT_NOWRAP) {
7753 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7754 fputs(dkct_gui_out_kw[133], psrc->fipo);
7755 }
7756 if((co->textStyle) & DKCT_GUI_TEXT_CHARWRAP) {
7757 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7758 fputs(dkct_gui_out_kw[134], psrc->fipo);
7759 }
7760 if((co->textStyle) & DKCT_GUI_TEXT_WORDWRAP) {
7761 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7762 fputs(dkct_gui_out_kw[135], psrc->fipo);
7763 }
7764 if((co->textStyle) & DKCT_GUI_TEXT_BESTWRAP) {
7765 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7766 fputs(dkct_gui_out_kw[136], psrc->fipo);
7767 }
7768 if((co->textStyle) & DKCT_GUI_TEXT_CAPITALIZE) {
7769 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); } fe = 1;
7770 fputs(dkct_gui_out_kw[137], psrc->fipo);
7771 }
7772 if(!(fe)) { fputs(dkct_gui_out_kw[52], psrc->fipo); }
7773 }
7774 }
7775 }
7776 fputs(dkct_gui_out_kw[0], psrc->fipo);
7777 }
7778
7779
7780
7781 /** Write element constructor toggle button.
7782 @param co Current object.
7783 @param dp Direct parent.
7784 @param pw Parent window.
7785 @param psrc Source structure.
7786 @param gui GUI description.
7787 */
7788 static
7789 void
dkct_gui_constructor_togglebutton(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7790 dkct_gui_constructor_togglebutton(
7791 DKCT_GUI_ELEMENT *co,
7792 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7793 DKCT_GUI_ELEMENT *pw,
7794 DKCT_SRC *psrc,
7795 DKCT_GUI *gui
7796 )
7797 {
7798 int det = 0; /* Details level. */
7799 /*
7800 parent, id, label, pos, size (1), style (2), validator (3)
7801 */
7802 DK3_UNUSED_ARG(dp)
7803 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
7804 if(co->validator) det = 3;
7805 fputs(dkct_gui_out_kw[2], psrc->fipo);
7806 dkct_gui_write_parent_name(pw, psrc, gui);
7807 dkct_gui_next_argument(psrc);
7808 dkct_gui_write_idname(co, psrc);
7809 dkct_gui_next_argument(psrc);
7810 if(co->text) {
7811 fputs(co->text, psrc->fipo);
7812 } else {
7813 fputs(dkct_gui_out_kw[73], psrc->fipo);
7814 }
7815 if(det) {
7816 dkct_gui_next_argument(psrc);
7817 fputs(dkct_gui_out_kw[74], psrc->fipo);
7818 dkct_gui_next_argument(psrc);
7819 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7820 if(det > 1) {
7821 dkct_gui_next_argument(psrc);
7822 fputs(dkct_gui_out_kw[52], psrc->fipo);
7823 if(det > 2) {
7824 dkct_gui_next_argument(psrc);
7825 fputs(co->validator, psrc->fipo);
7826 }
7827 }
7828 }
7829 }
7830
7831
7832
7833 /** Write element constructor for gauge.
7834 @param co Current object.
7835 @param dp Direct parent.
7836 @param pw Parent window.
7837 @param psrc Source structure.
7838 @param gui GUI description.
7839 */
7840 static
7841 void
dkct_gui_constructor_gauge(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7842 dkct_gui_constructor_gauge(
7843 DKCT_GUI_ELEMENT *co,
7844 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7845 DKCT_GUI_ELEMENT *pw,
7846 DKCT_SRC *psrc,
7847 DKCT_GUI *gui
7848 )
7849 {
7850 int det = 0; /* Details level. */
7851 char bu[64]; /* Buffer for numeric values. */
7852 /*
7853 parent, id, range, pos, size (1), style (2), validator (3)
7854 */
7855 DK3_UNUSED_ARG(dp)
7856 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
7857 if(co->direction != DKCT_GUI_DIRECTION_HORIZONTAL) det = 2;
7858 if(co->gaugeStyle) det = 2;
7859 if(co->validator) det = 3;
7860 fputs(dkct_gui_out_kw[2], psrc->fipo);
7861 dkct_gui_write_parent_name(pw, psrc, gui);
7862 dkct_gui_next_argument(psrc);
7863 dkct_gui_write_idname(co, psrc);
7864 sprintf(bu, "%d", co->spinMax);
7865 dkct_gui_next_argument(psrc);
7866 fputs(bu, psrc->fipo);
7867 if(det) {
7868 dkct_gui_next_argument(psrc);
7869 fputs(dkct_gui_out_kw[74], psrc->fipo);
7870 dkct_gui_next_argument(psrc);
7871 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7872 if(det > 1) {
7873 dkct_gui_next_argument(psrc);
7874 if(co->direction == DKCT_GUI_DIRECTION_HORIZONTAL) {
7875 fputs(dkct_gui_out_kw[160], psrc->fipo);
7876 } else {
7877 fputs(dkct_gui_out_kw[161], psrc->fipo);
7878 }
7879 if((co->gaugeStyle) & DKCT_GUI_GAUGE_SMOOTH) {
7880 fputs(dkct_gui_out_kw[162], psrc->fipo);
7881 }
7882 if(det > 2) {
7883 dkct_gui_next_argument(psrc);
7884 fputs(co->validator, psrc->fipo);
7885 }
7886 }
7887 }
7888 fputs(dkct_gui_out_kw[0], psrc->fipo);
7889 }
7890
7891
7892
7893 /** Write element constructor for static text.
7894 @param co Current object.
7895 @param dp Direct parent.
7896 @param pw Parent window.
7897 @param psrc Source structure.
7898 @param gui GUI description.
7899 */
7900 static
7901 void
dkct_gui_constructor_statictext(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7902 dkct_gui_constructor_statictext(
7903 DKCT_GUI_ELEMENT *co,
7904 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7905 DKCT_GUI_ELEMENT *pw,
7906 DKCT_SRC *psrc,
7907 DKCT_GUI *gui
7908 )
7909 {
7910 unsigned long mask; /* Mask for check. */
7911 int det = 0; /* Details level. */
7912 int fe = 0; /* Flag: Found entry. */
7913 /*
7914 parent, id, label, pos, size (1), style (2)
7915 */
7916 DK3_UNUSED_ARG(dp)
7917 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
7918 mask = DKCT_GUI_TEXT_LEFT;
7919 mask |= DKCT_GUI_TEXT_CENTRE;
7920 mask |= DKCT_GUI_TEXT_RIGHT;
7921 mask |= DKCT_GUI_TEXT_NO_AUTORESIZE;
7922 if((co->textStyle) & mask) det = 2;
7923 fputs(dkct_gui_out_kw[2], psrc->fipo);
7924 dkct_gui_write_parent_name(pw, psrc, gui);
7925 dkct_gui_next_argument(psrc);
7926 dkct_gui_write_idname(co, psrc);
7927 dkct_gui_next_argument(psrc);
7928 if(co->text) {
7929 fputs(co->text, psrc->fipo);
7930 } else {
7931 fputs(dkct_gui_out_kw[73], psrc->fipo);
7932 }
7933 if(det) {
7934 dkct_gui_next_argument(psrc);
7935 fputs(dkct_gui_out_kw[74], psrc->fipo);
7936 dkct_gui_next_argument(psrc);
7937 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7938 if(det > 1) {
7939 dkct_gui_next_argument(psrc);
7940 if((co->textStyle) & DKCT_GUI_TEXT_LEFT) {
7941 fputs(dkct_gui_out_kw[45], psrc->fipo); fe = 1;
7942 } else {
7943 if((co->textStyle) & DKCT_GUI_TEXT_CENTRE) {
7944 fputs(dkct_gui_out_kw[163], psrc->fipo); fe = 1;
7945 } else {
7946 if((co->textStyle) & DKCT_GUI_TEXT_RIGHT) {
7947 fputs(dkct_gui_out_kw[47], psrc->fipo); fe = 1;
7948 }
7949 }
7950 }
7951 if((co->textStyle) & DKCT_GUI_TEXT_NOWRAP) {
7952 if(fe) { fputs(dkct_gui_out_kw[44], psrc->fipo); }
7953 fputs(dkct_gui_out_kw[164], psrc->fipo);
7954 fe = 1;
7955 }
7956 if(!(fe)) { fputs(dkct_gui_out_kw[52], psrc->fipo); }
7957 }
7958 }
7959 fputs(dkct_gui_out_kw[0], psrc->fipo);
7960 }
7961
7962
7963
7964 /** Write element constructor for static bitmap.
7965 @param co Current object.
7966 @param dp Direct parent.
7967 @param pw Parent window.
7968 @param psrc Source structure.
7969 @param gui GUI description.
7970 */
7971 static
7972 void
dkct_gui_constructor_staticbitmap(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)7973 dkct_gui_constructor_staticbitmap(
7974 DKCT_GUI_ELEMENT *co,
7975 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
7976 DKCT_GUI_ELEMENT *pw,
7977 DKCT_SRC *psrc,
7978 DKCT_GUI *gui
7979 )
7980 {
7981 int det = 0; /* Details level. */
7982 /*
7983 parent, id, bitmap, pos, size (1), style (2)
7984 */
7985 DK3_UNUSED_ARG(dp)
7986 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
7987 if(co->bitmapVarName) {
7988 fputs(dkct_gui_out_kw[2], psrc->fipo);
7989 dkct_gui_write_parent_name(pw, psrc, gui);
7990 dkct_gui_next_argument(psrc);
7991 dkct_gui_write_idname(co, psrc);
7992 dkct_gui_next_argument(psrc);
7993 fputs(co->bitmapVarName, psrc->fipo);
7994 if(det) {
7995 dkct_gui_next_argument(psrc);
7996 fputs(dkct_gui_out_kw[74], psrc->fipo);
7997 dkct_gui_next_argument(psrc);
7998 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
7999 }
8000 fputs(dkct_gui_out_kw[0], psrc->fipo);
8001 } else {
8002 /* ERROR: No bitmap specified! */
8003 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 51);
8004 }
8005 }
8006
8007
8008
8009 /** Write element constructor for static line.
8010 @param co Current object.
8011 @param dp Direct parent.
8012 @param pw Parent window.
8013 @param psrc Source structure.
8014 @param gui GUI description.
8015 */
8016 static
8017 void
dkct_gui_constructor_staticline(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)8018 dkct_gui_constructor_staticline(
8019 DKCT_GUI_ELEMENT *co,
8020 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
8021 DKCT_GUI_ELEMENT *pw,
8022 DKCT_SRC *psrc,
8023 DKCT_GUI *gui
8024 )
8025 {
8026 int det = 0; /* Details level. */
8027 /*
8028 parent, id, pos, size (1), style (2)
8029 */
8030 DK3_UNUSED_ARG(dp)
8031 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
8032 if(co->direction != DKCT_GUI_DIRECTION_HORIZONTAL) det = 2;
8033 fputs(dkct_gui_out_kw[2], psrc->fipo);
8034 dkct_gui_write_parent_name(pw, psrc, gui);
8035 dkct_gui_next_argument(psrc);
8036 dkct_gui_write_idname(co, psrc);
8037 if(det) {
8038 dkct_gui_next_argument(psrc);
8039 fputs(dkct_gui_out_kw[74], psrc->fipo);
8040 dkct_gui_next_argument(psrc);
8041 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
8042 if(det > 1) {
8043 dkct_gui_next_argument(psrc);
8044 if(co->direction == DKCT_GUI_DIRECTION_HORIZONTAL) {
8045 fputs(dkct_gui_out_kw[165], psrc->fipo);
8046 } else {
8047 fputs(dkct_gui_out_kw[166], psrc->fipo);
8048 }
8049 }
8050 }
8051 fputs(dkct_gui_out_kw[0], psrc->fipo);
8052 }
8053
8054
8055
8056 /** Write element constructor for static box.
8057 @param co Current object.
8058 @param dp Direct parent.
8059 @param pw Parent window.
8060 @param psrc Source structure.
8061 @param gui GUI description.
8062 */
8063 static
8064 void
dkct_gui_constructor_staticbox(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)8065 dkct_gui_constructor_staticbox(
8066 DKCT_GUI_ELEMENT *co,
8067 DKCT_GUI_ELEMENT *DK3_SILENCE_ARG_UNUSED(dp),
8068 DKCT_GUI_ELEMENT *pw,
8069 DKCT_SRC *psrc,
8070 DKCT_GUI *gui
8071 )
8072 {
8073 int det = 0; /* Details level. */
8074 /*
8075 parent, id, label, pos, size (1), style (2)
8076 */
8077 DK3_UNUSED_ARG(dp)
8078 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
8079 fputs(dkct_gui_out_kw[2], psrc->fipo);
8080 dkct_gui_write_parent_name(pw, psrc, gui);
8081 dkct_gui_next_argument(psrc);
8082 dkct_gui_write_idname(co, psrc);
8083 dkct_gui_next_argument(psrc);
8084 if (NULL != co->text) {
8085 fputs(co->text, psrc->fipo);
8086 } else {
8087 fputs(dkct_gui_out_kw[73], psrc->fipo);
8088 }
8089 if(det) {
8090 dkct_gui_next_argument(psrc);
8091 fputs(dkct_gui_out_kw[74], psrc->fipo);
8092 dkct_gui_next_argument(psrc);
8093 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
8094 if(det > 1) {
8095 }
8096 }
8097 fputs(dkct_gui_out_kw[0], psrc->fipo);
8098 }
8099
8100
8101
8102 /** Write element constructor for menu bar.
8103 @param co Current object.
8104 @param dp Direct parent.
8105 @param pw Parent window.
8106 @param psrc Source structure.
8107 @param gui GUI description.
8108 */
8109 static
8110 void
dkct_gui_constructor_menubar(DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (co),DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * DK3_SILENCE_ARG_UNUSED (psrc),DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))8111 dkct_gui_constructor_menubar(
8112 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(co),
8113 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
8114 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
8115 DKCT_SRC * DK3_SILENCE_ARG_UNUSED(psrc),
8116 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
8117 )
8118 {
8119 /*
8120 No constructor arguments.
8121 */
8122 DK3_UNUSED_ARG(co)
8123 DK3_UNUSED_ARG(dp)
8124 DK3_UNUSED_ARG(pw)
8125 DK3_UNUSED_ARG(psrc)
8126 DK3_UNUSED_ARG(gui)
8127 }
8128
8129
8130
8131 /** Write element constructor for menu.
8132 @param co Current object.
8133 @param dp Direct parent.
8134 @param pw Parent window.
8135 @param psrc Source structure.
8136 @param gui GUI description.
8137 */
8138 static
8139 void
dkct_gui_constructor_menu(DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (co),DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * DK3_SILENCE_ARG_UNUSED (psrc),DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))8140 dkct_gui_constructor_menu(
8141 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(co),
8142 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
8143 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
8144 DKCT_SRC * DK3_SILENCE_ARG_UNUSED(psrc),
8145 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
8146 )
8147 {
8148 /*
8149 No constructor arguments.
8150 */
8151 DK3_UNUSED_ARG(co)
8152 DK3_UNUSED_ARG(dp)
8153 DK3_UNUSED_ARG(pw)
8154 DK3_UNUSED_ARG(psrc)
8155 DK3_UNUSED_ARG(gui)
8156 }
8157
8158
8159
8160 /** Write element constructor for menu item.
8161 @param co Current object.
8162 @param dp Direct parent.
8163 @param pw Parent window.
8164 @param psrc Source structure.
8165 @param gui GUI description.
8166 */
8167 static
8168 void
dkct_gui_constructor_menuitem(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * dp,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))8169 dkct_gui_constructor_menuitem(
8170 DKCT_GUI_ELEMENT *co,
8171 DKCT_GUI_ELEMENT *dp,
8172 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
8173 DKCT_SRC *psrc,
8174 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
8175 )
8176 {
8177 /*
8178 parent->Append(id, label, helpstring, kind);
8179 */
8180 DK3_UNUSED_ARG(pw)
8181 DK3_UNUSED_ARG(gui)
8182 #if 0
8183 fputs(dkct_gui_out_kw[2], psrc->fipo);
8184 dkct_gui_write_parent_name(pw, psrc, gui);
8185 dkct_gui_next_argument(psrc);
8186 if(co->menuItemStyle == DKCT_GUI_MENU_ITEM_SEPARATOR) {
8187 fputs(dkct_gui_out_kw[171], psrc->fipo);
8188 } else {
8189 if(co->idname) {
8190 fputs(co->idname, psrc->fipo);
8191 } else {
8192 fputs(dkct_gui_out_kw[171], psrc->fipo);
8193 }
8194 }
8195 dkct_gui_next_argument(psrc);
8196 if(co->text) {
8197 fputs(co->text, psrc->fipo);
8198 } else {
8199 fputs(dkct_gui_out_kw[73], psrc->fipo);
8200 }
8201 dkct_gui_next_argument(psrc);
8202 if(co->tipText) {
8203 fputs(co->tipText, psrc->fipo);
8204 } else {
8205 fputs(dkct_gui_out_kw[73], psrc->fipo);
8206 }
8207 dkct_gui_next_argument(psrc);
8208 switch(co->menuItemStyle) {
8209 case DKCT_GUI_MENU_ITEM_SEPARATOR: {
8210 fputs(dkct_gui_out_kw[168], psrc->fipo);
8211 } break;
8212 case DKCT_GUI_MENU_ITEM_CHECK: {
8213 fputs(dkct_gui_out_kw[169], psrc->fipo);
8214 } break;
8215 case DKCT_GUI_MENU_ITEM_RADIO: {
8216 fputs(dkct_gui_out_kw[170], psrc->fipo);
8217 } break;
8218 default: {
8219 fputs(dkct_gui_out_kw[167], psrc->fipo);
8220 } break;
8221 }
8222 fputs(dkct_gui_out_kw[0], psrc->fipo);
8223 #else
8224 if(dp) {
8225 if((dp->name) && (co->name)) {
8226 fputs(dkct_gui_out_kw[8], psrc->fipo);
8227 fputs(co->name, psrc->fipo);
8228 fputs(dkct_gui_out_kw[194], psrc->fipo);
8229 fputs(dp->name, psrc->fipo);
8230 switch(co->menuItemStyle) {
8231 case DKCT_GUI_MENU_ITEM_SEPARATOR: {
8232 fputs(dkct_gui_out_kw[193], psrc->fipo);
8233 } break;
8234 case DKCT_GUI_MENU_ITEM_CHECK: {
8235 fputs(dkct_gui_out_kw[191], psrc->fipo);
8236 } break;
8237 case DKCT_GUI_MENU_ITEM_RADIO: {
8238 fputs(dkct_gui_out_kw[192], psrc->fipo);
8239 } break;
8240 default: {
8241 fputs(dkct_gui_out_kw[184], psrc->fipo);
8242 } break;
8243 }
8244 if(co->menuItemStyle != DKCT_GUI_MENU_ITEM_SEPARATOR) {
8245 fputs(dkct_gui_out_kw[0], psrc->fipo);
8246 fputs(dkct_gui_out_kw[2], psrc->fipo);
8247 if(co->idname) {
8248 fputs(co->idname, psrc->fipo);
8249 } else {
8250 fputs(dkct_gui_out_kw[171], psrc->fipo);
8251 }
8252 dkct_gui_next_argument(psrc);
8253 if(co->text) {
8254 fputs(co->text, psrc->fipo);
8255 } else {
8256 fputs(dkct_gui_out_kw[73], psrc->fipo);
8257 }
8258 dkct_gui_next_argument(psrc);
8259 if(co->tipText) {
8260 fputs(co->tipText, psrc->fipo);
8261 } else {
8262 fputs(dkct_gui_out_kw[73], psrc->fipo);
8263 }
8264 fputs(dkct_gui_out_kw[0], psrc->fipo);
8265 fputs(dkct_gui_out_kw[8], psrc->fipo);
8266 }
8267 fputs(dkct_gui_out_kw[24], psrc->fipo);
8268 fputs(dkct_gui_out_kw[0], psrc->fipo);
8269 }
8270 }
8271 #endif
8272 }
8273
8274
8275
8276 /** Write element constructor for menu item.
8277 @param co Current object.
8278 @param dp Direct parent.
8279 @param pw Parent window.
8280 @param psrc Source structure.
8281 @param gui GUI description.
8282 */
8283 static
8284 void
dkct_gui_constructor_toolbartoolbase(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * dp,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))8285 dkct_gui_constructor_toolbartoolbase(
8286 DKCT_GUI_ELEMENT *co,
8287 DKCT_GUI_ELEMENT *dp,
8288 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
8289 DKCT_SRC *psrc,
8290 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
8291 )
8292 {
8293 /*
8294 id, text, bitmap, disbitmap (1), kind (2), tip (3)
8295 */
8296 DK3_UNUSED_ARG(pw)
8297 DK3_UNUSED_ARG(gui)
8298 fputs(dkct_gui_out_kw[8], psrc->fipo);
8299 if(co->menuItemStyle != DKCT_GUI_MENU_ITEM_SEPARATOR) {
8300 fputs(co->name, psrc->fipo);
8301 fputs(dkct_gui_out_kw[194], psrc->fipo);
8302 }
8303 fputs(dp->name, psrc->fipo);
8304 fputs(dkct_gui_out_kw[185], psrc->fipo);
8305 fputs(dkct_gui_out_kw[2], psrc->fipo);
8306 dkct_gui_write_idname(co, psrc);
8307 dkct_gui_next_argument(psrc);
8308 if(co->text) {
8309 fputs(co->text, psrc->fipo);
8310 } else {
8311 fputs(dkct_gui_out_kw[73], psrc->fipo);
8312 }
8313 dkct_gui_next_argument(psrc);
8314 fputs(co->bitmapVarName, psrc->fipo);
8315 dkct_gui_next_argument(psrc);
8316 if(co->bitmapDisabled) {
8317 fputs(co->bitmapDisabled, psrc->fipo);
8318 } else {
8319 fputs(dkct_gui_out_kw[186], psrc->fipo);
8320 }
8321 /* ITEM KIND */
8322 dkct_gui_next_argument(psrc);
8323 switch(co->menuItemStyle) {
8324 case DKCT_GUI_MENU_ITEM_SEPARATOR: {
8325 fputs(dkct_gui_out_kw[169], psrc->fipo);
8326 } break;
8327 case DKCT_GUI_MENU_ITEM_CHECK: {
8328 fputs(dkct_gui_out_kw[169], psrc->fipo);
8329 } break;
8330 case DKCT_GUI_MENU_ITEM_RADIO: {
8331 fputs(dkct_gui_out_kw[170], psrc->fipo);
8332 } break;
8333 default: {
8334 fputs(dkct_gui_out_kw[167], psrc->fipo);
8335 } break;
8336 }
8337 if(co->tipText) {
8338 dkct_gui_next_argument(psrc);
8339 fputs(co->tipText, psrc->fipo);
8340 }
8341 fputs(dkct_gui_out_kw[0], psrc->fipo);
8342 fputs(dkct_gui_out_kw[8], psrc->fipo);
8343 fputs(dkct_gui_out_kw[24], psrc->fipo);
8344 fputs(dkct_gui_out_kw[0], psrc->fipo);
8345 }
8346
8347
8348
8349 /** Write element constructor for tool bar.
8350 @param co Current object.
8351 @param dp Direct parent.
8352 @param pw Parent window.
8353 @param psrc Source structure.
8354 @param gui GUI description.
8355 */
8356 static
8357 void
dkct_gui_constructor_toolbar(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * dp,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))8358 dkct_gui_constructor_toolbar(
8359 DKCT_GUI_ELEMENT *co,
8360 DKCT_GUI_ELEMENT *dp,
8361 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
8362 DKCT_SRC *psrc,
8363 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
8364 )
8365 {
8366 int det = 0; /* Details level. */
8367 /*
8368 parent, id, pos, size (1), style (2)
8369 */
8370 DK3_UNUSED_ARG(pw)
8371 DK3_UNUSED_ARG(gui)
8372 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
8373 if(co->direction != DKCT_GUI_DIRECTION_HORIZONTAL) det = 2;
8374 if(co->toolbarStyle != DKCT_GUI_TOOLBAR_FLAT) det = 2;
8375 fputs(dkct_gui_out_kw[2], psrc->fipo);
8376 #if 0
8377 dkct_gui_write_parent_name(pw, psrc, gui);
8378 #endif
8379 if(dp) {
8380 if(dp->name) {
8381 fputs(dp->name, psrc->fipo);
8382 } else {
8383 fputs(dkct_gui_out_kw[65], psrc->fipo);
8384 }
8385 } else {
8386 fputs(dkct_gui_out_kw[65], psrc->fipo);
8387 }
8388 dkct_gui_next_argument(psrc);
8389 dkct_gui_write_idname(co, psrc);
8390 if(det) {
8391 dkct_gui_next_argument(psrc);
8392 fputs(dkct_gui_out_kw[74], psrc->fipo);
8393 dkct_gui_next_argument(psrc);
8394 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
8395 if(det > 1) {
8396 dkct_gui_next_argument(psrc);
8397 switch(co->direction) {
8398 case DKCT_GUI_DIRECTION_VERTICAL: {
8399 fputs(dkct_gui_out_kw[173], psrc->fipo);
8400 } break;
8401 default: {
8402 fputs(dkct_gui_out_kw[172], psrc->fipo);
8403 } break;
8404 }
8405 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_FLAT) {
8406 fputs(dkct_gui_out_kw[174], psrc->fipo);
8407 }
8408 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_DOCKABLE) {
8409 fputs(dkct_gui_out_kw[175], psrc->fipo);
8410 }
8411 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_TEXT) {
8412 fputs(dkct_gui_out_kw[176], psrc->fipo);
8413 }
8414 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_NOICONS) {
8415 fputs(dkct_gui_out_kw[177], psrc->fipo);
8416 }
8417 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_NODIVIDER) {
8418 fputs(dkct_gui_out_kw[178], psrc->fipo);
8419 }
8420 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_HORZ_LAYOUT) {
8421 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_TEXT) {
8422 if(!((co->toolbarStyle) & DKCT_GUI_TOOLBAR_NOICONS)) {
8423 fputs(dkct_gui_out_kw[180], psrc->fipo);
8424 }
8425 }
8426 }
8427 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_NO_TOOLTIPS) {
8428 fputs(dkct_gui_out_kw[181], psrc->fipo);
8429 }
8430 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_BOTTOM) {
8431 fputs(dkct_gui_out_kw[182], psrc->fipo);
8432 }
8433 if((co->toolbarStyle) & DKCT_GUI_TOOLBAR_RIGHT) {
8434 fputs(dkct_gui_out_kw[183], psrc->fipo);
8435 }
8436 }
8437 }
8438 fputs(dkct_gui_out_kw[0], psrc->fipo);
8439 }
8440
8441
8442
8443 /** Write element constructor for grid.
8444 @param co Current object.
8445 @param dp Direct parent.
8446 @param pw Parent window.
8447 @param psrc Source structure.
8448 @param gui GUI description.
8449 */
8450 static
8451 void
dkct_gui_constructor_grid(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)8452 dkct_gui_constructor_grid(
8453 DKCT_GUI_ELEMENT *co,
8454 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
8455 DKCT_GUI_ELEMENT *pw,
8456 DKCT_SRC *psrc,
8457 DKCT_GUI *gui
8458 )
8459 {
8460 /* parent, id, pos, size (1), style, name */
8461 int det = 0;
8462 DK3_UNUSED_ARG(dp)
8463 if((co->sizex > 0) && (co->sizey > 0)) det = 1;
8464 fputs(dkct_gui_out_kw[2], psrc->fipo);
8465 dkct_gui_write_parent_name(pw, psrc, gui);
8466 dkct_gui_next_argument(psrc);
8467 dkct_gui_write_idname(co, psrc);
8468 if(det) {
8469 dkct_gui_next_argument(psrc);
8470 fputs(dkct_gui_out_kw[74], psrc->fipo);
8471 dkct_gui_next_argument(psrc);
8472 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
8473 if(det > 1) {
8474 }
8475 }
8476 fputs(dkct_gui_out_kw[0], psrc->fipo);
8477 }
8478
8479
8480
8481 #if 0
8482 /** Write element constructor (parent, id and text).
8483 @param co Current object.
8484 @param dp Direct parent.
8485 @param pw Parent window.
8486 @param psrc Source structure.
8487 @param gui GUI description.
8488 */
8489 static
8490 void
8491 dkct_gui_constructor_parent_id_and_text(
8492 DKCT_GUI_ELEMENT *co,
8493 DKCT_GUI_ELEMENT *dp,
8494 DKCT_GUI_ELEMENT *pw,
8495 DKCT_SRC *psrc,
8496 DKCT_GUI *gui
8497 )
8498 {
8499 fputs(dkct_gui_out_kw[2], psrc->fipo);
8500 dkct_gui_write_parent_name(pw, psrc, gui);
8501 dkct_gui_next_argument(psrc);
8502 dkct_gui_write_idname(co, psrc);
8503 if(co->text) {
8504 dkct_gui_next_argument(psrc);
8505 fputs(co->text, psrc->fipo);
8506 }
8507 fputs(dkct_gui_out_kw[0], psrc->fipo);
8508 }
8509 #endif
8510
8511
8512 #if 0
8513 /** Write element constructor (parent, id and bitmap).
8514 @param co Current object.
8515 @param dp Direct parent.
8516 @param pw Parent window.
8517 @param psrc Source structure.
8518 @param gui GUI description.
8519 */
8520 static
8521 void
8522 dkct_gui_constructor_parent_id_and_bitmap(
8523 DKCT_GUI_ELEMENT *co,
8524 DKCT_GUI_ELEMENT *dp,
8525 DKCT_GUI_ELEMENT *pw,
8526 DKCT_SRC *psrc,
8527 DKCT_GUI *gui
8528 )
8529 {
8530 if(co->bitmapVarName) {
8531 fputs(dkct_gui_out_kw[2], psrc->fipo);
8532 dkct_gui_write_parent_name(pw, psrc, gui);
8533 dkct_gui_next_argument(psrc);
8534 dkct_gui_write_idname(co, psrc);
8535 if(co->bitmapVarName) {
8536 dkct_gui_next_argument(psrc);
8537 fputs(co->bitmapVarName, psrc->fipo);
8538 }
8539 fputs(dkct_gui_out_kw[0], psrc->fipo);
8540 } else {
8541 /* ERROR: No bitmap expression specified! */
8542 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 51);
8543 }
8544 }
8545 #endif
8546
8547
8548
8549 /** Write instruction to set bitmap.
8550 @param co Current object.
8551 @param psrc Source structure.
8552 @param szind Index of method name.
8553 @param bm Bitmap value.
8554 */
8555 static
8556 void
dkct_gui_write_set_bitmap(DKCT_GUI_ELEMENT * co,DKCT_SRC * psrc,size_t szind,char * bm)8557 dkct_gui_write_set_bitmap(
8558 DKCT_GUI_ELEMENT *co,
8559 DKCT_SRC *psrc,
8560 size_t szind,
8561 char *bm
8562 )
8563 {
8564 if(co->name) {
8565 fputs(dkct_gui_out_kw[8], psrc->fipo);
8566 fputs(co->name, psrc->fipo);
8567 fputs(dkct_gui_out_kw[szind], psrc->fipo);
8568 fputs(bm, psrc->fipo);
8569 fputs(dkct_gui_out_kw[24], psrc->fipo);
8570 fputs(dkct_gui_out_kw[0], psrc->fipo);
8571 }
8572 }
8573
8574
8575
8576 /** Write element constructor and add element to parent
8577 object or sizer.
8578 @param co Current object.
8579 @param dp Direct parent.
8580 @param pw Parent window.
8581 @param psrc Source structure.
8582 @param gui GUI description.
8583 */
8584 static
8585 void
dkct_gui_finalize_after_constructor(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * psrc,DKCT_GUI * DK3_SILENCE_ARG_UNUSED (gui))8586 dkct_gui_finalize_after_constructor(
8587 DKCT_GUI_ELEMENT *co,
8588 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
8589 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
8590 DKCT_SRC *psrc,
8591 DKCT_GUI * DK3_SILENCE_ARG_UNUSED(gui)
8592 )
8593 {
8594 DKCT_GRID_HEAD *gh = NULL;
8595 DKCT_CELL_DATA *pcd = NULL;
8596 char const *fnptr = NULL; /* File to use for debug output. */
8597 int rows = 0;
8598 int columns= 0;
8599
8600 DK3_UNUSED_ARG(dp)
8601 DK3_UNUSED_ARG(pw)
8602 DK3_UNUSED_ARG(gui)
8603 /*
8604 Jump to end if construction failed.
8605 if(!(object)) {
8606 goto dkctGUILayoutFinished;
8607 }
8608 */
8609 fnptr = dkct_tr_get_kw8(((psrc->dkcto).deb == 2) ? 28 : 29);
8610 fputs(dkct_gui_out_kw[25], psrc->fipo);
8611 fputs(co->name, psrc->fipo);
8612 fputs(dkct_gui_out_kw[26], psrc->fipo);
8613 if((psrc->dkcto).deb) {
8614
8615 fputs(dkct_tr_get_kw8(24), psrc->fipo);
8616 if((psrc->dkcto).win) {
8617 fputs(dkct_tr_get_kw8(21), psrc->fipo);
8618 /* 16-bit begin */
8619 if((psrc->dkcto).deb != 2) {
8620 fputs(dkct_tr_get_kw8(30), psrc->fipo);
8621 }
8622 if((psrc->dkcto).ts) {
8623 if((psrc->dkcto).deb == 2) {
8624 fputs(dkct_tr_get_kw8(72), psrc->fipo);
8625 } else {
8626 fputs(dkct_tr_get_kw8(71), psrc->fipo);
8627 }
8628 }
8629 fputs(dkct_tr_get_kw8(61), psrc->fipo);
8630 dkct_tr_show_filename_and_lineno(psrc);
8631 fputs(dkct_tr_get_kw8(35), psrc->fipo);
8632 fputs(fnptr, psrc->fipo);
8633 fputs(dkct_tr_get_kw8(34), psrc->fipo);
8634 fputs(dkct_tr_get_kw8(61), psrc->fipo);
8635 fputs(dkct_tr_get_kw8(73), psrc->fipo);
8636 if(co->name) {
8637 fputs(co->name, psrc->fipo);
8638 }
8639 fputs(dkct_tr_get_kw8(74), psrc->fipo);
8640 fputs(dkct_tr_get_kw8(35), psrc->fipo);
8641 fputs(fnptr, psrc->fipo);
8642 fputs(dkct_tr_get_kw8(34), psrc->fipo);
8643 if((psrc->dkcto).deb != 2) {
8644 fputs(dkct_tr_get_kw8(31), psrc->fipo);
8645 }
8646 /* 16-bit end */
8647 fputs(dkct_tr_get_kw8(22), psrc->fipo);
8648 }
8649 /* 8-bit begin */
8650 if((psrc->dkcto).deb != 2) {
8651 fputs(dkct_tr_get_kw8(30), psrc->fipo);
8652 }
8653 if((psrc->dkcto).ts) {
8654 if((psrc->dkcto).deb == 2) {
8655 fputs(dkct_tr_get_kw8(70), psrc->fipo);
8656 } else {
8657 fputs(dkct_tr_get_kw8(32), psrc->fipo);
8658 }
8659 }
8660 fputs(dkct_tr_get_kw8(33), psrc->fipo);
8661 dkct_tr_show_filename_and_lineno(psrc);
8662 fputs(dkct_tr_get_kw8(35), psrc->fipo);
8663 fputs(fnptr, psrc->fipo);
8664 fputs(dkct_tr_get_kw8(34), psrc->fipo);
8665 fputs(dkct_tr_get_kw8(33), psrc->fipo);
8666 fputs(dkct_tr_get_kw8(73), psrc->fipo);
8667 if(co->name) {
8668 fputs(co->name, psrc->fipo);
8669 }
8670 fputs(dkct_tr_get_kw8(74), psrc->fipo);
8671 fputs(dkct_tr_get_kw8(35), psrc->fipo);
8672 fputs(fnptr, psrc->fipo);
8673 fputs(dkct_tr_get_kw8(34), psrc->fipo);
8674 if((psrc->dkcto).deb != 2) {
8675 fputs(dkct_tr_get_kw8(31), psrc->fipo);
8676 }
8677 /* 8-bit end */
8678 if((psrc->dkcto).win) {
8679 fputs(dkct_tr_get_kw8(23), psrc->fipo);
8680 }
8681 fputs(dkct_tr_get_kw8(25), psrc->fipo);
8682 }
8683
8684 fputs(dkct_gui_out_kw[27], psrc->fipo);
8685 fputs(dkct_gui_out_kw[28], psrc->fipo);
8686 /* SUCCESS DEBUG CODE */
8687 if((psrc->dkcto).deb) {
8688
8689 fputs(dkct_tr_get_kw8(24), psrc->fipo);
8690 if((psrc->dkcto).win) {
8691 fputs(dkct_tr_get_kw8(21), psrc->fipo);
8692 /* 16-bit begin */
8693 if((psrc->dkcto).deb != 2) {
8694 fputs(dkct_tr_get_kw8(30), psrc->fipo);
8695 }
8696 if((psrc->dkcto).ts) {
8697 if((psrc->dkcto).deb == 2) {
8698 fputs(dkct_tr_get_kw8(72), psrc->fipo);
8699 } else {
8700 fputs(dkct_tr_get_kw8(71), psrc->fipo);
8701 }
8702 }
8703 fputs(dkct_tr_get_kw8(61), psrc->fipo);
8704 dkct_tr_show_filename_and_lineno(psrc);
8705 fputs(dkct_tr_get_kw8(35), psrc->fipo);
8706 fputs(fnptr, psrc->fipo);
8707 fputs(dkct_tr_get_kw8(34), psrc->fipo);
8708 fputs(dkct_tr_get_kw8(61), psrc->fipo);
8709 fputs(dkct_tr_get_kw8(76), psrc->fipo);
8710 if(co->name) {
8711 fputs(co->name, psrc->fipo);
8712 }
8713 fputs(dkct_tr_get_kw8(74), psrc->fipo);
8714 fputs(dkct_tr_get_kw8(35), psrc->fipo);
8715 fputs(fnptr, psrc->fipo);
8716 fputs(dkct_tr_get_kw8(34), psrc->fipo);
8717 if((psrc->dkcto).deb != 2) {
8718 fputs(dkct_tr_get_kw8(31), psrc->fipo);
8719 }
8720 /* 16-bit end */
8721 fputs(dkct_tr_get_kw8(22), psrc->fipo);
8722 }
8723 /* 8-bit begin */
8724 if((psrc->dkcto).deb != 2) {
8725 fputs(dkct_tr_get_kw8(30), psrc->fipo);
8726 }
8727 if((psrc->dkcto).ts) {
8728 if((psrc->dkcto).deb == 2) {
8729 fputs(dkct_tr_get_kw8(70), psrc->fipo);
8730 } else {
8731 fputs(dkct_tr_get_kw8(32), psrc->fipo);
8732 }
8733 }
8734 fputs(dkct_tr_get_kw8(33), psrc->fipo);
8735 dkct_tr_show_filename_and_lineno(psrc);
8736 fputs(dkct_tr_get_kw8(35), psrc->fipo);
8737 fputs(fnptr, psrc->fipo);
8738 fputs(dkct_tr_get_kw8(34), psrc->fipo);
8739 fputs(dkct_tr_get_kw8(33), psrc->fipo);
8740 fputs(dkct_tr_get_kw8(76), psrc->fipo);
8741 if(co->name) {
8742 fputs(co->name, psrc->fipo);
8743 }
8744 fputs(dkct_tr_get_kw8(74), psrc->fipo);
8745 fputs(dkct_tr_get_kw8(35), psrc->fipo);
8746 fputs(fnptr, psrc->fipo);
8747 fputs(dkct_tr_get_kw8(34), psrc->fipo);
8748 if((psrc->dkcto).deb != 2) {
8749 fputs(dkct_tr_get_kw8(31), psrc->fipo);
8750 }
8751 /* 8-bit end */
8752 if((psrc->dkcto).win) {
8753 fputs(dkct_tr_get_kw8(23), psrc->fipo);
8754 }
8755 fputs(dkct_tr_get_kw8(25), psrc->fipo);
8756 }
8757 /*
8758 Further element setup, done *before* we deal with contents.
8759 */
8760 switch(co->cln) {
8761 case 0: {
8762 } break;
8763 case 1: {
8764 } break;
8765 case 2: {
8766 } break;
8767 case 3: {
8768 } break;
8769 case 4: {
8770 } break;
8771 case 5: {
8772 } break;
8773 case 6: {
8774 } break;
8775 case 7: {
8776 } break;
8777 case 8: {
8778 } break;
8779 case 9: {
8780 } break;
8781 case 10: {
8782 } break;
8783 case 11: {
8784 } break;
8785 case 12: {
8786 } break;
8787 case 13: case 47: {
8788 /* Set size */
8789 } break;
8790 case 14: {
8791 } break;
8792 case 15: {
8793 } break;
8794 case 16: {
8795 if(co->bitmapDisabled) {
8796 dkct_gui_write_set_bitmap(co, psrc, 156, co->bitmapDisabled);
8797 }
8798 if(co->bitmapSelected) {
8799 dkct_gui_write_set_bitmap(co, psrc, 157, co->bitmapSelected);
8800 }
8801 if(co->bitmapFocus) {
8802 dkct_gui_write_set_bitmap(co, psrc, 158, co->bitmapFocus);
8803 }
8804 if(co->bitmapHover) {
8805 dkct_gui_write_set_bitmap(co, psrc, 159, co->bitmapHover);
8806 }
8807 } break;
8808 case 17: {
8809 } break;
8810 case 18: {
8811 } break;
8812 case 19: {
8813 if(co->state != 0x00) {
8814 fputs(co->name, psrc->fipo);
8815 if(co->nStates == 0x03) {
8816 if(co->state == 0x02) {
8817 fputs(dkct_gui_out_kw[78], psrc->fipo);
8818 } else {
8819 fputs(dkct_gui_out_kw[79], psrc->fipo);
8820 }
8821 } else {
8822 fputs(dkct_gui_out_kw[77], psrc->fipo);
8823 }
8824 }
8825 } break;
8826 case 20: {
8827 } break;
8828 case 21: {
8829 } break;
8830 case 22: {
8831 } break;
8832 case 23: {
8833 } break;
8834 case 24: {
8835 } break;
8836 case 25: {
8837 } break;
8838 case 26: {
8839 } break;
8840 case 27: {
8841 } break;
8842 case 28: {
8843 } break;
8844 case 29: {
8845 } break;
8846 case 30: {
8847 } break;
8848 case 31: {
8849 } break;
8850 case 32: {
8851 } break;
8852 case 33: {
8853 } break;
8854 case 34: {
8855 } break;
8856 case 35: {
8857 } break;
8858 case 36: {
8859 } break;
8860 case 37: {
8861 } break;
8862 case 38: {
8863 } break;
8864 case 39: {
8865 } break;
8866 case 41: {
8867 if(co->gridTable) {
8868 fputs(dkct_gui_out_kw[8], psrc->fipo);
8869 fputs(co->name, psrc->fipo);
8870 fputs(dkct_gui_out_kw[198], psrc->fipo);
8871 fputs(co->gridTable, psrc->fipo);
8872 if(co->tableOwner) {
8873 fputs(dkct_gui_out_kw[55], psrc->fipo);
8874 fputs(dkct_gui_out_kw[199], psrc->fipo);
8875 }
8876 fputs(dkct_gui_out_kw[24], psrc->fipo);
8877 fputs(dkct_gui_out_kw[0], psrc->fipo);
8878 } else {
8879 #if VERSION_BEFORE_20150821
8880 rows = columns = 0;
8881 #endif
8882 if(co->nRowHeads > co->nRows) {
8883 rows = co->nRowHeads;
8884 } else {
8885 rows = co->nRows;
8886 }
8887 if(co->nColumnHeads > co->nColumns) {
8888 columns = co->nColumnHeads;
8889 } else {
8890 columns = co->nColumns;
8891 }
8892 if(rows < 1) rows = 1;
8893 if(columns < 1) columns = 1;
8894 fputs(dkct_gui_out_kw[8], psrc->fipo);
8895 fputs(co->name, psrc->fipo);
8896 fputs(dkct_gui_out_kw[200], psrc->fipo);
8897 fprintf(psrc->fipo, "%d, %d", rows, columns);
8898 fputs(dkct_gui_out_kw[24], psrc->fipo);
8899 fputs(dkct_gui_out_kw[0], psrc->fipo);
8900 }
8901 if((co->sColumnHeads) && (co->iColumnHeads)) {
8902 dk3sto_it_reset(co->iColumnHeads);
8903 do {
8904 gh = (DKCT_GRID_HEAD *)dk3sto_it_next(co->iColumnHeads);
8905 if(gh) {
8906 fputs(dkct_gui_out_kw[8], psrc->fipo);
8907 fputs(co->name, psrc->fipo);
8908 fputs(dkct_gui_out_kw[201], psrc->fipo);
8909 fprintf(psrc->fipo, "%d", gh->elno);
8910 fputs(dkct_gui_out_kw[55], psrc->fipo);
8911 fputs(gh->text, psrc->fipo);
8912 fputs(dkct_gui_out_kw[24], psrc->fipo);
8913 fputs(dkct_gui_out_kw[0], psrc->fipo);
8914 }
8915 } while(gh);
8916 }
8917 if((co->sRowHeads) && (co->iRowHeads)) {
8918 dk3sto_it_reset(co->iRowHeads);
8919 do {
8920 gh = (DKCT_GRID_HEAD *)dk3sto_it_next(co->iRowHeads);
8921 if(gh) {
8922 fputs(dkct_gui_out_kw[8], psrc->fipo);
8923 fputs(co->name, psrc->fipo);
8924 fputs(dkct_gui_out_kw[202], psrc->fipo);
8925 fprintf(psrc->fipo, "%d", gh->elno);
8926 fputs(dkct_gui_out_kw[55], psrc->fipo);
8927 fputs(gh->text, psrc->fipo);
8928 fputs(dkct_gui_out_kw[24], psrc->fipo);
8929 fputs(dkct_gui_out_kw[0], psrc->fipo);
8930 }
8931 } while(gh);
8932 }
8933 if((co->sCellData) && (co->iCellData)) {
8934 dk3sto_it_reset(co->iCellData);
8935 do {
8936 pcd = (DKCT_CELL_DATA *)dk3sto_it_next(co->iCellData);
8937 if (pcd) {
8938 fputs(dkct_gui_out_kw[8], psrc->fipo);
8939 fputs(co->name, psrc->fipo);
8940 fputs(dkct_gui_out_kw[214], psrc->fipo);
8941 fprintf(psrc->fipo, "%d, %d, ", pcd->row, pcd->col);
8942 fputs(pcd->text, psrc->fipo);
8943 fputs(dkct_gui_out_kw[24], psrc->fipo);
8944 fputs(dkct_gui_out_kw[0], psrc->fipo);
8945 }
8946 } while(NULL != pcd);
8947 }
8948 if (41 == co->cln) {
8949 if (co->gridStyle & DKCT_GUI_GRID_AS_LABEL_ROWS) {
8950 fputs(dkct_gui_out_kw[8], psrc->fipo);
8951 fputs(co->name, psrc->fipo);
8952 fputs(dkct_gui_out_kw[216], psrc->fipo);
8953 fputs(dkct_gui_out_kw[24], psrc->fipo);
8954 fputs(dkct_gui_out_kw[0], psrc->fipo);
8955 }
8956 if (co->gridStyle & DKCT_GUI_GRID_AS_LABEL_COLS) {
8957 fputs(dkct_gui_out_kw[8], psrc->fipo);
8958 fputs(co->name, psrc->fipo);
8959 fputs(dkct_gui_out_kw[217], psrc->fipo);
8960 fputs(dkct_gui_out_kw[24], psrc->fipo);
8961 fputs(dkct_gui_out_kw[0], psrc->fipo);
8962 }
8963 if (co->gridStyle & DKCT_GUI_GRID_AS_DATA) {
8964 fputs(dkct_gui_out_kw[8], psrc->fipo);
8965 fputs(co->name, psrc->fipo);
8966 fputs(dkct_gui_out_kw[215], psrc->fipo);
8967 fputs(dkct_gui_out_kw[24], psrc->fipo);
8968 fputs(dkct_gui_out_kw[0], psrc->fipo);
8969 }
8970 }
8971 if((DKCT_GUI_TEXT_READONLY) & (co->textStyle)) {
8972 fputs(dkct_gui_out_kw[8], psrc->fipo);
8973 fputs(co->name, psrc->fipo);
8974 fputs(dkct_gui_out_kw[203], psrc->fipo);
8975 fputs(dkct_gui_out_kw[0], psrc->fipo);
8976 }
8977 } break;
8978 case 42: {
8979 } break;
8980 case 43: {
8981 } break;
8982 case 44: {
8983 } break;
8984 case 45: {
8985 } break;
8986 case 46: {
8987 } break;
8988 }
8989 /*
8990 Minimal size, if any.
8991 */
8992 if((co->sizemx > 0) && (co->sizemy > 0)) {
8993 fputs(dkct_gui_out_kw[8], psrc->fipo);
8994 fputs(co->name, psrc->fipo);
8995 fputs(dkct_gui_out_kw[204], psrc->fipo);
8996 fprintf(psrc->fipo, "%d, %d", co->sizemx, co->sizemy);
8997 fputs(dkct_gui_out_kw[205], psrc->fipo);
8998 fputs(dkct_gui_out_kw[0], psrc->fipo);
8999 }
9000
9001 }
9002
9003
9004
9005 /** Write constructor arguments start when constructor is given.
9006 @param co Current object.
9007 @param dp Direct parent.
9008 @param pw Parent window.
9009 @param psrc Source structure.
9010 @param gui GUI description.
9011 @param comma Flag: Write a final comma.
9012 */
9013 static
9014 void
dkct_gui_constructor_constructor(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (dp),DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui,int comma)9015 dkct_gui_constructor_constructor(
9016 DKCT_GUI_ELEMENT *co,
9017 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(dp),
9018 DKCT_GUI_ELEMENT *pw,
9019 DKCT_SRC *psrc,
9020 DKCT_GUI *gui,
9021 int comma
9022 )
9023 {
9024 DK3_UNUSED_ARG(dp)
9025 fputs(dkct_gui_out_kw[2], psrc->fipo);
9026 dkct_gui_write_parent_name(pw, psrc, gui);
9027 fputs(dkct_gui_out_kw[209], psrc->fipo);
9028 if(co->idname) {
9029 fputs(co->idname, psrc->fipo);
9030 } else {
9031 fputs(dkct_gui_out_kw[66], psrc->fipo);
9032 }
9033 if(comma) {
9034 fputs(dkct_gui_out_kw[209], psrc->fipo);
9035 } else {
9036 fputs(dkct_gui_out_kw[0], psrc->fipo);
9037 }
9038 }
9039
9040
9041 /** Write element constructor and add element to parent
9042 object or sizer.
9043 @param co Current object.
9044 @param dp Direct parent.
9045 @param pw Parent window.
9046 @param psrc Source structure.
9047 @param gui GUI description.
9048 */
9049 static
9050 void
dkct_gui_write_element_constructor(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * dp,DKCT_GUI_ELEMENT * pw,DKCT_SRC * psrc,DKCT_GUI * gui)9051 dkct_gui_write_element_constructor(
9052 DKCT_GUI_ELEMENT *co,
9053 DKCT_GUI_ELEMENT *dp,
9054 DKCT_GUI_ELEMENT *pw,
9055 DKCT_SRC *psrc,
9056 DKCT_GUI *gui
9057 )
9058 {
9059
9060 /*
9061 Write tests to check constructor prerequisitions.
9062 */
9063 switch(co->cln) {
9064 case 16:
9065 case 40:
9066 {
9067 #if 0
9068 /*
9069 2011-07-30: Bitmaps are typically compiled-in.
9070 */
9071 if(co->bitmapVarName) {
9072
9073 fputs(dkct_gui_out_kw[25], psrc->fipo);
9074 fputs(co->bitmapVarName, psrc->fipo);
9075 fputs(dkct_gui_out_kw[26], psrc->fipo);
9076 fputs(dkct_gui_out_kw[27], psrc->fipo);
9077 fputs(dkct_gui_out_kw[28], psrc->fipo);
9078 }
9079 #endif
9080 } break;
9081 }
9082 /*
9083 Write constructor.
9084 object = new class(arguments);
9085 */
9086 switch(co->cln) {
9087 case 37: {
9088 if(dp) {
9089 if(dp->cln == 36) {
9090 if((NULL != co->text) || (0 != dkct_gui_is_stock_element(co))) {
9091 dkct_gui_constructor_menuitem(co, dp, pw, psrc, gui);
9092 if(co->menuItemStyle != DKCT_GUI_MENU_ITEM_SEPARATOR) {
9093 dkct_gui_finalize_after_constructor(co, dp, pw, psrc, gui);
9094 }
9095 } else {
9096 /* ERROR: No text specified */
9097
9098 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 49);
9099 }
9100 } else {
9101 /* ERROR: Parent is not a menu */
9102 dkct_gui_report_illegal_parent_child(co, dp, gui->psrc);
9103 }
9104 } else {
9105 /* ERROR: No parent */
9106 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 92);
9107 }
9108 } break;
9109 case 40: {
9110 if(dp) {
9111 if(dp->cln == 38) {
9112 if(dp->name) {
9113 if(co->bitmapVarName) {
9114 if(co->text) {
9115 dkct_gui_constructor_toolbartoolbase(co, dp, pw, psrc, gui);
9116 if(co->menuItemStyle != DKCT_GUI_MENU_ITEM_SEPARATOR) {
9117 dkct_gui_finalize_after_constructor(co, dp, pw, psrc, gui);
9118 }
9119 } else {
9120 /* ERROR: No text */
9121
9122 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 49);
9123 }
9124 } else {
9125 /* ERROR: No bitmap */
9126 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 51);
9127 }
9128 } else {
9129 /* ERROR: No parent name */
9130 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 91);
9131 }
9132 } else {
9133 /* ERROR: Parent is not a toolbar */
9134 dkct_gui_report_illegal_parent_child(co, dp, gui->psrc);
9135 }
9136 } else {
9137 /* ERROR: No parent */
9138 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 92);
9139 }
9140 } break;
9141 default: {
9142 fputs(dkct_gui_out_kw[8], psrc->fipo);
9143 fputs(co->name, psrc->fipo);
9144 fputs(dkct_gui_out_kw[23], psrc->fipo);
9145 fputs(co->cname, psrc->fipo);
9146 fputs(dkct_gui_out_kw[29], psrc->fipo);
9147 if(co->constructor) {
9148 if(!(co->compConst)) {
9149 dkct_gui_constructor_constructor(co,dp,pw,psrc,gui,1);
9150 }
9151 fputs(co->constructor, psrc->fipo);
9152 fputs(dkct_gui_out_kw[0], psrc->fipo);
9153 switch(co->cln) {
9154 case 5:
9155 {
9156 /* WARNING: Constructor specified, not recommended! */
9157 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 80);
9158 } break;
9159 }
9160 } else {
9161 switch(co->cln) {
9162 case 0: {
9163 dkct_gui_constructor_frame_dialog(co,dp,pw,psrc,gui);
9164 } break;
9165 case 1: {
9166 dkct_gui_constructor_frame_dialog(co,dp,pw,psrc,gui);
9167 } break;
9168 case 2: {
9169 dkct_gui_constructor_frame_dialog(co,dp,pw,psrc,gui);
9170 } break;
9171 case 3: {
9172 dkct_gui_constructor_frame_dialog(co,dp,pw,psrc,gui);
9173 } break;
9174 case 4: {
9175 } break;
9176 case 5: {
9177 dkct_gui_constructor_boxsizer(co, dp, pw, psrc, gui);
9178 } break;
9179 case 6: {
9180 dkct_gui_constructor_gridsizer(co,dp,pw,psrc,gui);
9181 } break;
9182 case 7: {
9183 dkct_gui_constructor_gridbagsizer(co,dp,pw,psrc,gui);
9184 } break;
9185 case 8: {
9186 dkct_gui_constructor_gridsizer(co,dp,pw,psrc,gui);
9187 } break;
9188 case 9: {
9189 dkct_gui_constructor_staticboxsizer(co,dp,pw,psrc,gui);
9190 } break;
9191 case 10: {
9192 /* No constructor arguments at all. */
9193 } break;
9194 case 11: {
9195 dkct_gui_constructor_panel(co, dp, pw, psrc, gui);
9196 } break;
9197 case 12: {
9198 dkct_gui_constructor_notebook(co, dp, pw, psrc, gui);
9199 } break;
9200 case 13: case 47 : {
9201 dkct_gui_constructor_scrolledwindow(co, dp, pw, psrc, gui);
9202 } break;
9203 case 14: {
9204 dkct_gui_constructor_splitterwindow(co, dp, pw, psrc, gui);
9205 } break;
9206 case 15: {
9207 dkct_gui_constructor_button(co, dp, pw, psrc, gui);
9208 } break;
9209 case 16: {
9210 dkct_gui_constructor_bitmapbutton(co, dp, pw, psrc, gui);
9211 } break;
9212 case 17: {
9213 dkct_gui_constructor_choice_combo(co, dp, pw, psrc, gui, 0);
9214 } break;
9215 case 18: {
9216 dkct_gui_constructor_choice_combo(co, dp, pw, psrc, gui, 1);
9217 } break;
9218 case 19: {
9219 dkct_gui_constructor_checkbox(co, dp, pw, psrc, gui);
9220 } break;
9221 case 20: {
9222 dkct_gui_constructor_listbox(co, dp, pw, psrc, gui);
9223 } break;
9224 case 21: {
9225 dkct_gui_constructor_checklistbox(co, dp, pw, psrc, gui);
9226 } break;
9227 case 22: {
9228 dkct_gui_constructor_radiobox(co, dp, pw, psrc, gui);
9229 } break;
9230 case 23: {
9231 dkct_gui_constructor_radiobutton(co, dp, pw, psrc, gui);
9232 } break;
9233 case 24: {
9234 dkct_gui_constructor_scrollbar(co, dp, pw, psrc, gui);
9235 } break;
9236 case 25: {
9237 dkct_gui_constructor_spinbutton(co, dp, pw, psrc, gui);
9238 } break;
9239 case 26: {
9240 dkct_gui_constructor_spincontrol(co, dp, pw, psrc, gui);
9241 } break;
9242 case 27: {
9243 dkct_gui_constructor_slider(co, dp, pw, psrc, gui);
9244 } break;
9245 case 28: {
9246 dkct_gui_constructor_textctrl(co, dp, pw, psrc, gui);
9247 } break;
9248 case 29: {
9249 dkct_gui_constructor_togglebutton(co, dp, pw, psrc, gui);
9250 } break;
9251 case 30: {
9252 dkct_gui_constructor_gauge(co, dp, pw, psrc, gui);
9253 } break;
9254 case 31: {
9255 dkct_gui_constructor_statictext(co, dp, pw, psrc, gui);
9256 } break;
9257 case 32: {
9258 dkct_gui_constructor_staticbitmap(co, dp, pw, psrc, gui);
9259 } break;
9260 case 33: {
9261 dkct_gui_constructor_staticline(co, dp, pw, psrc, gui);
9262 } break;
9263 case 34: {
9264 dkct_gui_constructor_staticbox(co, dp, pw, psrc, gui);
9265 } break;
9266 case 35: {
9267 dkct_gui_constructor_menubar(co, dp, pw, psrc, gui);
9268 } break;
9269 case 36: {
9270 dkct_gui_constructor_menu(co, dp, pw, psrc, gui);
9271 } break;
9272 #if 0
9273 case 37: {
9274 /*
9275 Never happens.
9276 */
9277 } break;
9278 #endif
9279 case 38: {
9280 dkct_gui_constructor_toolbar(co, dp, pw, psrc, gui);
9281 } break;
9282 case 39: {
9283 } break;
9284 case 41: {
9285 dkct_gui_constructor_grid(co, dp, pw, psrc, gui);
9286 } break;
9287 case 42: {
9288 dkct_gui_constructor_notebook(co, dp, pw, psrc, gui);
9289 } break;
9290 case 43: {
9291 dkct_gui_constructor_notebook(co, dp, pw, psrc, gui);
9292 } break;
9293 case 44: {
9294 dkct_gui_constructor_notebook(co, dp, pw, psrc, gui);
9295 } break;
9296 case 45: {
9297 dkct_gui_constructor_notebook(co, dp, pw, psrc, gui);
9298 } break;
9299 case 46: {
9300 dkct_gui_constructor_notebook(co, dp, pw, psrc, gui);
9301 } break;
9302 default: {
9303 if(!(co->compConst)) {
9304 dkct_gui_constructor_constructor(co,dp,pw,psrc,gui,0);
9305 }
9306 } break;
9307 }
9308 }
9309 fputs(dkct_gui_out_kw[37], psrc->fipo);
9310 dkct_gui_finalize_after_constructor(co, dp, pw, psrc, gui);
9311 } break;
9312 }
9313
9314 }
9315
9316
9317
9318 /** Add pseudo object.
9319 @param co Current object.
9320 @param dp Direct parent.
9321 @param pw Parent window.
9322 @param psrc Source structure.
9323 @param gui GUI description.
9324 */
9325 static
9326 void
dkct_gui_add_pseudo_object(DKCT_GUI_ELEMENT * co,DKCT_GUI_ELEMENT * dp,DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED (pw),DKCT_SRC * psrc,DKCT_GUI * gui)9327 dkct_gui_add_pseudo_object(
9328 DKCT_GUI_ELEMENT *co,
9329 DKCT_GUI_ELEMENT *dp,
9330 DKCT_GUI_ELEMENT * DK3_SILENCE_ARG_UNUSED(pw),
9331 DKCT_SRC *psrc,
9332 DKCT_GUI *gui
9333 )
9334 {
9335 char bu[256]; /* Buffer for numeric values. */
9336
9337 DK3_UNUSED_ARG(pw)
9338 if(dp) {
9339 switch(dp->cln) {
9340 case 7: { /* gridbag sizer */
9341 switch(co->pseudoobj) {
9342 case 1: case 2: {
9343 fputs(dkct_gui_out_kw[8], psrc->fipo);
9344 if(dp->name) {
9345 fputs(dp->name, psrc->fipo);
9346 fputs(dkct_gui_out_kw[31], psrc->fipo);
9347 }
9348 fputs(dkct_gui_out_kw[196], psrc->fipo);
9349 sprintf(bu, "%d", co->sizex);
9350 fputs(bu, psrc->fipo);
9351 fputs(dkct_gui_out_kw[55], psrc->fipo);
9352 sprintf(bu, "%d", co->sizey);
9353 fputs(bu, psrc->fipo);
9354 fputs(dkct_gui_out_kw[55], psrc->fipo);
9355 /* wxGBPosition() */
9356 sprintf(bu, "%d, %d", co->posy, co->posx);
9357 fputs(dkct_gui_out_kw[53], psrc->fipo);
9358 fputs(bu, psrc->fipo);
9359 fputs(dkct_gui_out_kw[56], psrc->fipo);
9360 fputs(dkct_gui_out_kw[55], psrc->fipo);
9361 sprintf(bu, "%d, %d", co->spany, co->spanx);
9362 fputs(dkct_gui_out_kw[54], psrc->fipo);
9363 fputs(bu, psrc->fipo);
9364 fputs(dkct_gui_out_kw[56], psrc->fipo);
9365 #if 0
9366 /* 2011-07-30: No wxGROW flag for spacers. */
9367 if(co->expandFlag) {
9368 fputs(dkct_gui_out_kw[55], psrc->fipo);
9369 fputs(dkct_gui_out_kw[51], psrc->fipo);
9370 }
9371 #endif
9372 fputs(dkct_gui_out_kw[24], psrc->fipo);
9373 fputs(dkct_gui_out_kw[0], psrc->fipo);
9374 } break;
9375 default: {
9376 /* ERROR: Can not add this class to parent! */
9377 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 81);
9378 } break;
9379 }
9380 } break;
9381 case 5: case 6: case 8: case 9: case 10: { /* other sizers */
9382 /*
9383 parent->Add(width, height, proportion, flags);
9384 */
9385 switch(co->pseudoobj) {
9386 case 1: case 2: {
9387 fputs(dkct_gui_out_kw[8], psrc->fipo);
9388 if(dp->name) {
9389 fputs(dp->name, psrc->fipo);
9390 fputs(dkct_gui_out_kw[31], psrc->fipo);
9391 }
9392 fputs(dkct_gui_out_kw[196], psrc->fipo);
9393 sprintf(bu, "%d", co->sizex);
9394 fputs(bu, psrc->fipo);
9395 fputs(dkct_gui_out_kw[55], psrc->fipo);
9396 sprintf(bu, "%d", co->sizey);
9397 fputs(bu, psrc->fipo);
9398 fputs(dkct_gui_out_kw[55], psrc->fipo);
9399 sprintf(bu, "%d", co->proportion);
9400 fputs(bu, psrc->fipo);
9401 #if 0
9402 /* 2011-07-30: No wxGROW flag for stretch and spacers. */
9403 if(co->expandFlag) {
9404 fputs(dkct_gui_out_kw[55], psrc->fipo);
9405 fputs(dkct_gui_out_kw[51], psrc->fipo);
9406 }
9407 #endif
9408 fputs(dkct_gui_out_kw[24], psrc->fipo);
9409 fputs(dkct_gui_out_kw[0], psrc->fipo);
9410 } break;
9411 default: {
9412 /* ERROR: Can not add this class! */
9413 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 81);
9414 } break;
9415 }
9416 } break;
9417 case 36: { /* menu */
9418 switch(co->pseudoobj) {
9419 case 3: {
9420 fputs(dkct_gui_out_kw[8], psrc->fipo);
9421 if(dp->name) {
9422 fputs(dp->name, psrc->fipo);
9423 fputs(dkct_gui_out_kw[31], psrc->fipo);
9424 }
9425 fputs(dkct_gui_out_kw[188], psrc->fipo);
9426 } break;
9427 default: {
9428 /* ERROR: Can not add this class! */
9429 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 81);
9430 } break;
9431 }
9432 } break;
9433 case 38: { /* tool bar */
9434 switch(co->pseudoobj) {
9435 case 3: {
9436 fputs(dkct_gui_out_kw[8], psrc->fipo);
9437 if(dp->name) {
9438 fputs(dp->name, psrc->fipo);
9439 fputs(dkct_gui_out_kw[31], psrc->fipo);
9440 }
9441 fputs(dkct_gui_out_kw[189], psrc->fipo);
9442 } break;
9443 default: {
9444 /* ERROR: Can not add this class! */
9445 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 81);
9446 } break;
9447 }
9448 } break;
9449 }
9450 }
9451
9452 }
9453
9454
9455
9456 /** Finish wxSplitterWindow after finishing the contents.
9457 @param co Current object.
9458 @param psrc Source structure.
9459 @param gui GUI description.
9460 */
9461 static
9462 void
dkct_gui_finish_splitter_window(DKCT_GUI_ELEMENT * co,DKCT_SRC * psrc,DKCT_GUI * gui)9463 dkct_gui_finish_splitter_window(
9464 DKCT_GUI_ELEMENT *co,
9465 DKCT_SRC *psrc,
9466 DKCT_GUI *gui
9467 )
9468 {
9469 char bu[64]; /* Buffer for numeric values. */
9470 DKCT_GUI_ELEMENT *a = NULL; /* First child window. */
9471 DKCT_GUI_ELEMENT *b = NULL; /* Second child window. */
9472 char *na = NULL; /* Name of first child. */
9473 char *nb = NULL; /* Name of second child. */
9474 char *nc = NULL; /* Current objects name. */
9475 dk3sto_it_reset(co->i_contents);
9476 a = (DKCT_GUI_ELEMENT *)dk3sto_it_next(co->i_contents);
9477 if(a) {
9478 b = (DKCT_GUI_ELEMENT *)dk3sto_it_next(co->i_contents);
9479 if(b) {
9480 if(dk3sto_it_next(co->i_contents)) {
9481 /* ERROR: Too many elements for splitter window */
9482 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 47);
9483 }
9484 }
9485 }
9486 if(a) { na = a->name; }
9487 if(b) { nb = b->name; }
9488 nc = co->name;
9489 if((na) && (nb)) {
9490 /*
9491 if((na) && (nb)) {
9492 nc->SplitHorizontally(na, nb, sash);
9493 }
9494 */
9495 } else {
9496 /* ERROR: Too few contents for splitter window. */
9497 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 47);
9498 }
9499 fputs(dkct_gui_out_kw[8], psrc->fipo);
9500 fputs(dkct_gui_out_kw[67], psrc->fipo);
9501 fputs(na, psrc->fipo);
9502 fputs(dkct_gui_out_kw[68], psrc->fipo);
9503 fputs(nb, psrc->fipo);
9504 fputs(dkct_gui_out_kw[69], psrc->fipo);
9505 fputs(dkct_gui_out_kw[2], psrc->fipo);
9506 fputs(nc, psrc->fipo);
9507 fputs(dkct_gui_out_kw[31], psrc->fipo);
9508 if(co->direction == DKCT_GUI_DIRECTION_VERTICAL) {
9509 fputs(dkct_gui_out_kw[70], psrc->fipo);
9510 } else {
9511 fputs(dkct_gui_out_kw[71], psrc->fipo);
9512 }
9513 fputs(na, psrc->fipo);
9514 fputs(dkct_gui_out_kw[55], psrc->fipo);
9515 fputs(nb, psrc->fipo);
9516 fputs(dkct_gui_out_kw[55], psrc->fipo);
9517 sprintf(bu, "%d", co->sash);
9518 fputs(bu, psrc->fipo);
9519 fputs(dkct_gui_out_kw[24], psrc->fipo);
9520 fputs(dkct_gui_out_kw[0], psrc->fipo);
9521 fputs(dkct_gui_out_kw[8], psrc->fipo);
9522 fputs(dkct_gui_out_kw[64], psrc->fipo);
9523 if(co->minPaneSize > 0) {
9524 fputs(dkct_gui_out_kw[8], psrc->fipo);
9525 fputs(nc, psrc->fipo);
9526 fputs(dkct_gui_out_kw[72], psrc->fipo);
9527 sprintf(bu, "%d", co->minPaneSize);
9528 fputs(bu, psrc->fipo);
9529 fputs(dkct_gui_out_kw[24], psrc->fipo);
9530 fputs(dkct_gui_out_kw[0], psrc->fipo);
9531 }
9532 }
9533
9534
9535
9536 /** Finish setup of current element after setting up all children.
9537 @param co Current object.
9538 @param psrc Source structure.
9539 @param gui GUI description.
9540 */
9541 static
9542 void
dkct_gui_finish_current_element(DKCT_GUI_ELEMENT * co,DKCT_SRC * psrc,DKCT_GUI * gui)9543 dkct_gui_finish_current_element(
9544 DKCT_GUI_ELEMENT *co,
9545 DKCT_SRC *psrc,
9546 DKCT_GUI *gui
9547 )
9548 {
9549
9550 /*
9551 Class-dependant finish.
9552 */
9553 switch(co->cln) {
9554 case 10: /* standard dialog button sizer */
9555 case 38: /* toolbar */
9556 {
9557 /*
9558 Call ->Realize() for the standard diaglog button sizer.
9559 */
9560 fputs(dkct_gui_out_kw[8], psrc->fipo);
9561 fputs(co->name, psrc->fipo);
9562 fputs(dkct_gui_out_kw[80], psrc->fipo);
9563 } break;
9564 case 14: {
9565 /*
9566 Set wxSplitterWindow children and sash.
9567 */
9568 dkct_gui_finish_splitter_window(co, psrc, gui);
9569 } break;
9570 }
9571 /*
9572 Attribute-dependant finish.
9573 */
9574 if(co->text) {
9575 switch(co->cln) {
9576 case -1: {
9577 fputs(dkct_gui_out_kw[8], psrc->fipo);
9578 if(co->name) {
9579 fputs(co->name, psrc->fipo);
9580 fputs(dkct_gui_out_kw[31], psrc->fipo);
9581 }
9582 fputs(dkct_gui_out_kw[210], psrc->fipo);
9583 fputs(co->text, psrc->fipo);
9584 fputs(dkct_gui_out_kw[24], psrc->fipo);
9585 fputs(dkct_gui_out_kw[0], psrc->fipo);
9586 } break;
9587 }
9588 }
9589 if(co->tipText) {
9590 switch(co->cln) {
9591 case 36: /* wxMenu */
9592 case 37: /* wxMenuItem */
9593 case 40: /* $wxToolBarTool */
9594 {
9595 /* Tip text already used. */
9596 } break;
9597 default: {
9598 fputs(dkct_gui_out_kw[8], psrc->fipo);
9599 if ((NULL != co->ttflag) || (NULL != gui->ttflag)) {
9600 fputs(dkct_gui_out_kw[218], psrc->fipo);
9601 if (NULL != co->ttflag) {
9602 fputs(co->ttflag, psrc->fipo);
9603 } else {
9604 fputs(gui->ttflag, psrc->fipo);
9605 }
9606 fputs(dkct_gui_out_kw[219], psrc->fipo);
9607 }
9608 if(co->name) {
9609 fputs(co->name, psrc->fipo);
9610 fputs(dkct_gui_out_kw[31], psrc->fipo);
9611 }
9612 fputs(dkct_gui_out_kw[190], psrc->fipo);
9613 fputs(co->tipText, psrc->fipo);
9614 fputs(dkct_gui_out_kw[24], psrc->fipo);
9615 if ((NULL != co->ttflag) || (NULL != gui->ttflag)) {
9616 fputs(dkct_gui_out_kw[64], psrc->fipo);
9617 }
9618 fputs(dkct_gui_out_kw[0], psrc->fipo);
9619 } break;
9620 }
9621 }
9622 if(co->icon) {
9623 if((co->parent) || (co->number)) {
9624 /* Warning: Icon only for root level windows. */
9625 dkct_to_log_1(gui->psrc, 1, DK3_LL_WARNING, 55);
9626 }
9627 fputs(dkct_gui_out_kw[8], psrc->fipo);
9628 if(co->name) {
9629 fputs(co->name, psrc->fipo);
9630 fputs(dkct_gui_out_kw[31], psrc->fipo);
9631 }
9632 fputs(dkct_gui_out_kw[195], psrc->fipo);
9633 fputs(co->icon, psrc->fipo);
9634 fputs(dkct_gui_out_kw[24], psrc->fipo);
9635 fputs(dkct_gui_out_kw[0], psrc->fipo);
9636 }
9637 if(co->validator) {
9638 switch(co->cln) {
9639 case -1: {
9640 fputs(dkct_gui_out_kw[8], psrc->fipo);
9641 if(co->name) {
9642 fputs(co->name, psrc->fipo);
9643 fputs(dkct_gui_out_kw[31], psrc->fipo);
9644 }
9645 fputs(dkct_gui_out_kw[211], psrc->fipo);
9646 fputs(co->validator, psrc->fipo);
9647 fputs(dkct_gui_out_kw[24], psrc->fipo);
9648 fputs(dkct_gui_out_kw[0], psrc->fipo);
9649 } break;
9650 }
9651 }
9652 if((co->sizex > 0) && (co->sizey > 0)) {
9653 switch(co->cln) {
9654 case -1: {
9655 fputs(dkct_gui_out_kw[8], psrc->fipo);
9656 if(co->name) {
9657 fputs(co->name, psrc->fipo);
9658 fputs(dkct_gui_out_kw[31], psrc->fipo);
9659 }
9660 fputs(dkct_gui_out_kw[212], psrc->fipo);
9661 dkct_gui_write_size(psrc, co->sizex, co->sizey, 0, co);
9662 fputs(dkct_gui_out_kw[24], psrc->fipo);
9663 fputs(dkct_gui_out_kw[0], psrc->fipo);
9664 } break;
9665 }
9666 }
9667
9668 }
9669
9670
9671
9672 #if 0
9673 /** Add item to toolbar.
9674 This function is not longer needed as the
9675 AddTool() method is used as the constructor
9676 for wxToolBarToolBase.
9677 @param co Item to add.
9678 @param dp Toolbar to add to.
9679 @param psrc Source structure.
9680 */
9681 static
9682 void
9683 dkct_gui_add_tool_bar_item(
9684 DKCT_GUI_ELEMENT *co,
9685 DKCT_GUI_ELEMENT *dp,
9686 DKCT_SRC *psrc
9687 )
9688 {
9689 }
9690 #endif
9691
9692
9693
9694 /** Construct all members and add them.
9695 @param psrc Source structure.
9696 @param gui GUI description.
9697 */
9698 static
9699 void
dkct_gui_write_members(DKCT_SRC * psrc,DKCT_GUI * gui)9700 dkct_gui_write_members(DKCT_SRC *psrc, DKCT_GUI *gui)
9701 {
9702 DKCT_GUI_ELEMENT *co; /* Current object. */
9703 DKCT_GUI_ELEMENT *dp; /* Direct parent. */
9704 DKCT_GUI_ELEMENT *pw; /* Parent window. */
9705 DKCT_GUI_ELEMENT *ne; /* Next element. */
9706 char const *fnptr = NULL; /* File to use for debug output. */
9707 int pprost; /* Parent output state. */
9708 int pcln; /* Parent class name. */
9709
9710 fnptr = dkct_tr_get_kw8(((psrc->dkcto).deb == 2) ? 28 : 29);
9711 co = gui->r_el;
9712 if(co->cln != 1) {
9713 psrc->lineno = 1UL;
9714 fputs(dkct_gui_out_kw[8], psrc->fipo);
9715 fputs(dkct_gui_out_kw[33], psrc->fipo);
9716 fputs(dkct_gui_out_kw[25], psrc->fipo);
9717 fputs(dkct_gui_out_kw[30], psrc->fipo);
9718 fputs(dkct_gui_out_kw[26], psrc->fipo);
9719 /* DEBUG OUTPUT */
9720 if((psrc->dkcto).deb) {
9721
9722 fputs(dkct_tr_get_kw8(24), psrc->fipo);
9723 if((psrc->dkcto).win) {
9724 fputs(dkct_tr_get_kw8(21), psrc->fipo);
9725 /* 16-bit begin */
9726 if((psrc->dkcto).deb != 2) {
9727 fputs(dkct_tr_get_kw8(30), psrc->fipo);
9728 }
9729 if((psrc->dkcto).ts) {
9730 if((psrc->dkcto).deb == 2) {
9731 fputs(dkct_tr_get_kw8(72), psrc->fipo);
9732 } else {
9733 fputs(dkct_tr_get_kw8(71), psrc->fipo);
9734 }
9735 }
9736 fputs(dkct_tr_get_kw8(61), psrc->fipo);
9737 dkct_tr_show_filename_and_lineno(psrc);
9738 fputs(dkct_tr_get_kw8(35), psrc->fipo);
9739 fputs(fnptr, psrc->fipo);
9740 fputs(dkct_tr_get_kw8(34), psrc->fipo);
9741 fputs(dkct_tr_get_kw8(61), psrc->fipo);
9742 fputs(dkct_tr_get_kw8(73), psrc->fipo);
9743 fputs(dkct_tr_get_kw8(75), psrc->fipo);
9744 fputs(dkct_tr_get_kw8(74), psrc->fipo);
9745 fputs(dkct_tr_get_kw8(35), psrc->fipo);
9746 fputs(fnptr, psrc->fipo);
9747 fputs(dkct_tr_get_kw8(34), psrc->fipo);
9748 if((psrc->dkcto).deb != 2) {
9749 fputs(dkct_tr_get_kw8(31), psrc->fipo);
9750 }
9751 /* 16-bit end */
9752 fputs(dkct_tr_get_kw8(22), psrc->fipo);
9753 }
9754 /* 8-bit begin */
9755 if((psrc->dkcto).deb != 2) {
9756 fputs(dkct_tr_get_kw8(30), psrc->fipo);
9757 }
9758 if((psrc->dkcto).ts) {
9759 if((psrc->dkcto).deb == 2) {
9760 fputs(dkct_tr_get_kw8(70), psrc->fipo);
9761 } else {
9762 fputs(dkct_tr_get_kw8(32), psrc->fipo);
9763 }
9764 }
9765 fputs(dkct_tr_get_kw8(33), psrc->fipo);
9766 dkct_tr_show_filename_and_lineno(psrc);
9767 fputs(dkct_tr_get_kw8(35), psrc->fipo);
9768 fputs(fnptr, psrc->fipo);
9769 fputs(dkct_tr_get_kw8(34), psrc->fipo);
9770 fputs(dkct_tr_get_kw8(33), psrc->fipo);
9771 fputs(dkct_tr_get_kw8(73), psrc->fipo);
9772 fputs(dkct_tr_get_kw8(75), psrc->fipo);
9773 fputs(dkct_tr_get_kw8(74), psrc->fipo);
9774 fputs(dkct_tr_get_kw8(35), psrc->fipo);
9775 fputs(fnptr, psrc->fipo);
9776 fputs(dkct_tr_get_kw8(34), psrc->fipo);
9777 if((psrc->dkcto).deb != 2) {
9778 fputs(dkct_tr_get_kw8(31), psrc->fipo);
9779 }
9780 /* 8-bit end */
9781 if((psrc->dkcto).win) {
9782 fputs(dkct_tr_get_kw8(23), psrc->fipo);
9783 }
9784 fputs(dkct_tr_get_kw8(25), psrc->fipo);
9785 }
9786 fputs(dkct_gui_out_kw[27], psrc->fipo);
9787 fputs(dkct_gui_out_kw[28], psrc->fipo);
9788 if((psrc->dkcto).deb) {
9789
9790 fputs(dkct_tr_get_kw8(24), psrc->fipo);
9791 if((psrc->dkcto).win) {
9792 fputs(dkct_tr_get_kw8(21), psrc->fipo);
9793 /* 16-bit begin */
9794 if((psrc->dkcto).deb != 2) {
9795 fputs(dkct_tr_get_kw8(30), psrc->fipo);
9796 }
9797 if((psrc->dkcto).ts) {
9798 if((psrc->dkcto).deb == 2) {
9799 fputs(dkct_tr_get_kw8(72), psrc->fipo);
9800 } else {
9801 fputs(dkct_tr_get_kw8(71), psrc->fipo);
9802 }
9803 }
9804 fputs(dkct_tr_get_kw8(61), psrc->fipo);
9805 dkct_tr_show_filename_and_lineno(psrc);
9806 fputs(dkct_tr_get_kw8(35), psrc->fipo);
9807 fputs(fnptr, psrc->fipo);
9808 fputs(dkct_tr_get_kw8(34), psrc->fipo);
9809 fputs(dkct_tr_get_kw8(61), psrc->fipo);
9810 fputs(dkct_tr_get_kw8(76), psrc->fipo);
9811 fputs(dkct_tr_get_kw8(75), psrc->fipo);
9812 fputs(dkct_tr_get_kw8(74), psrc->fipo);
9813 fputs(dkct_tr_get_kw8(35), psrc->fipo);
9814 fputs(fnptr, psrc->fipo);
9815 fputs(dkct_tr_get_kw8(34), psrc->fipo);
9816 if((psrc->dkcto).deb != 2) {
9817 fputs(dkct_tr_get_kw8(31), psrc->fipo);
9818 }
9819 /* 16-bit end */
9820 fputs(dkct_tr_get_kw8(22), psrc->fipo);
9821 }
9822 /* 8-bit begin */
9823 if((psrc->dkcto).deb != 2) {
9824 fputs(dkct_tr_get_kw8(30), psrc->fipo);
9825 }
9826 if((psrc->dkcto).ts) {
9827 if((psrc->dkcto).deb == 2) {
9828 fputs(dkct_tr_get_kw8(70), psrc->fipo);
9829 } else {
9830 fputs(dkct_tr_get_kw8(32), psrc->fipo);
9831 }
9832 }
9833 fputs(dkct_tr_get_kw8(33), psrc->fipo);
9834 dkct_tr_show_filename_and_lineno(psrc);
9835 fputs(dkct_tr_get_kw8(35), psrc->fipo);
9836 fputs(fnptr, psrc->fipo);
9837 fputs(dkct_tr_get_kw8(34), psrc->fipo);
9838 fputs(dkct_tr_get_kw8(33), psrc->fipo);
9839 fputs(dkct_tr_get_kw8(76), psrc->fipo);
9840 fputs(dkct_tr_get_kw8(75), psrc->fipo);
9841 fputs(dkct_tr_get_kw8(74), psrc->fipo);
9842 fputs(dkct_tr_get_kw8(35), psrc->fipo);
9843 fputs(fnptr, psrc->fipo);
9844 fputs(dkct_tr_get_kw8(34), psrc->fipo);
9845 if((psrc->dkcto).deb != 2) {
9846 fputs(dkct_tr_get_kw8(31), psrc->fipo);
9847 }
9848 /* 8-bit end */
9849 if((psrc->dkcto).win) {
9850 fputs(dkct_tr_get_kw8(23), psrc->fipo);
9851 }
9852 fputs(dkct_tr_get_kw8(25), psrc->fipo);
9853 }
9854 }
9855 dk3sto_it_reset(co->i_contents);
9856 while(co) {
9857 psrc->lineno = ((co->lndef) > 0UL) ? (co->lndef) : (co->lndecl);
9858 dk3app_set_source_line(psrc->app, psrc->lineno);
9859 dp = pw = (DKCT_GUI_ELEMENT *)(co->parent);
9860 pw = dkct_gui_find_real_parent(pw);
9861 switch(co->prost) {
9862 case DKCT_GUI_PROCESSING_STATE_START: {
9863 if(co->pseudoobj) {
9864 /*
9865 Pseudo object (stretch spacer, separator...)
9866 */
9867 dkct_gui_add_pseudo_object(co, dp, pw, psrc, gui);
9868 co = (DKCT_GUI_ELEMENT *)(co->parent);
9869 } else {
9870 /*
9871 Real object.
9872 */
9873 if((co->parent) && (co->name)) {
9874 if(dkct_gui_need_element_constructor(co)) {
9875
9876 dkct_gui_write_element_constructor(co, dp, pw, psrc, gui);
9877 }
9878 }
9879 dk3sto_it_reset(co->i_contents);
9880 if(co->menubar) {
9881 fputs(dkct_gui_out_kw[19], psrc->fipo);
9882 co->prost = DKCT_GUI_PROCESSING_STATE_MENU;
9883 co = (DKCT_GUI_ELEMENT *)(co->menubar);
9884 } else {
9885 if(co->toolbar) {
9886 fputs(dkct_gui_out_kw[20], psrc->fipo);
9887 co->prost = DKCT_GUI_PROCESSING_STATE_TOOL;
9888 co = (DKCT_GUI_ELEMENT *)(co->toolbar);
9889 } else {
9890 co->prost = DKCT_GUI_PROCESSING_STATE_CONTENTS;
9891 }
9892 }
9893 }
9894 } break;
9895 case DKCT_GUI_PROCESSING_STATE_MENU: {
9896 /*
9897 Finish menu processing.
9898 */
9899 fputs(dkct_gui_out_kw[22], psrc->fipo);
9900 if(co->toolbar) {
9901 fputs(dkct_gui_out_kw[20], psrc->fipo);
9902 co->prost = DKCT_GUI_PROCESSING_STATE_TOOL;
9903 co = (DKCT_GUI_ELEMENT *)(co->toolbar);
9904 } else {
9905 co->prost = DKCT_GUI_PROCESSING_STATE_CONTENTS;
9906 }
9907 } break;
9908 case DKCT_GUI_PROCESSING_STATE_TOOL: {
9909 /*
9910 Finish tool bar processing.
9911 */
9912 fputs(dkct_gui_out_kw[22], psrc->fipo);
9913 co->prost = DKCT_GUI_PROCESSING_STATE_CONTENTS;
9914 } break;
9915 case DKCT_GUI_PROCESSING_STATE_CONTENTS: {
9916 ne = (DKCT_GUI_ELEMENT *)dk3sto_it_next(co->i_contents);
9917 if(ne) {
9918 co = ne;
9919 } else {
9920 co->prost = DKCT_GUI_PROCESSING_STATE_DONE;
9921 /*
9922 Finish current element.
9923 */
9924 dkct_gui_finish_current_element(co, psrc, gui);
9925 /*
9926 Add current element to parent.
9927 */
9928 if(dkct_gui_is_sizer(co)) {
9929 if(dkct_gui_is_sizer((DKCT_GUI_ELEMENT *)(co->parent))) {
9930 dkct_gui_add_object_to_sizer(
9931 co, (DKCT_GUI_ELEMENT *)(co->parent), psrc, gui
9932 );
9933 } else {
9934 /*
9935 parent->SetSizer(object);
9936 SetSizer(object);
9937 */
9938 dkct_gui_set_parents_sizer(
9939 co, (DKCT_GUI_ELEMENT *)(co->parent), psrc, gui
9940 );
9941 }
9942 } else {
9943 if(dkct_gui_is_sizer((DKCT_GUI_ELEMENT *)(co->parent))) {
9944 dkct_gui_add_object_to_sizer(
9945 co, (DKCT_GUI_ELEMENT *)(co->parent), psrc, gui
9946 );
9947 } else {
9948 /*
9949 Handle special combinations of parent/child classes.
9950 */
9951 pprost = DKCT_GUI_PROCESSING_STATE_CONTENTS;
9952 if(dp) { pprost = dp->prost; }
9953 switch(pprost) {
9954 /*
9955 Add menu bar to root level window.
9956 */
9957 case DKCT_GUI_PROCESSING_STATE_MENU: {
9958 fputs(dkct_gui_out_kw[8], psrc->fipo);
9959 if(dp->name) {
9960 fputs(dp->name, psrc->fipo);
9961 fputs(dkct_gui_out_kw[31], psrc->fipo);
9962 }
9963 fputs(dkct_gui_out_kw[57], psrc->fipo);
9964 fputs(co->name, psrc->fipo);
9965 fputs(dkct_gui_out_kw[24], psrc->fipo);
9966 fputs(dkct_gui_out_kw[0], psrc->fipo);
9967 } break;
9968 case DKCT_GUI_PROCESSING_STATE_TOOL: {
9969 /*
9970 Add too lbar to root level window.
9971 */
9972 fputs(dkct_gui_out_kw[8], psrc->fipo);
9973 if(dp->name) {
9974 fputs(dp->name, psrc->fipo);
9975 fputs(dkct_gui_out_kw[31], psrc->fipo);
9976 }
9977 fputs(dkct_gui_out_kw[58], psrc->fipo);
9978 fputs(co->name, psrc->fipo);
9979 fputs(dkct_gui_out_kw[24], psrc->fipo);
9980 fputs(dkct_gui_out_kw[0], psrc->fipo);
9981 } break;
9982 default: {
9983 pcln = -1;
9984 if(dp) { pcln = dp->cln; }
9985
9986 switch(pcln) {
9987 case 35: { /* Appending to a menu bar. */
9988 switch(co->cln) {
9989 case 36: {
9990 /*
9991 Add menu to menu bar.
9992 */
9993 if((dp->name) && (co->name)) {
9994 fputs(dkct_gui_out_kw[8], psrc->fipo);
9995 fputs(dp->name, psrc->fipo);
9996 fputs(dkct_gui_out_kw[184], psrc->fipo);
9997 fputs(co->name, psrc->fipo);
9998 fputs(dkct_gui_out_kw[55], psrc->fipo);
9999 if(co->text) {
10000 fputs(co->text, psrc->fipo);
10001 } else {
10002 fputs(dkct_gui_out_kw[73], psrc->fipo);
10003 }
10004 fputs(dkct_gui_out_kw[24], psrc->fipo);
10005 fputs(dkct_gui_out_kw[0], psrc->fipo);
10006 }
10007 } break;
10008 default: {
10009 /* ERROR: Illegal child class! */
10010 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 81);
10011 } break;
10012 }
10013 } break;
10014 case 36: { /* Appending to a menu. */
10015 switch(co->cln) {
10016 case 37: {
10017 /*
10018 Add menu item to menu.
10019 */
10020 #if 0
10021 if((dp->name) && (co->name)) {
10022 fputs(dkct_gui_out_kw[8], psrc->fipo);
10023 fputs(dp->name, psrc->fipo);
10024 fputs(dkct_gui_out_kw[184], psrc->fipo);
10025 fputs(co->name, psrc->fipo);
10026 fputs(dkct_gui_out_kw[24], psrc->fipo);
10027 fputs(dkct_gui_out_kw[0], psrc->fipo);
10028 }
10029 #endif
10030 } break;
10031 case 36: {
10032 /*
10033 Add sub-menu to menu.
10034 */
10035 if((dp->name) && (co->name)) {
10036 fputs(dkct_gui_out_kw[8], psrc->fipo);
10037 fputs(dp->name, psrc->fipo);
10038 fputs(dkct_gui_out_kw[184], psrc->fipo);
10039 dkct_gui_write_idname(co, psrc);
10040 fputs(dkct_gui_out_kw[55], psrc->fipo);
10041 if(co->text) {
10042 fputs(co->text, psrc->fipo);
10043 } else {
10044 fputs(dkct_gui_out_kw[73], psrc->fipo);
10045 }
10046 fputs(dkct_gui_out_kw[55], psrc->fipo);
10047 fputs(co->name, psrc->fipo);
10048 if(co->tipText) {
10049 fputs(dkct_gui_out_kw[55], psrc->fipo);
10050 fputs(co->tipText, psrc->fipo);
10051 }
10052 fputs(dkct_gui_out_kw[24], psrc->fipo);
10053 fputs(dkct_gui_out_kw[0], psrc->fipo);
10054 }
10055 } break;
10056 default: {
10057 /* ERROR: Illegal child class! */
10058 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 81);
10059 } break;
10060 }
10061 } break;
10062 case 38: { /* Appending to a tool bar. */
10063 switch(co->cln) {
10064 case 40: /* wxToolBarToolBase */
10065 {
10066 } break;
10067 default: { /* Any control */
10068 if(co->name) {
10069 if(dp->name) {
10070 fputs(dkct_gui_out_kw[8], psrc->fipo);
10071 fputs(dp->name, psrc->fipo);
10072 fputs(dkct_gui_out_kw[187], psrc->fipo);
10073 fputs(co->name, psrc->fipo);
10074 fputs(dkct_gui_out_kw[24], psrc->fipo);
10075 fputs(dkct_gui_out_kw[0], psrc->fipo);
10076 }
10077 }
10078 } break;
10079 }
10080 } break;
10081 case 14: { /* wxSplitterWindow */
10082 /*
10083 Do nothing, elements are added when finishing
10084 the splitter window.
10085 */
10086 } break;
10087 case 12: case 42: case 43: case 44: case 45: case 46: {
10088 /* Parent is wxNotebook */
10089 if (
10090 (NULL != co->name) && (NULL != dp->name)
10091 && (NULL != co->text))
10092 {
10093 fputs(dkct_gui_out_kw[8], psrc->fipo);
10094 fputs(dp->name, psrc->fipo);
10095 fputs(dkct_gui_out_kw[220], psrc->fipo);
10096 fputs(co->name, psrc->fipo);
10097 fputs(dkct_gui_out_kw[55], psrc->fipo);
10098 fputs(co->text, psrc->fipo);
10099 fputs(dkct_gui_out_kw[24], psrc->fipo);
10100 fputs(dkct_gui_out_kw[0], psrc->fipo);
10101 }
10102 else {
10103 /* ERROR: Missing text */
10104 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 124);
10105 }
10106 } break;
10107 default: {
10108 if((co->number) && (co->parent)) {
10109 char const *pname;
10110 char const *oname;
10111 /* ERROR: Don't know how to add */
10112 pname = oname = dkct_gui_out_kw[197];
10113 if(co->name) oname = co->name;
10114 if(dp) { if(dp->name) pname = dp->name; }
10115 dkct_to_log_5(
10116 gui->psrc, 1, DK3_LL_ERROR, 84, 85, 86, oname, pname
10117 );
10118 }
10119 } break;
10120 }
10121 } break;
10122 }
10123 }
10124 }
10125 co = (DKCT_GUI_ELEMENT *)(co->parent);
10126 }
10127 } break;
10128 default: {
10129 co = (DKCT_GUI_ELEMENT *)(co->parent);
10130 } break;
10131 }
10132 }
10133 }
10134
10135
10136
10137 /** Complain if an element is not in the contents of a parent object.
10138 @param psrc Source structure.
10139 @param el Element to complain about.
10140 */
10141 static
10142 void
complain_about_missing_parent(DKCT_SRC * gpsrc,DKCT_SRC * psrc,DKCT_GUI_ELEMENT * el)10143 complain_about_missing_parent(
10144 DKCT_SRC *gpsrc, DKCT_SRC *psrc, DKCT_GUI_ELEMENT *el
10145 )
10146 {
10147 DKCT_SRC *xpsrc;
10148 unsigned long oldlineno;
10149 int must_complain;
10150
10151
10152 /*
10153 Check element el whether complaint is really necessary
10154 */
10155 must_complain = 1;
10156 /*
10157 Write warning
10158 */
10159 xpsrc = ((NULL != gpsrc) ? (gpsrc) : (psrc));
10160 if ((0 != must_complain) && (NULL != xpsrc)) {
10161 oldlineno = xpsrc->lineno;
10162 xpsrc->lineno = el->lndef;
10163 dkct_to_log_3(xpsrc, 1, DK3_LL_WARNING, 126, 127, el->name);
10164 xpsrc->lineno = oldlineno;
10165 }
10166
10167 }
10168
10169
10170
10171 /** Write top level class constructor.
10172 @param psrc Source structure.
10173 */
10174 void
dkct_gui_write_constructor(DKCT_SRC * psrc)10175 dkct_gui_write_constructor(DKCT_SRC *psrc)
10176 {
10177 char bu[256]; /* Buffer for numeric values. */
10178 DKCT_GUI *gui; /* GUI description. */
10179 DKCT_GUI_ELEMENT *el; /* Current object. */
10180 DKCT_GUI_ELEMENT *szmain; /* Main sizer. */
10181 int szfound = 0; /* Flag: Sizer found. */
10182 int w = 0; /* Object width. */
10183 int h = 0; /* Object height. */
10184 if(psrc->gui) {
10185 gui = (DKCT_GUI *)(psrc->gui);
10186 /*
10187 Flag: GUI not ok.
10188 */
10189 fputs(dkct_gui_out_kw[8], psrc->fipo);
10190 fputs(dkct_gui_out_kw[9], psrc->fipo);
10191 if(dkct_gui_need_contents_panel(gui)) {
10192 fputs(dkct_gui_out_kw[8], psrc->fipo);
10193 fputs(dkct_gui_out_kw[18], psrc->fipo);
10194 }
10195 /*
10196 Initialize all member variables to NULL.
10197 */
10198 dk3sto_it_reset(gui->i_el_by_num);
10199 while((el = (DKCT_GUI_ELEMENT *)dk3sto_it_next(gui->i_el_by_num)) != NULL) {
10200 if(el->pseudoobj == 0) {
10201 if(dkct_gui_need_element_constructor(el)) {
10202 if((el->name) && (el->cname)) {
10203 fputs(dkct_gui_out_kw[8], psrc->fipo);
10204 fputs(el->name, psrc->fipo);
10205 fputs(dkct_gui_out_kw[14], psrc->fipo);
10206 if (NULL == el->parent) {
10207 complain_about_missing_parent(gui->psrc, psrc, el);
10208 }
10209 }
10210 }
10211 }
10212 }
10213 /*
10214 Construct member variables.
10215 */
10216 dkct_gui_write_members(psrc, gui);
10217 /*
10218 Flag: GUI ok.
10219 */
10220 el = gui->r_el;
10221 if(el) {
10222 w = el->sizex; h = el->sizey;
10223 }
10224 fputs(dkct_gui_out_kw[8], psrc->fipo);
10225 fputs(dkct_gui_out_kw[10], psrc->fipo);
10226 /*
10227 End goto label.
10228 */
10229 fputs(dkct_gui_out_kw[8], psrc->fipo);
10230 fputs(dkct_gui_out_kw[11], psrc->fipo);
10231 fputs(dkct_gui_out_kw[12], psrc->fipo);
10232 fputs(dkct_gui_out_kw[0], psrc->fipo);
10233 if(el) {
10234 if(el->stbsz > 0) {
10235 /*
10236 if wxUSE_STATUSBAR
10237 if(dkctGUILayoutOK) {
10238 CreateStatusBar(2);
10239 SetStatusText(text);
10240 }
10241 endif
10242 */
10243 fputs(dkct_gui_out_kw[21], psrc->fipo);
10244 fputs(dkct_gui_out_kw[59], psrc->fipo);
10245 sprintf(bu, "%d", el->stbsz);
10246 fputs(dkct_gui_out_kw[90], psrc->fipo);
10247 fputs(bu, psrc->fipo);
10248 fputs(dkct_gui_out_kw[24], psrc->fipo);
10249 fputs(dkct_gui_out_kw[0], psrc->fipo);
10250 if(el->stbText) {
10251 fputs(dkct_gui_out_kw[91], psrc->fipo);
10252 fputs(el->stbText, psrc->fipo);
10253 fputs(dkct_gui_out_kw[24], psrc->fipo);
10254 fputs(dkct_gui_out_kw[0], psrc->fipo);
10255 }
10256 fputs(dkct_gui_out_kw[64], psrc->fipo);
10257 fputs(dkct_gui_out_kw[22], psrc->fipo);
10258 }
10259 }
10260 /* | if(dkctGUILayoutOK) {| */
10261 fputs(dkct_gui_out_kw[59], psrc->fipo);
10262 if((w > 0) && (h > 0)) {
10263 sprintf(bu, "%d, %d", w, h);
10264 /* | wxSize const dkctGUIMinSize(| */
10265 fputs(dkct_gui_out_kw[89], psrc->fipo);
10266 fputs(bu, psrc->fipo);
10267 /* |);| */
10268 fputs(dkct_gui_out_kw[24], psrc->fipo);
10269 fputs(dkct_gui_out_kw[0], psrc->fipo);
10270 /* | SetClientSize(dkctGUIMinSize);| */
10271 fputs(dkct_gui_out_kw[62], psrc->fipo);
10272 } else {
10273 if (NULL != el) {
10274 dk3sto_it_reset(el->i_contents);
10275 szmain = (DKCT_GUI_ELEMENT *)dk3sto_it_next(el->i_contents);
10276 if(NULL != szmain) {
10277 switch(szmain->cln) {
10278 case 5: case 6: case 7: case 8: case 9: case 10: {
10279 if(szmain->name) {
10280 /* | | */
10281 fputs(dkct_gui_out_kw[2], psrc->fipo);
10282 fputs(szmain->name, psrc->fipo);
10283 /* |->Fit(this);| */
10284 fputs(dkct_gui_out_kw[63], psrc->fipo);
10285 }
10286 } break;
10287 }
10288 }
10289 }
10290 }
10291 szmain = NULL;
10292 if (NULL != el) {
10293 dk3sto_it_reset(el->i_contents);
10294 szmain = (DKCT_GUI_ELEMENT *)dk3sto_it_next(el->i_contents);
10295 if(NULL != szmain) {
10296 if(NULL != szmain->name) {
10297 switch(szmain->cln) {
10298 case 5: case 6: case 7: case 8: case 9: case 10: {
10299 /* | | */
10300 fputs(dkct_gui_out_kw[2], psrc->fipo);
10301 fputs(szmain->name, psrc->fipo);
10302 /* |->SetSizeHints(this);| */
10303 fputs(dkct_gui_out_kw[60], psrc->fipo);
10304 szfound = 1;
10305 } break;
10306 }
10307 }
10308 }
10309 }
10310 /* | } */
10311 fputs(dkct_gui_out_kw[64], psrc->fipo);
10312 if(!(szfound)) {
10313 (gui->psrc)->ec = DK3_ERROR_SYNTAX;
10314 /* ERROR: No sizer found! */
10315 dkct_to_log_1(gui->psrc, 1, DK3_LL_ERROR, 97);
10316 }
10317 }
10318 }
10319
10320
10321
10322 /* vim: set ai sw=2 : */
10323
10324