Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-sdl3/optiondlg.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
optiondlg.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14/***********************************************************************
15 optiondlg.c - description
16 -------------------
17 begin : Sun Aug 11 2002
18 copyright : (C) 2002 by Rafał Bursig
19 email : Rafał Bursig <bursig@poczta.fm>
20***********************************************************************/
21
22#ifdef HAVE_CONFIG_H
23#include <fc_config.h>
24#endif
25
26#include <stdarg.h>
27#include <stdlib.h>
28
29/* SDL3 */
30#include <SDL3/SDL.h>
31
32/* utility */
33#include "fcintl.h"
34#include "log.h"
35#include "string_vector.h"
36
37/* common */
38#include "fc_types.h"
39#include "game.h"
40
41/* client */
42#include "client_main.h"
43#include "climisc.h"
44#include "clinet.h"
45#include "connectdlg_common.h"
46#include "global_worklist.h"
47#include "pages_g.h"
48
49/* gui-sdl3 */
50#include "colors.h"
51#include "connectdlg.h"
52#include "dialogs.h"
53#include "graphics.h"
54#include "gui_id.h"
55#include "gui_main.h"
56#include "gui_tilespec.h"
57#include "helpdlg.h"
58#include "mapctrl.h"
59#include "mapview.h"
60#include "menu.h"
61#include "messagewin.h"
62#include "themespec.h"
63#include "widget.h"
64#include "wldlg.h"
65
66#include "optiondlg.h"
67
68 enum option_dialog_mode {
69 ODM_MAIN,
70 ODM_OPTSET,
71 ODM_WORKLIST
72};
73
74struct option_dialog_optset {
75 const struct option_set *poptset;
76 struct widget *widget_list;
77 int category;
78};
79
80struct option_dialog_worklist {
81 struct widget *edited_name;
82};
83
84struct option_dialog {
85 struct widget *end_widget_list;
86 struct widget *core_widget_list;
87 struct widget *main_widget_list;
88 struct widget *begin_widget_list;
89 struct advanced_dialog *advanced;
90 enum option_dialog_mode mode;
91 union {
92 struct option_dialog_optset optset;
93 struct option_dialog_worklist worklist;
94 };
95};
96
97
98 static struct option_dialog *option_dialog = NULL;
99 struct widget *options_button = NULL;
100 static bool restore_meswin_dialog = FALSE;
101
102
103static struct widget *option_widget_new(struct option *poption,
104 struct widget *window,
105 bool hide);
106static void option_widget_update(struct option *poption);
107static void option_widget_apply(struct option *poption);
108
109static struct option_dialog *option_dialog_new(void);
110static void option_dialog_destroy(struct option_dialog *pdialog);
111
112static void option_dialog_optset(struct option_dialog *pdialog,
113 const struct option_set *poptset);
114static void option_dialog_optset_category(struct option_dialog *pdialog,
115 int category);
116
117static void option_dialog_worklist(struct option_dialog *pdialog);
118
119/************************************************************************/
123 static void arrange_widgets(struct widget *window, int widgets_per_row,
124 int rows_shown, struct widget *begin,
125 struct widget *end, ...)
126{
127 struct widget *widget;
128 SDL_Surface *logo;
129 SDL_Rect area;
130 int longest[widgets_per_row], xpos[widgets_per_row];
131 int w, h, i, j;
132 va_list args;
133
134 fc_assert_ret(NULL != window);
135 fc_assert_ret(NULL != begin);
136 fc_assert_ret(NULL != end);
137 fc_assert_ret(0 < widgets_per_row);
138
139 /* Get window dimensions. */
140 memset(longest, 0, sizeof(longest));
141 for (widget = begin, i = 0; widget != end; widget = widget->next, i++) {
142 j = i % widgets_per_row;
143 longest[j] = MAX(longest[j], widget->size.w);
144 }
145
146 fc_assert(0 == (i % widgets_per_row));
147
148 if (-1 == rows_shown) {
149 h = 30 * (i / widgets_per_row);
150 } else {
151 h = 30 * MIN((i / widgets_per_row), rows_shown);
152 }
153
154 w = (1 - widgets_per_row) * adj_size(20);
155 for (j = 0; j < widgets_per_row; j++) {
156 w += longest[j];
157 }
158 if (-1 != rows_shown) {
159 w += adj_size(20);
160 }
161
162 /* Clear former area. */
163 area = window->area;
164 area.w += window->size.x;
165 area.h += window->size.y;
166 dirty_sdl_rect(&area);
167
168 /* Resize window. */
169 logo = theme_get_background(active_theme, BACKGROUND_OPTIONDLG);
170 if (resize_window(window, logo, NULL,
171 adj_size(w + 80), adj_size(h + 80))) {
172 FREESURFACE(logo);
173 }
174
175 /* Set window position. */
176 widget_set_position(window, (main_window_width() - window->size.w) / 2,
177 (main_window_height() - window->size.h) / 2);
178
179 area = window->area;
180
181 /* Set icons position. */
182 va_start(args, end);
183 w = 0;
184 while ((widget = va_arg(args, struct widget *))) {
185 w += widget->size.w;
186 widget_set_position(widget, area.x + area.w - w - 1,
187 window->size.y + adj_size(2));
188 }
189 va_end(args);
190
191 if (1 < widgets_per_row) {
192 xpos[widgets_per_row - 1] = area.x + adj_size(20);
193 for (j = widgets_per_row - 2; j >= 0; j--) {
194 xpos[j] = xpos[j + 1] + adj_size(20) + longest[j + 1];
195 }
196 }
197
198 /* Set button position. */
199 h = 30 * (i / widgets_per_row + 1);
200 for (widget = begin, i = 0; widget != end; widget = widget->next, i++) {
201 j = i % widgets_per_row;
202 if (0 == j) {
203 h -= 30;
204 }
205 widget_resize(widget, longest[j], widget->size.h);
206 if (1 == widgets_per_row) {
207 widget_set_position(widget, area.x + (area.w - widget->size.w) / 2,
208 area.y + adj_size(h));
209 } else {
210 widget_set_position(widget, xpos[j], area.y + adj_size(h));
211 }
212 }
213
214 redraw_group(begin, window, 0);
215 widget_mark_dirty(window);
216 flush_all();
217}
218
219/************************************************************************/
222 static int main_optiondlg_callback(struct widget *pwindow)
223{
224 if (NULL != option_dialog && PRESSED_EVENT(main_data.event)) {
225 move_window_group(option_dialog->begin_widget_list,
226 option_dialog->end_widget_list);
227 }
228
229 return -1;
230}
231
232/************************************************************************/
235 static int back_callback(struct widget *pwidget)
236{
237 if (NULL == option_dialog || !PRESSED_EVENT(main_data.event)) {
238 return -1;
239 }
240
241 if (ODM_MAIN == option_dialog->mode) {
242 if (client.conn.established) {
243 /* Back to game. */
244 popdown_optiondlg(FALSE);
245 enable_options_button();
246 widget_redraw(options_button);
247 widget_mark_dirty(options_button);
248 flush_dirty();
249 } else {
250 /* Back to main page. */
251 popdown_optiondlg(TRUE);
252 set_client_page(PAGE_MAIN);
253 }
254 return -1;
255 }
256
257 if (ODM_OPTSET == option_dialog->mode
258 && -1 != option_dialog->optset.category) {
259 /* Back to option set category menu. */
260 options_iterate(option_dialog->optset.poptset, poption) {
261 if (option_dialog->optset.category == option_category(poption)) {
262 option_set_gui_data(poption, NULL);
263 }
264 } options_iterate_end;
265 option_dialog->optset.category = -1;
266 FC_FREE(option_dialog->advanced->scroll);
267 FC_FREE(option_dialog->advanced);
268
269 del_group_of_widgets_from_gui_list(option_dialog->begin_widget_list,
270 option_dialog->optset.widget_list->prev);
271
272 option_dialog->begin_widget_list = option_dialog->optset.widget_list;
273
274 show_group(option_dialog->begin_widget_list,
275 option_dialog->main_widget_list->prev);
276
277 arrange_widgets(option_dialog->end_widget_list, 1, -1,
278 option_dialog->begin_widget_list,
279 option_dialog->main_widget_list,
280 option_dialog->core_widget_list, NULL);
281 return -1;
282 }
283
284 if (ODM_WORKLIST == option_dialog->mode
285 && NULL != option_dialog->advanced) {
286 FC_FREE(option_dialog->advanced->scroll);
287 FC_FREE(option_dialog->advanced);
288 option_dialog->worklist.edited_name = NULL;
289 }
290
291 /* Back to main options menu. */
292 del_group_of_widgets_from_gui_list(option_dialog->begin_widget_list,
293 option_dialog->main_widget_list->prev);
294
295 option_dialog->begin_widget_list = option_dialog->main_widget_list;
296
297 show_group(option_dialog->begin_widget_list,
298 option_dialog->core_widget_list->prev);
299 option_dialog->mode = ODM_MAIN;
300 arrange_widgets(option_dialog->end_widget_list, 1, -1,
301 option_dialog->begin_widget_list,
302 option_dialog->core_widget_list,
303 option_dialog->core_widget_list, NULL);
304
305 return -1;
306}
307
308/************************************************************************/
311 static int client_options_callback(struct widget *pwidget)
312{
313 if (PRESSED_EVENT(main_data.event)) {
314 option_dialog_popup(_("Local Options"), client_optset);
315 }
316
317 return -1;
318}
319
320/************************************************************************/
323 static int server_options_callback(struct widget *pwidget)
324{
325 if (PRESSED_EVENT(main_data.event)) {
326 option_dialog_popup(_("Server options"), server_optset);
327 }
328
329 return -1;
330}
331
332/************************************************************************/
335 static int work_lists_callback(struct widget *widget)
336{
337 if (PRESSED_EVENT(main_data.event)) {
338 option_dialog_worklist(option_dialog);
339 }
340
341 return -1;
342}
343
344/************************************************************************/
347 static int save_client_options_callback(struct widget *pwidget)
348{
349 if (PRESSED_EVENT(main_data.event)) {
350 options_save(NULL);
351 }
352
353 return -1;
354}
355
356/************************************************************************/
359 static int save_game_callback(struct widget *pwidget)
360{
361 if (PRESSED_EVENT(main_data.event)) {
362 send_save_game(NULL);
363 back_callback(NULL);
364 }
365
366 return -1;
367}
368
369/************************************************************************/
372 static int help_browser_callback(struct widget *pwidget)
373{
374 if (PRESSED_EVENT(main_data.event)) {
375 popup_help_browser();
376 }
377
378 return -1;
379}
380
381/************************************************************************/
384 static int disconnect_callback(struct widget *pwidget)
385{
386 if (PRESSED_EVENT(main_data.event)) {
387 popdown_optiondlg(TRUE);
388 enable_options_button();
389 disconnect_from_server(TRUE);
390 }
391
392 return -1;
393}
394
395/************************************************************************/
398 static int exit_callback(struct widget *pwidget)
399{
400 if (PRESSED_EVENT(main_data.event)) {
401 popdown_optiondlg(TRUE);
402 disconnect_from_server(FALSE);
403 force_exit_from_event_loop();
404 }
405
406 return 0;
407}
408
409/************************************************************************/
412 static int option_category_callback(struct widget *widget)
413{
414 if (PRESSED_EVENT(main_data.event)) {
415 option_dialog_optset_category(option_dialog, MAX_ID - widget->id);
416 }
417
418 return -1;
419}
420
421/************************************************************************/
424 static int apply_callback(struct widget *widget)
425{
426 if (PRESSED_EVENT(main_data.event)
427 && NULL != option_dialog
428 && ODM_OPTSET == option_dialog->mode
429 && -1 != option_dialog->optset.category) {
430 options_iterate(option_dialog->optset.poptset, poption) {
431 if (option_dialog->optset.category == option_category(poption)) {
432 option_widget_apply(poption);
433 }
434 } options_iterate_end;
435 }
436
437 return back_callback(widget);
438}
439
440/************************************************************************/
443 static int none_callback(struct widget *widget)
444{
445 return -1;
446}
447
448/************************************************************************/
451 static struct strvec *video_mode_list(void)
452{
453 struct strvec *video_modes = strvec_new();
454 int display_count;
455 int mode_count;
456 int i, j;
457 SDL_DisplayID *ids;
458 const SDL_DisplayMode **modes;
459
460 ids = SDL_GetDisplays(&display_count);
461
462 if (ids == NULL) {
463 log_error(_("Failed to get display count: %s"), SDL_GetError());
464 return NULL;
465 }
466
467 for (i = 0; i < display_count; i++) {
468 modes = SDL_GetFullscreenDisplayModes(ids[i], &mode_count);
469
470 if (modes == NULL) {
471 log_error(_("Failed to get display modes for display %d: %s"),
472 ids[i], SDL_GetError());
473 break;
474 }
475
476 for (j = 0; j < mode_count; j++) {
477 char buf[64];
478 struct video_mode vmod = { .width = modes[j]->w, .height = modes[j]->h };
479
480 if (video_mode_to_string(buf, sizeof(buf), &vmod)) {
481 strvec_append(video_modes, buf);
482 }
483 }
484
485 SDL_free(modes);
486 }
487
488 SDL_free(ids);
489
490 return video_modes;
491}
492
493/************************************************************************/
496 static void enum_widget_destroy(struct widget *widget)
497{
498 strvec_destroy((struct strvec *) widget->data.vector);
499}
500
501/************************************************************************/
504 static void video_mode_widget_destroy(struct widget *widget)
505{
506 combo_popdown(widget);
507 strvec_destroy((struct strvec *) widget->data.vector);
508}
509
510/************************************************************************/
513 static struct widget *option_widget_new(struct option *poption,
514 struct widget *window,
515 bool hide)
516{
517 struct widget *widget;
518 char *help_text;
519 Uint32 flags = (hide ? WF_HIDDEN | WF_RESTORE_BACKGROUND
520 : WF_RESTORE_BACKGROUND);
521
522 fc_assert_ret_val(NULL != poption, NULL);
523 fc_assert_ret_val(NULL != window, NULL);
524
525 help_text = fc_strdup(option_help_text(poption));
526 fc_break_lines(help_text, 50);
527
528 widget = create_iconlabel_from_chars_fonto(NULL, window->dst,
529 option_description(poption),
530 FONTO_ATTENTION,
531 flags | WF_WIDGET_HAS_INFO_LABEL);
532 widget->string_utf8->style |= TTF_STYLE_BOLD;
533 widget->info_label = create_utf8_from_char_fonto(help_text,
534 FONTO_ATTENTION);
535 widget->action = none_callback;
536 set_wstate(widget, FC_WS_NORMAL);
537 remake_label_size(widget);
538 add_to_gui_list(MAX_ID - option_number(poption), widget);
539
540 widget = NULL;
541 switch (option_type(poption)) {
542 case OT_BOOLEAN:
543 widget = create_checkbox(window->dst, option_bool_get(poption),
544 flags | WF_WIDGET_HAS_INFO_LABEL);
545 break;
546
547 case OT_INTEGER:
548 {
549 char buf[64];
550
551 fc_snprintf(buf, sizeof(buf), "%d", option_int_get(poption));
552 widget = create_edit_from_chars_fonto(NULL, window->dst, buf,
553 FONTO_ATTENTION,
554 adj_size(25),
555 flags | WF_WIDGET_HAS_INFO_LABEL);
556 }
557 break;
558
559 case OT_STRING:
560 {
561 const struct strvec *values = option_str_values(poption);
562
563 if (NULL != values) {
564 widget = combo_new_from_chars_fonto(NULL, window->dst,
565 FONTO_ATTENTION,
566 option_str_get(poption), values,
567 adj_size(25),
568 flags | WF_WIDGET_HAS_INFO_LABEL);
569 } else {
570 widget = create_edit_from_chars_fonto(NULL, window->dst,
571 option_str_get(poption),
572 FONTO_ATTENTION,
573 adj_size(25),
574 flags | WF_WIDGET_HAS_INFO_LABEL);
575 }
576 }
577 break;
578
579 case OT_ENUM:
580 {
581 const struct strvec *values = option_enum_values(poption);
582 struct strvec *translated_values = strvec_new();
583 int i;
584
585 strvec_reserve(translated_values, strvec_size(values));
586 for (i = 0; i < strvec_size(values); i++) {
587 strvec_set(translated_values, i, _(strvec_get(values, i)));
588 }
589
590 widget = combo_new_from_chars_fonto(NULL, window->dst,
591 FONTO_ATTENTION,
592 _(option_enum_get_str(poption)),
593 translated_values, adj_size(25),
594 flags | WF_WIDGET_HAS_INFO_LABEL);
595 widget->destroy = enum_widget_destroy;
596 }
597 break;
598
599 case OT_VIDEO_MODE:
600 {
601 char buf[64];
602 struct video_mode vmod;
603
604 vmod = option_video_mode_get(poption);
605 if (!video_mode_to_string(buf, sizeof(buf), &vmod)) {
606 /* Always fails. */
607 fc_assert(video_mode_to_string(buf, sizeof(buf), &vmod));
608 }
609
610 widget = combo_new_from_chars_fonto(NULL, window->dst,
611 FONTO_ATTENTION,
612 buf, video_mode_list(), adj_size(25),
613 flags | WF_WIDGET_HAS_INFO_LABEL);
614 widget->destroy = video_mode_widget_destroy;
615 }
616 break;
617
618 case OT_FONT:
619 {
620 widget = create_edit_from_chars_fonto(NULL, window->dst,
621 option_font_get(poption),
622 FONTO_ATTENTION,
623 adj_size(25),
624 flags | WF_WIDGET_HAS_INFO_LABEL);
625 }
626 break;
627
628 case OT_BITWISE:
629 case OT_COLOR:
630 log_error("Option type %s (%d) not supported yet.",
631 option_type_name(option_type(poption)),
632 option_type(poption));
633 break;
634 }
635
636 if (NULL == widget) {
637 /* Not implemented. */
638 widget = create_iconlabel_from_chars_fonto(NULL, window->dst, "",
639 FONTO_ATTENTION, flags);
640 } else {
641 widget->info_label = create_utf8_from_char_fonto(help_text,
642 FONTO_ATTENTION);
643 widget->action = none_callback;
644 if (option_is_changeable(poption)) {
645 set_wstate(widget, FC_WS_NORMAL);
646 }
647 }
648
649 add_to_gui_list(MAX_ID - option_number(poption), widget);
650 option_set_gui_data(poption, widget);
651
652 free(help_text);
653
654 return widget;
655}
656
657/************************************************************************/
660 static void option_widget_update(struct option *poption)
661{
662 struct widget *widget;
663
664 fc_assert_ret(NULL != poption);
665 widget = (struct widget *) option_get_gui_data(poption);
666 fc_assert_ret(NULL != widget);
667
668 set_wstate(widget,
669 option_is_changeable(poption)
670 ? FC_WS_NORMAL : FC_WS_DISABLED);
671
672 switch (option_type(poption)) {
673 case OT_BOOLEAN:
674 if (option_bool_get(poption) != get_checkbox_state(widget)) {
675 toggle_checkbox(widget);
676 }
677 break;
678
679 case OT_INTEGER:
680 {
681 char buf[64];
682
683 fc_snprintf(buf, sizeof(buf), "%d", option_int_get(poption));
684 copy_chars_to_utf8_str(widget->string_utf8, buf);
685 }
686 break;
687
688 case OT_STRING:
689 copy_chars_to_utf8_str(widget->string_utf8, option_str_get(poption));
690 break;
691
692 case OT_ENUM:
693 copy_chars_to_utf8_str(widget->string_utf8,
694 _(option_enum_get_str(poption)));
695 break;
696
697 case OT_VIDEO_MODE:
698 {
699 char buf[64];
700 struct video_mode vmod;
701
702 vmod = option_video_mode_get(poption);
703 if (video_mode_to_string(buf, sizeof(buf), &vmod)) {
704 copy_chars_to_utf8_str(widget->string_utf8, buf);
705 } else {
706 /* Always fails. */
707 fc_assert(video_mode_to_string(buf, sizeof(buf), &vmod));
708 }
709 }
710 break;
711
712 case OT_FONT:
713 copy_chars_to_utf8_str(widget->string_utf8, option_font_get(poption));
714 break;
715
716 case OT_BITWISE:
717 case OT_COLOR:
718 log_error("Option type %s (%d) not supported yet.",
719 option_type_name(option_type(poption)),
720 option_type(poption));
721 break;
722 }
723
724 widget_redraw(widget);
725 widget_mark_dirty(widget);
726}
727
728/************************************************************************/
731 static void option_widget_apply(struct option *poption)
732{
733 struct widget *widget;
734
735 fc_assert_ret(NULL != poption);
736 widget = (struct widget *) option_get_gui_data(poption);
737 fc_assert_ret(NULL != widget);
738
739 switch (option_type(poption)) {
740 case OT_BOOLEAN:
741 (void) option_bool_set(poption, get_checkbox_state(widget));
742 break;
743
744 case OT_INTEGER:
745 {
746 int value;
747
748 if (str_to_int(widget->string_utf8->text, &value)) {
749 (void) option_int_set(poption, value);
750 }
751 }
752 break;
753
754 case OT_STRING:
755 (void) option_str_set(poption, widget->string_utf8->text);
756 break;
757
758 case OT_ENUM:
759 {
760 int i;
761
762 /* 'str' is translated, so we cannot use directly
763 * option_enum_set_str(). */
764 for (i = 0; i < strvec_size(widget->data.vector); i++) {
765 if (!strcmp(strvec_get(widget->data.vector, i), widget->string_utf8->text)) {
766 (void) option_enum_set_int(poption, i);
767 break;
768 }
769 }
770 }
771 break;
772
773 case OT_VIDEO_MODE:
774 {
775 struct video_mode mode;
776
777 if (string_to_video_mode(widget->string_utf8->text, &mode)) {
778 option_video_mode_set(poption, mode);
779 } else {
780 /* Always fails. */
781 fc_assert(string_to_video_mode(widget->string_utf8->text, &mode));
782 }
783 }
784 break;
785
786 case OT_FONT:
787 (void) option_font_set(poption, widget->string_utf8->text);
788 break;
789
790 case OT_BITWISE:
791 case OT_COLOR:
792 log_error("Option type %s (%d) not supported yet.",
793 option_type_name(option_type(poption)),
794 option_type(poption));
795 break;
796 }
797}
798
799/************************************************************************/
802 static struct option_dialog *option_dialog_new(void)
803{
804 struct option_dialog *pdialog = fc_calloc(1, sizeof(*pdialog));
805 struct widget *window, *close_button, *widget;
806 utf8_str *str;
807
808 pdialog->mode = ODM_MAIN;
809
810 /* Create window widget. */
811 str = create_utf8_from_char_fonto(_("Options"), FONTO_ATTENTION);
812 str->style |= TTF_STYLE_BOLD;
813
814 window = create_window_skeleton(NULL, str, 0);
815 window->action = main_optiondlg_callback;
816
817 set_wstate(window, FC_WS_NORMAL);
818 add_to_gui_list(ID_OPTIONS_WINDOW, window);
819 pdialog->end_widget_list = window;
820
821 /* Create close button widget. */
822 close_button = create_themeicon(current_theme->small_cancel_icon,
823 window->dst,
824 WF_WIDGET_HAS_INFO_LABEL
825 | WF_RESTORE_BACKGROUND);
826 close_button->info_label
827 = create_utf8_from_char_fonto(_("Close Dialog (Esc)"), FONTO_ATTENTION);
828 close_button->action = back_callback;
829 set_wstate(close_button, FC_WS_NORMAL);
830 close_button->key = SDLK_ESCAPE;
831 add_to_gui_list(ID_OPTIONS_BACK_BUTTON, close_button);
832 pdialog->core_widget_list = close_button;
833
834 /* Create client options button widget. */
835 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
836 _("Local options"),
837 FONTO_ATTENTION, 0);
838 widget->action = client_options_callback;
839 set_wstate(widget, FC_WS_NORMAL);
840 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
841 add_to_gui_list(ID_OPTIONS_CLIENT_BUTTON, widget);
842
843 /* Create server options button widget. */
844 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
845 _("Server options"),
846 FONTO_ATTENTION, 0);
847 widget->action = server_options_callback;
848 if (client.conn.established) {
849 set_wstate(widget, FC_WS_NORMAL);
850 }
851 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
852 add_to_gui_list(ID_OPTIONS_SERVER_BUTTON, widget);
853
854 /* Create global worklists button widget. */
855 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
856 _("Worklists"),
857 FONTO_ATTENTION, 0);
858 widget->action = work_lists_callback;
859 if (C_S_RUNNING == client_state()) {
860 set_wstate(widget, FC_WS_NORMAL);
861 }
862 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
863 add_to_gui_list(ID_OPTIONS_WORKLIST_BUTTON, widget);
864
865 /* Create save game button widget. */
866 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
867 _("Save Local Options"),
868 FONTO_ATTENTION, 0);
869 widget->action = save_client_options_callback;
870 set_wstate(widget, FC_WS_NORMAL);
871 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
872 add_to_gui_list(ID_OPTIONS_SAVE_BUTTON, widget);
873
874 /* Create save game button widget. */
875 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
876 _("Save Game"),
877 FONTO_ATTENTION, 0);
878 widget->action = save_game_callback;
879 if (C_S_RUNNING == client_state()) {
880 set_wstate(widget, FC_WS_NORMAL);
881 }
882 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
883 add_to_gui_list(ID_OPTIONS_SAVE_GAME_BUTTON, widget);
884
885 /* Create help browser button widget. */
886 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
887 _("Help Browser"),
888 FONTO_ATTENTION, 0);
889 widget->action = help_browser_callback;
890 widget->key = SDLK_h;
891 if (client.conn.established) {
892 set_wstate(widget, FC_WS_NORMAL);
893 }
894 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
895 add_to_gui_list(ID_OPTIONS_HELP_BROWSER_BUTTON, widget);
896
897 /* Create leave game button widget. */
898 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
899 _("Leave Game"),
900 FONTO_ATTENTION, 0);
901 widget->action = disconnect_callback;
902 widget->key = SDLK_q;
903 if (client.conn.established) {
904 set_wstate(widget, FC_WS_NORMAL);
905 }
906 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
907 add_to_gui_list(ID_OPTIONS_DISC_BUTTON, widget);
908
909 /* Create quit widget button. */
910 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
911 _("Quit"),
912 FONTO_ATTENTION, 0);
913 widget->action = exit_callback;
914 widget->key = SDLK_q;
915 set_wstate(widget, FC_WS_NORMAL);
916 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
917 add_to_gui_list(ID_OPTIONS_EXIT_BUTTON, widget);
918
919 pdialog->begin_widget_list = widget;
920 pdialog->main_widget_list = widget;
921
922 arrange_widgets(window, 1, -1, widget, pdialog->core_widget_list,
923 pdialog->core_widget_list, NULL);
924
925 return pdialog;
926}
927
928/************************************************************************/
931 static void option_dialog_destroy(struct option_dialog *pdialog)
932{
933 fc_assert_ret(NULL != pdialog);
934
935 if (ODM_OPTSET == pdialog->mode && -1 != pdialog->optset.category) {
936 options_iterate(pdialog->optset.poptset, poption) {
937 if (pdialog->optset.category == option_category(poption)) {
938 option_set_gui_data(poption, NULL);
939 }
940 } options_iterate_end;
941 }
942
943 if (NULL != pdialog->advanced) {
944 free(pdialog->advanced->scroll);
945 free(pdialog->advanced);
946 }
947
948 popdown_window_group_dialog(pdialog->begin_widget_list,
949 pdialog->end_widget_list);
950
951 free(pdialog);
952}
953
954/************************************************************************/
957 static int optset_category_option_count(const struct option_set *poptset,
958 int category)
959{
960 int count = 0;
961
962 options_iterate(poptset, poption) {
963 if (category == option_category(poption)) {
964 count++;
965 }
966 } options_iterate_end;
967
968 return count;
969}
970
971/************************************************************************/
974 static void option_dialog_optset(struct option_dialog *pdialog,
975 const struct option_set *poptset)
976{
977 struct option_dialog_optset *poptset_dialog;
978 struct widget *window;
979 struct widget *widget = NULL;
980 int i, category_num;
981
982 fc_assert_ret(NULL != pdialog);
983 fc_assert_ret(NULL != poptset);
984 category_num = optset_category_number(poptset);
985 fc_assert_ret(0 < category_num);
986
987 poptset_dialog = &pdialog->optset;
988 pdialog->mode = ODM_OPTSET;
989 poptset_dialog->poptset = poptset;
990 poptset_dialog->category = -1;
991
992 window = pdialog->end_widget_list;
993
994 /* Hide ODM_MAIN widget group. */
995 hide_group(pdialog->main_widget_list, pdialog->core_widget_list->prev);
996
997 /* Otherwise we don't enter next loop at all, and widget will remain NULL */
998 fc_assert(category_num > 0);
999
1000 /* Make the category buttons. */
1001 for (i = 0; i < category_num; i++) {
1002 if (0 == optset_category_option_count(poptset, i)) {
1003 continue;
1004 }
1005
1006 widget = create_icon_button_from_chars_fonto(NULL, window->dst,
1007 optset_category_name(poptset, i),
1008 FONTO_ATTENTION, 0);
1009 widget->action = option_category_callback;
1010 set_wstate(widget, FC_WS_NORMAL);
1011 widget_resize(widget, widget->size.w, widget->size.h + adj_size(4));
1012 add_to_gui_list(MAX_ID - i, widget);
1013 }
1014
1015 poptset_dialog->widget_list = widget;
1016 pdialog->begin_widget_list = widget;
1017
1018 arrange_widgets(window, 1, -1, widget, pdialog->main_widget_list,
1019 pdialog->core_widget_list, NULL);
1020}
1021
1022/************************************************************************/
1025 static void option_dialog_optset_category(struct option_dialog *pdialog,
1026 int category)
1027{
1028 struct option_dialog_optset *poptset_dialog;
1029 const struct option_set *poptset;
1030 struct widget *window, *widget = NULL, *apply_button;
1031 const int MAX_SHOWN = 10;
1032 SDL_Rect area;
1033 int i;
1034
1035 fc_assert_ret(NULL != pdialog);
1036 fc_assert_ret(ODM_OPTSET == pdialog->mode);
1037 fc_assert_ret(NULL == pdialog->advanced);
1038 poptset_dialog = &pdialog->optset;
1039 poptset = poptset_dialog->poptset;
1040 fc_assert_ret(0 < optset_category_option_count(poptset, category));
1041
1042 /* Hide ODM_OPTSET widget group. */
1043 hide_group(poptset_dialog->widget_list, pdialog->main_widget_list->prev);
1044
1045 poptset_dialog->category = category;
1046 window = pdialog->end_widget_list;
1047
1048 /* Create the apply button. */
1049 apply_button = create_themeicon(current_theme->small_ok_icon, window->dst,
1050 WF_WIDGET_HAS_INFO_LABEL
1051 | WF_RESTORE_BACKGROUND);
1052 apply_button->info_label = create_utf8_from_char_fonto(_("Apply changes"),
1053 FONTO_ATTENTION);
1054 apply_button->action = apply_callback;
1055 set_wstate(apply_button, FC_WS_NORMAL);
1056 add_to_gui_list(ID_OPTIONS_APPLY_BUTTON, apply_button);
1057
1058 /* Create the option widgets. */
1059 i = 0;
1060 options_iterate(poptset, poption) {
1061 if (category != option_category(poption)) {
1062 continue;
1063 }
1064
1065 widget = option_widget_new(poption, window, i >= MAX_SHOWN);
1066 i++;
1067 } options_iterate_end;
1068
1069 /* Scrollbar. */
1070 pdialog->advanced = fc_calloc(1, sizeof(*pdialog->advanced));
1071 pdialog->advanced->end_widget_list = pdialog->end_widget_list;
1072 pdialog->advanced->end_active_widget_list = apply_button->prev;
1073 pdialog->advanced->begin_widget_list = widget;
1074 pdialog->advanced->begin_active_widget_list = widget;
1075
1076 create_vertical_scrollbar(pdialog->advanced, 2, MAX_SHOWN, TRUE, TRUE);
1077
1078 if (i >= MAX_SHOWN) {
1079 pdialog->advanced->active_widget_list =
1080 pdialog->advanced->end_active_widget_list;
1081 } else {
1082 hide_scrollbar(pdialog->advanced->scroll);
1083 }
1084
1085 pdialog->begin_widget_list = pdialog->advanced->begin_widget_list;
1086
1087 arrange_widgets(window, 2, MAX_SHOWN,
1088 pdialog->advanced->begin_active_widget_list,
1089 apply_button, pdialog->core_widget_list,
1090 apply_button, NULL);
1091
1092 area = window->area;
1093 setup_vertical_scrollbar_area(pdialog->advanced->scroll,
1094 area.x + area.w - 1, area.y + 1,
1095 area.h - adj_size(32), TRUE);
1096
1097 redraw_group(pdialog->begin_widget_list,
1098 pdialog->advanced->active_widget_list, 0);
1099 widget_flush(window);
1100}
1101
1102
1103/************************************************************************/
1106 static int edit_worklist_callback(struct widget *widget)
1107{
1108 struct global_worklist *pgwl = global_worklist_by_id(MAX_ID - widget->id);
1109
1110 if (NULL == option_dialog
1111 || ODM_WORKLIST != option_dialog->mode
1112 || NULL == pgwl) {
1113 return -1;
1114 }
1115
1116 if (main_data.event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) {
1117 switch (main_data.event.button.button) {
1118 case SDL_BUTTON_LEFT:
1119 /* Edit. */
1120 option_dialog->worklist.edited_name = widget;
1121 popup_worklist_editor(NULL, pgwl);
1122 break;
1123
1124 case SDL_BUTTON_RIGHT:
1125 {
1126 /* Delete. */
1127 struct advanced_dialog *advanced = option_dialog->advanced;
1128 bool scroll = (NULL != advanced->active_widget_list);
1129
1130 global_worklist_destroy(pgwl);
1131 del_widget_from_vertical_scroll_widget_list(advanced, widget);
1132
1133 /* Find if there was scrollbar hide. */
1134 if (scroll && advanced->active_widget_list == NULL) {
1135 int len = advanced->scroll->up_left_button->size.w;
1136
1137 widget = advanced->end_active_widget_list->next;
1138 do {
1139 widget = widget->prev;
1140 widget->size.w += len;
1141 FREESURFACE(widget->gfx);
1142 } while (widget != advanced->begin_active_widget_list);
1143 }
1144
1145 redraw_group(option_dialog->begin_widget_list,
1146 option_dialog->end_widget_list, 0);
1147 widget_mark_dirty(option_dialog->end_widget_list);
1148 flush_dirty();
1149 }
1150 break;
1151 }
1152 } else if (PRESSED_EVENT(main_data.event)) {
1153 /* Edit. */
1154 option_dialog->worklist.edited_name = widget;
1155 popup_worklist_editor(NULL, pgwl);
1156 }
1157
1158 return -1;
1159}
1160
1161/************************************************************************/
1164 static int add_new_worklist_callback(struct widget *widget)
1165{
1166 if (PRESSED_EVENT(main_data.event)) {
1167 struct widget *new_worklist_widget = NULL;
1168 struct widget *window = option_dialog->end_widget_list;
1169 struct global_worklist *pgwl = global_worklist_new(_("empty worklist"));
1170 struct advanced_dialog *advanced = option_dialog->advanced;
1171 bool scroll = advanced->active_widget_list == NULL;
1172 bool redraw_all = FALSE;
1173
1174 set_wstate(widget, FC_WS_NORMAL);
1175 selected_widget = NULL;
1176
1177 /* Create list element. */
1178 new_worklist_widget
1179 = create_iconlabel_from_chars_fonto(NULL, widget->dst,
1180 global_worklist_name(pgwl),
1181 FONTO_ATTENTION,
1182 WF_RESTORE_BACKGROUND);
1183 new_worklist_widget->id = MAX_ID - global_worklist_id(pgwl);
1184 new_worklist_widget->string_utf8->style |= SF_CENTER;
1185 set_wstate(new_worklist_widget, FC_WS_NORMAL);
1186 new_worklist_widget->size.w = widget->size.w;
1187 new_worklist_widget->action = edit_worklist_callback;
1188
1189 /* Add to widget list. */
1190 redraw_all = add_widget_to_vertical_scroll_widget_list(advanced,
1191 new_worklist_widget, widget, TRUE,
1192 window->area.x + adj_size(17),
1193 window->area.y + adj_size(17));
1194
1195 /* Find if there was scrollbar shown. */
1196 if (scroll && advanced->active_widget_list != NULL) {
1197 int len = advanced->scroll->up_left_button->size.w;
1198
1199 window = advanced->end_active_widget_list->next;
1200 do {
1201 window = window->prev;
1202 window->size.w -= len;
1203 window->area.w -= len;
1204 FREESURFACE(window->gfx);
1205 } while (window != advanced->begin_active_widget_list);
1206 }
1207
1208 if (redraw_all) {
1209 redraw_group(option_dialog->begin_widget_list,
1210 option_dialog->end_widget_list, 0);
1211 widget_mark_dirty(option_dialog->end_widget_list);
1212 } else {
1213 /* Redraw only new widget and dock widget. */
1214 if (!widget->gfx && (get_wflags(widget) & WF_RESTORE_BACKGROUND)) {
1215 refresh_widget_background(widget);
1216 }
1217 widget_redraw(widget);
1218 widget_mark_dirty(widget);
1219
1220 if (!new_worklist_widget->gfx
1221 && (get_wflags(new_worklist_widget) & WF_RESTORE_BACKGROUND)) {
1222 refresh_widget_background(new_worklist_widget);
1223 }
1224 widget_redraw(new_worklist_widget);
1225 widget_mark_dirty(new_worklist_widget);
1226 }
1227 flush_dirty();
1228 }
1229
1230 return -1;
1231}
1232
1233/************************************************************************/
1237 static void option_dialog_worklist(struct option_dialog *pdialog)
1238{
1239 SDL_Color bg_color = {255, 255, 255, 128};
1240 struct widget *widget, *window, *background;
1241 int count = 0, scrollbar_width = 0, longest = 0;
1242 SDL_Rect area;
1243
1244 pdialog->mode = ODM_WORKLIST;
1245 pdialog->worklist.edited_name = NULL;
1246 window = pdialog->end_widget_list;
1247
1248 /* Hide main widget group. */
1249 hide_group(pdialog->main_widget_list, pdialog->core_widget_list->prev);
1250
1251 /* Create white background. */
1252 background = create_iconlabel(NULL, window->dst, NULL, WF_FREE_THEME);
1253 add_to_gui_list(ID_LABEL, background);
1254
1255 /* Build the global worklists list. */
1256 global_worklists_iterate(pgwl) {
1257 widget = create_iconlabel_from_chars_fonto(NULL, window->dst,
1258 global_worklist_name(pgwl),
1259 FONTO_ATTENTION,
1260 WF_RESTORE_BACKGROUND);
1261 set_wstate(widget, FC_WS_NORMAL);
1262 add_to_gui_list(MAX_ID - global_worklist_id(pgwl), widget);
1263 widget->action = edit_worklist_callback;
1264 widget->string_utf8->style |= SF_CENTER;
1265 longest = MAX(longest, widget->size.w);
1266 count++;
1267
1268 if (count > 13) {
1269 set_wflag(widget, WF_HIDDEN);
1270 }
1271 } global_worklists_iterate_end;
1272
1273 /* Create the adding item. */
1274 widget = create_iconlabel_from_chars_fonto(NULL, window->dst,
1275 _("Add new worklist"),
1276 FONTO_ATTENTION,
1277 WF_RESTORE_BACKGROUND);
1278 set_wstate(widget, FC_WS_NORMAL);
1279 add_to_gui_list(ID_ADD_NEW_WORKLIST, widget);
1280 widget->action = add_new_worklist_callback;
1281 widget->string_utf8->style |= SF_CENTER;
1282 longest = MAX(longest, widget->size.w);
1283 count++;
1284
1285 if (count > 13) {
1286 set_wflag(widget, WF_HIDDEN);
1287 }
1288
1289 /* Advanced dialog. */
1290 pdialog->advanced = fc_calloc(1, sizeof(*pdialog->advanced));
1291 pdialog->advanced->end_widget_list = pdialog->end_widget_list;
1292 pdialog->advanced->end_active_widget_list =
1293 pdialog->main_widget_list->prev->prev;
1294 pdialog->advanced->begin_widget_list = widget;
1295 pdialog->advanced->begin_active_widget_list = widget;
1296
1297 /* Clear former area. */
1298 area = window->area;
1299 area.w += window->size.x;
1300 area.h += window->size.y;
1301 dirty_sdl_rect(&area);
1302
1303 /* Resize window. */
1304 resize_window(window, NULL, NULL,
1305 adj_size(longest + 40), window->size.h);
1306 area = window->area;
1307
1308 /* Move close button. */
1309 widget = pdialog->core_widget_list;
1310 widget_set_position(widget, area.x + area.w - widget->size.w - 1,
1311 window->size.y + adj_size(2));
1312
1313 /* Resize white background. */
1314 area.x += adj_size(12);
1315 area.y += adj_size(12);
1316 area.w -= adj_size(12) + adj_size(12);
1317 area.h -= adj_size(12) + adj_size(12);
1318 background->theme = create_surf(area.w, area.h, SDL_SWSURFACE);
1319 widget_set_area(background, area);
1320 widget_set_position(background, area.x, area.y);
1321 SDL_FillSurfaceRect(background->theme, NULL,
1322 map_rgba(background->theme->format, bg_color));
1323
1324 create_frame(background->theme,
1325 0, 0, background->theme->w - 1, background->theme->h - 1,
1326 get_theme_color(COLOR_THEME_OPTIONDLG_WORKLISTLIST_FRAME));
1327
1328 /* Create the Scrollbar. */
1329 scrollbar_width = create_vertical_scrollbar(pdialog->advanced,
1330 1, 13, TRUE, TRUE);
1331 setup_vertical_scrollbar_area(pdialog->advanced->scroll,
1332 area.x + area.w - 1, area.y + 1,
1333 area.h - adj_size(32), TRUE);
1334
1335 if (count > 13) {
1336 pdialog->advanced->active_widget_list =
1337 pdialog->advanced->end_active_widget_list;
1338 } else {
1339 hide_scrollbar(pdialog->advanced->scroll);
1340 scrollbar_width = 0;
1341 }
1342
1343 /* Draw! */
1344 setup_vertical_widgets_position(1, area.x + adj_size(5),
1345 area.y + adj_size(5),
1346 area.w - adj_size(10) - scrollbar_width, 0,
1347 pdialog->advanced->begin_active_widget_list,
1348 pdialog->advanced->end_active_widget_list);
1349
1350 pdialog->begin_widget_list = pdialog->advanced->begin_widget_list;
1351
1352 redraw_group(pdialog->begin_widget_list, pdialog->end_widget_list, 0);
1353 widget_flush(window);
1354}
1355
1356/************************************************************************/
1359 int optiondlg_callback(struct widget *pbutton)
1360{
1361 if (PRESSED_EVENT(main_data.event)) {
1362 set_wstate(pbutton, FC_WS_DISABLED);
1363 clear_surface(pbutton->dst->surface, &pbutton->size);
1364 widget_redraw(pbutton);
1365 widget_flush(pbutton);
1366
1367 popup_optiondlg();
1368 }
1369
1370 return -1;
1371}
1372
1373/* ======================================================================= */
1374/* =================================== Public ============================ */
1375/* ======================================================================= */
1376
1377/************************************************************************/
1380 void enable_options_button(void)
1381{
1382 set_wstate(options_button, FC_WS_NORMAL);
1383}
1384
1385/************************************************************************/
1388 void disable_options_button(void)
1389{
1390 set_wstate(options_button, FC_WS_DISABLED);
1391}
1392
1393/************************************************************************/
1396 void init_options_button(void)
1397{
1398 char buf[256];
1399
1400 options_button = create_themeicon(current_theme->options_icon, main_data.gui,
1401 WF_WIDGET_HAS_INFO_LABEL
1402 | WF_RESTORE_BACKGROUND);
1403 options_button->action = optiondlg_callback;
1404 fc_snprintf(buf, sizeof(buf), "%s (%s)", _("Options"), "Esc");
1405 options_button->info_label
1406 = create_utf8_from_char_fonto(buf, FONTO_ATTENTION);
1407 options_button->key = SDLK_ESCAPE;
1408 set_wflag(options_button, WF_HIDDEN);
1409 widget_set_position(options_button, adj_size(5), adj_size(5));
1410
1411#ifndef GUI_SDL3_SMALL_SCREEN
1412 add_to_gui_list(ID_CLIENT_OPTIONS, options_button);
1413#endif
1414
1415 enable_options_button();
1416}
1417
1418/************************************************************************/
1423 void update_worklist_report_dialog(void)
1424{
1425 struct global_worklist *pgwl;
1426
1427 if (NULL != option_dialog && ODM_WORKLIST == option_dialog->mode) {
1428 pgwl = global_worklist_by_id(MAX_ID
1429 - option_dialog->worklist.edited_name->id);
1430
1431 if (NULL != pgwl) {
1432 copy_chars_to_utf8_str(option_dialog->worklist.edited_name->string_utf8,
1433 global_worklist_name(pgwl));
1434 option_dialog->worklist.edited_name = NULL;
1435 }
1436
1437 redraw_group(option_dialog->begin_widget_list,
1438 option_dialog->end_widget_list, 0);
1439 widget_mark_dirty(option_dialog->end_widget_list);
1440 }
1441}
1442
1443/************************************************************************/
1446 void popup_optiondlg(void)
1447{
1448 if (NULL != option_dialog) {
1449 return;
1450 }
1451
1452 restore_meswin_dialog = meswin_dialog_is_open();
1453 popdown_all_game_dialogs();
1454 flush_dirty();
1455
1456 option_dialog = option_dialog_new();
1457
1458 disable_main_widgets();
1459 flush_dirty();
1460}
1461
1462/************************************************************************/
1465 void popdown_optiondlg(bool leave_game)
1466{
1467 if (NULL == option_dialog) {
1468 return;
1469 }
1470
1471 option_dialog_destroy(option_dialog);
1472 option_dialog = NULL;
1473
1474 if (!leave_game) {
1475 enable_main_widgets();
1476 }
1477
1478 if (restore_meswin_dialog) {
1479 meswin_dialog_popup(TRUE);
1480 }
1481}
1482
1483/************************************************************************/
1486 void option_dialog_popup(const char *name, const struct option_set *poptset)
1487{
1488 if (NULL == option_dialog) {
1489 popup_optiondlg();
1490 } else if (ODM_OPTSET == option_dialog->mode
1491 && poptset == option_dialog->optset.poptset) {
1492 /* Already in use. */
1493 return;
1494 } else {
1495 while (ODM_MAIN != option_dialog->mode) {
1496 back_callback(NULL);
1497 }
1498 }
1499
1500 option_dialog_optset(option_dialog, poptset);
1501}
1502
1503/************************************************************************/
1506 void option_dialog_popdown(const struct option_set *poptset)
1507{
1508 while (NULL != option_dialog
1509 && ODM_OPTSET == option_dialog->mode
1510 && poptset == option_dialog->optset.poptset) {
1511 back_callback(NULL);
1512 }
1513}
1514
1515/************************************************************************/
1518 void option_gui_update(struct option *poption)
1519{
1520 if (NULL != option_dialog
1521 && ODM_OPTSET == option_dialog->mode
1522 && option_optset(poption) == option_dialog->optset.poptset
1523 && option_category(poption) == option_dialog->optset.category) {
1524 option_widget_update(poption);
1525 }
1526
1527 if (!strcmp(option_name(poption), "nationset")) {
1528 nationset_changed();
1529 }
1530}
1531
1532/************************************************************************/
1535 void option_gui_add(struct option *poption)
1536{
1537 if (NULL != option_dialog
1538 && ODM_OPTSET == option_dialog->mode
1539 && option_optset(poption) == option_dialog->optset.poptset
1540 && option_category(poption) == option_dialog->optset.category) {
1541 back_callback(NULL);
1542 option_dialog_optset_category(option_dialog, option_category(poption));
1543 }
1544}
1545
1546/************************************************************************/
1549 void option_gui_remove(struct option *poption)
1550{
1551 if (NULL != option_dialog
1552 && ODM_OPTSET == option_dialog->mode
1553 && option_optset(poption) == option_dialog->optset.poptset
1554 && option_category(poption) == option_dialog->optset.category) {
1555 back_callback(NULL);
1556 option_dialog_optset_category(option_dialog, option_category(poption));
1557 }
1558}
str
#define str
Definition astring.c:76
client
struct civclient client
Definition client_main.c:153
client_state
enum client_states client_state(void)
Definition client_main.c:1034
client_main.h
C_S_RUNNING
@ C_S_RUNNING
Definition client_main.h:47
climisc.h
disconnect_from_server
void disconnect_from_server(bool leaving_sound)
Definition clinet.c:306
clinet.h
incite_cost
char * incite_cost
Definition comments.c:74
send_save_game
void send_save_game(const char *filename)
Definition connectdlg_common.c:751
connectdlg_common.h
current_theme
QString current_theme
Definition fc_client.cpp:64
fc_types.h
fcintl.h
_
#define _(String)
Definition fcintl.h:67
game.h
global_worklist_by_id
struct global_worklist * global_worklist_by_id(int id)
Definition global_worklist.c:298
global_worklist_name
const char * global_worklist_name(const struct global_worklist *pgwl)
Definition global_worklist.c:323
global_worklist_id
int global_worklist_id(const struct global_worklist *pgwl)
Definition global_worklist.c:288
global_worklist_destroy
void global_worklist_destroy(struct global_worklist *pgwl)
Definition global_worklist.c:214
global_worklist_new
struct global_worklist * global_worklist_new(const char *name)
Definition global_worklist.c:244
global_worklist.h
global_worklists_iterate
#define global_worklists_iterate(pgwl)
Definition global_worklist.h:65
global_worklists_iterate_end
#define global_worklists_iterate_end
Definition global_worklist.h:68
popdown_all_game_dialogs
void popdown_all_game_dialogs(void)
Definition dialogs.c:1514
help_text
static GtkTextBuffer * help_text
Definition helpdlg.c:70
flush_dirty
void flush_dirty(void)
Definition mapview.c:468
meswin_dialog_popup
void meswin_dialog_popup(bool raise)
Definition messagewin.c:417
meswin_dialog_is_open
bool meswin_dialog_is_open(void)
Definition messagewin.c:443
option_gui_remove
void option_gui_remove(struct option *poption)
Definition optiondlg.c:1041
option_dialog_popdown
void option_dialog_popdown(const struct option_set *poptset)
Definition optiondlg.c:986
option_dialog_destroy
static void option_dialog_destroy(struct option_dialog *pdialog)
Definition optiondlg.c:405
option_gui_add
void option_gui_add(struct option *poption)
Definition optiondlg.c:1027
option_gui_update
void option_gui_update(struct option *poption)
Definition optiondlg.c:1013
option_dialog_popup
void option_dialog_popup(const char *name, const struct option_set *poptset)
Definition optiondlg.c:972
get_theme_color
SDL_Color * get_theme_color(enum theme_color themecolor)
Definition colors.c:47
nationset_changed
void nationset_changed(void)
Definition dialogs.c:3565
main_window_width
int main_window_width(void)
Definition graphics.c:685
main_data
struct sdl2_data main_data
Definition graphics.c:57
create_surf
SDL_Surface * create_surf(int width, int height, Uint32 flags)
Definition graphics.c:351
clear_surface
int clear_surface(SDL_Surface *surf, SDL_Rect *dstrect)
Definition graphics.c:400
create_frame
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top, Sint16 width, Sint16 height, SDL_Color *pcolor)
Definition graphics.c:1350
main_window_height
int main_window_height(void)
Definition graphics.c:693
FREESURFACE
#define FREESURFACE(ptr)
Definition graphics.h:322
map_rgba
#define map_rgba(format, color)
Definition graphics.h:315
ID_OPTIONS_DISC_BUTTON
@ ID_OPTIONS_DISC_BUTTON
Definition gui_id.h:78
ID_OPTIONS_SAVE_BUTTON
@ ID_OPTIONS_SAVE_BUTTON
Definition gui_id.h:75
ID_OPTIONS_APPLY_BUTTON
@ ID_OPTIONS_APPLY_BUTTON
Definition gui_id.h:80
ID_CLIENT_OPTIONS
@ ID_CLIENT_OPTIONS
Definition gui_id.h:38
ID_OPTIONS_CLIENT_BUTTON
@ ID_OPTIONS_CLIENT_BUTTON
Definition gui_id.h:72
ID_OPTIONS_WORKLIST_BUTTON
@ ID_OPTIONS_WORKLIST_BUTTON
Definition gui_id.h:74
ID_ADD_NEW_WORKLIST
@ ID_ADD_NEW_WORKLIST
Definition gui_id.h:214
ID_OPTIONS_SAVE_GAME_BUTTON
@ ID_OPTIONS_SAVE_GAME_BUTTON
Definition gui_id.h:76
ID_OPTIONS_HELP_BROWSER_BUTTON
@ ID_OPTIONS_HELP_BROWSER_BUTTON
Definition gui_id.h:77
ID_OPTIONS_BACK_BUTTON
@ ID_OPTIONS_BACK_BUTTON
Definition gui_id.h:79
ID_OPTIONS_WINDOW
@ ID_OPTIONS_WINDOW
Definition gui_id.h:71
ID_LABEL
@ ID_LABEL
Definition gui_id.h:27
ID_OPTIONS_SERVER_BUTTON
@ ID_OPTIONS_SERVER_BUTTON
Definition gui_id.h:73
ID_OPTIONS_EXIT_BUTTON
@ ID_OPTIONS_EXIT_BUTTON
Definition gui_id.h:81
force_exit_from_event_loop
void force_exit_from_event_loop(void)
Definition gui_main.c:565
selected_widget
struct widget * selected_widget
Definition widget.c:48
adj_size
#define adj_size(size)
Definition gui_main.h:141
PRESSED_EVENT
#define PRESSED_EVENT(event)
Definition gui_main.h:71
copy_chars_to_utf8_str
utf8_str * copy_chars_to_utf8_str(utf8_str *pstr, const char *pchars)
Definition gui_string.c:251
SF_CENTER
#define SF_CENTER
Definition gui_string.h:40
FONTO_ATTENTION
@ FONTO_ATTENTION
Definition gui_string.h:67
create_utf8_from_char_fonto
#define create_utf8_from_char_fonto(string_in, fonto)
Definition gui_string.h:108
popup_help_browser
void popup_help_browser(void)
Definition helpdlg.c:77
enable_main_widgets
void enable_main_widgets(void)
Definition mapctrl.c:2180
disable_main_widgets
void disable_main_widgets(void)
Definition mapctrl.c:2102
dirty_sdl_rect
void dirty_sdl_rect(SDL_Rect *Rect)
Definition mapview.c:181
flush_all
void flush_all(void)
Definition mapview.c:201
options_button
struct widget * options_button
Definition optiondlg.c:103
disconnect_callback
static int disconnect_callback(struct widget *pwidget)
Definition optiondlg.c:388
update_worklist_report_dialog
void update_worklist_report_dialog(void)
Definition optiondlg.c:1409
save_game_callback
static int save_game_callback(struct widget *pwidget)
Definition optiondlg.c:363
optset_category_option_count
static int optset_category_option_count(const struct option_set *poptset, int category)
Definition optiondlg.c:943
work_lists_callback
static int work_lists_callback(struct widget *widget)
Definition optiondlg.c:339
option_widget_apply
static void option_widget_apply(struct option *poption)
Definition optiondlg.c:717
server_options_callback
static int server_options_callback(struct widget *pwidget)
Definition optiondlg.c:327
option_dialog_new
static struct option_dialog * option_dialog_new(void)
Definition optiondlg.c:788
restore_meswin_dialog
static bool restore_meswin_dialog
Definition optiondlg.c:104
enable_options_button
void enable_options_button(void)
Definition optiondlg.c:1366
popdown_optiondlg
void popdown_optiondlg(bool leave_game)
Definition optiondlg.c:1451
main_optiondlg_callback
static int main_optiondlg_callback(struct widget *pwindow)
Definition optiondlg.c:226
enum_widget_destroy
static void enum_widget_destroy(struct widget *widget)
Definition optiondlg.c:482
edit_worklist_callback
static int edit_worklist_callback(struct widget *widget)
Definition optiondlg.c:1092
exit_callback
static int exit_callback(struct widget *pwidget)
Definition optiondlg.c:402
client_options_callback
static int client_options_callback(struct widget *pwidget)
Definition optiondlg.c:315
video_mode_widget_destroy
static void video_mode_widget_destroy(struct widget *widget)
Definition optiondlg.c:490
init_options_button
void init_options_button(void)
Definition optiondlg.c:1382
save_client_options_callback
static int save_client_options_callback(struct widget *pwidget)
Definition optiondlg.c:351
disable_options_button
void disable_options_button(void)
Definition optiondlg.c:1374
add_new_worklist_callback
static int add_new_worklist_callback(struct widget *widget)
Definition optiondlg.c:1150
option_dialog_mode
option_dialog_mode
Definition optiondlg.c:72
ODM_MAIN
@ ODM_MAIN
Definition optiondlg.c:73
ODM_WORKLIST
@ ODM_WORKLIST
Definition optiondlg.c:75
ODM_OPTSET
@ ODM_OPTSET
Definition optiondlg.c:74
back_callback
static int back_callback(struct widget *pwidget)
Definition optiondlg.c:239
none_callback
static int none_callback(struct widget *widget)
Definition optiondlg.c:447
popup_optiondlg
void popup_optiondlg(void)
Definition optiondlg.c:1432
option_widget_new
static struct widget * option_widget_new(struct option *poption, struct widget *window, bool hide)
Definition optiondlg.c:499
help_browser_callback
static int help_browser_callback(struct widget *pwidget)
Definition optiondlg.c:376
apply_callback
static int apply_callback(struct widget *widget)
Definition optiondlg.c:428
arrange_widgets
static void arrange_widgets(struct widget *window, int widgets_per_row, int rows_shown, struct widget *begin, struct widget *end,...)
Definition optiondlg.c:127
option_dialog_optset_category
static void option_dialog_optset_category(struct option_dialog *pdialog, int category)
Definition optiondlg.c:1011
option_widget_update
static void option_widget_update(struct option *poption)
Definition optiondlg.c:646
optiondlg_callback
int optiondlg_callback(struct widget *pbutton)
Definition optiondlg.c:1345
option_category_callback
static int option_category_callback(struct widget *widget)
Definition optiondlg.c:416
video_mode_list
static struct strvec * video_mode_list(void)
Definition optiondlg.c:455
theme_get_background
SDL_Surface * theme_get_background(const struct theme *t, enum theme_background background)
Definition themebackgrounds.c:94
BACKGROUND_OPTIONDLG
@ BACKGROUND_OPTIONDLG
Definition themebackgrounds.h:43
COLOR_THEME_OPTIONDLG_WORKLISTLIST_FRAME
@ COLOR_THEME_OPTIONDLG_WORKLISTLIST_FRAME
Definition themecolors.h:105
active_theme
struct theme * active_theme
Definition themespec.c:154
add_to_gui_list
void add_to_gui_list(Uint16 id, struct widget *gui)
Definition widget.c:586
del_group_of_widgets_from_gui_list
void del_group_of_widgets_from_gui_list(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:863
refresh_widget_background
void refresh_widget_background(struct widget *pwidget)
Definition widget.c:1151
show_group
void show_group(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:934
hide_group
void hide_group(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:915
setup_vertical_widgets_position
int setup_vertical_widgets_position(int step, Sint16 start_x, Sint16 start_y, Uint16 w, Uint16 h, struct widget *begin, struct widget *end)
Definition widget.c:1051
redraw_group
Uint16 redraw_group(const struct widget *begin_group_widget_list, const struct widget *end_group_widget_list, int add_to_update)
Definition widget.c:720
popdown_window_group_dialog
void popdown_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:983
move_window_group
void move_window_group(struct widget *begin_widget_list, struct widget *pwindow)
Definition widget.c:1039
widget_set_position
static void widget_set_position(struct widget *pwidget, int x, int y)
Definition widget.h:266
MAX_ID
#define MAX_ID
Definition widget.h:38
FC_WS_DISABLED
@ FC_WS_DISABLED
Definition widget.h:99
FC_WS_NORMAL
@ FC_WS_NORMAL
Definition widget.h:96
add_widget_to_vertical_scroll_widget_list
bool add_widget_to_vertical_scroll_widget_list(struct advanced_dialog *dlg, struct widget *new_widget, struct widget *add_dock, bool dir, Sint16 start_x, Sint16 start_y) fc__attribute((nonnull(2)))
Definition widget_scrollbar.c:1146
del_widget_from_vertical_scroll_widget_list
bool del_widget_from_vertical_scroll_widget_list(struct advanced_dialog *dlg, struct widget *pwidget) fc__attribute((nonnull(2)))
Definition widget_scrollbar.c:1344
widget_mark_dirty
static void widget_mark_dirty(struct widget *pwidget)
Definition widget.h:286
widget_flush
static void widget_flush(struct widget *pwidget)
Definition widget.h:291
get_wflags
enum widget_flag get_wflags(const struct widget *pwidget)
Definition widget_core.c:86
set_wstate
void set_wstate(struct widget *pwidget, enum widget_state state)
Definition widget_core.c:36
WF_WIDGET_HAS_INFO_LABEL
@ WF_WIDGET_HAS_INFO_LABEL
Definition widget.h:88
WF_RESTORE_BACKGROUND
@ WF_RESTORE_BACKGROUND
Definition widget.h:85
WF_HIDDEN
@ WF_HIDDEN
Definition widget.h:68
WF_FREE_THEME
@ WF_FREE_THEME
Definition widget.h:72
widget_redraw
static int widget_redraw(struct widget *pwidget)
Definition widget.h:276
widget_resize
static void widget_resize(struct widget *pwidget, int w, int h)
Definition widget.h:271
widget_set_area
static void widget_set_area(struct widget *pwidget, SDL_Rect area)
Definition widget.h:261
hide
#define hide(id)
Definition widget.h:238
set_wflag
void set_wflag(struct widget *pwidget, enum widget_flag flag)
Definition widget_core.c:54
create_icon_button_from_chars_fonto
#define create_icon_button_from_chars_fonto(icon, pdest, char_string, fonto, flags)
Definition widget_button.h:23
toggle_checkbox
void toggle_checkbox(struct widget *cbox)
Definition widget_checkbox.c:225
get_checkbox_state
bool get_checkbox_state(struct widget *cbox)
Definition widget_checkbox.c:239
create_checkbox
struct widget * create_checkbox(struct gui_layer *pdest, bool state, Uint32 flags)
Definition widget_checkbox.c:115
combo_popdown
void combo_popdown(struct widget *combo)
Definition widget_combo.c:212
combo_new_from_chars_fonto
#define combo_new_from_chars_fonto(background, dest, fonto, char_string, vector, length, flags)
Definition widget_combo.h:28
create_edit_from_chars_fonto
#define create_edit_from_chars_fonto(background, pdest, char_string, fonto, length, flags)
Definition widget_edit.h:29
create_themeicon
struct widget * create_themeicon(SDL_Surface *icon_theme, struct gui_layer *pdest, Uint32 flags)
Definition widget_icon.c:212
remake_label_size
void remake_label_size(struct widget *label)
Definition widget_label.c:118
create_iconlabel
struct widget * create_iconlabel(SDL_Surface *icon, struct gui_layer *pdest, utf8_str *pstr, Uint32 flags)
Definition widget_label.c:215
create_iconlabel_from_chars_fonto
#define create_iconlabel_from_chars_fonto(picon, pdest, chars, fonto, flags)
Definition widget_label.h:20
setup_vertical_scrollbar_area
void setup_vertical_scrollbar_area(struct scroll_bar *scroll, Sint16 start_x, Sint16 start_y, Uint16 height, bool swap_start_x)
Definition widget_scrollbar.c:567
create_vertical_scrollbar
Uint32 create_vertical_scrollbar(struct advanced_dialog *dlg, Uint8 step, Uint8 active, bool create_scrollbar, bool create_buttons)
Definition widget_scrollbar.c:486
hide_scrollbar
#define hide_scrollbar(scrollbar)
Definition widget_scrollbar.h:36
resize_window
bool resize_window(struct widget *pwindow, SDL_Surface *bcgd, SDL_Color *pcolor, Uint16 new_w, Uint16 new_h)
Definition widget_window.c:255
create_window_skeleton
struct widget * create_window_skeleton(struct gui_layer *pdest, utf8_str *title, Uint32 flags)
Definition widget_window.c:180
popup_worklist_editor
void popup_worklist_editor(struct city *pcity, struct global_worklist *gwl)
Definition wldlg.c:1055
gui_id.h
gui_tilespec.h
themespec.h
widget.h
colors.h
connectdlg.h
dialogs.h
graphics.h
gui_main.h
helpdlg.h
mapctrl.h
mapview.h
menu.h
messagewin.h
optiondlg.h
wldlg.h
name
const char * name
Definition inputfile.c:127
log.h
fc_assert_ret
#define fc_assert_ret(condition)
Definition log.h:191
fc_assert
#define fc_assert(condition)
Definition log.h:176
fc_assert_ret_val
#define fc_assert_ret_val(condition, val)
Definition log.h:194
log_error
#define log_error(message,...)
Definition log.h:103
fc_calloc
#define fc_calloc(n, esz)
Definition mem.h:38
FC_FREE
#define FC_FREE(ptr)
Definition mem.h:41
fc_strdup
#define fc_strdup(str)
Definition mem.h:43
option_str_values
const struct strvec * option_str_values(const struct option *poption)
Definition options.c:950
server_optset
const struct option_set * server_optset
Definition options.c:4281
option_description
const char * option_description(const struct option *poption)
Definition options.c:673
option_help_text
const char * option_help_text(const struct option *poption)
Definition options.c:683
option_enum_get_str
const char * option_enum_get_str(const struct option *poption)
Definition options.c:1027
option_number
int option_number(const struct option *poption)
Definition options.c:653
option_category
int option_category(const struct option *poption)
Definition options.c:703
option_str_set
bool option_str_set(struct option *poption, const char *str)
Definition options.c:961
client_optset
const struct option_set * client_optset
Definition options.c:1315
option_name
const char * option_name(const struct option *poption)
Definition options.c:663
option_int_get
int option_int_get(const struct option *poption)
Definition options.c:869
option_bool_set
bool option_bool_set(struct option *poption, bool val)
Definition options.c:854
option_is_changeable
bool option_is_changeable(const struct option *poption)
Definition options.c:724
option_video_mode_set
bool option_video_mode_set(struct option *poption, struct video_mode mode)
Definition options.c:1288
option_set_gui_data
void option_set_gui_data(struct option *poption, void *data)
Definition options.c:802
option_str_get
const char * option_str_get(const struct option *poption)
Definition options.c:928
option_get_gui_data
void * option_get_gui_data(const struct option *poption)
Definition options.c:812
option_enum_values
const struct strvec * option_enum_values(const struct option *poption)
Definition options.c:1064
option_enum_set_int
bool option_enum_set_int(struct option *poption, int val)
Definition options.c:1075
option_bool_get
bool option_bool_get(const struct option *poption)
Definition options.c:832
optset_category_number
int optset_category_number(const struct option_set *poptset)
Definition options.c:492
option_type
enum option_type option_type(const struct option *poption)
Definition options.c:693
video_mode_to_string
bool video_mode_to_string(char *buf, size_t buf_len, struct video_mode *mode)
Definition options.c:6753
option_optset
const struct option_set * option_optset(const struct option *poption)
Definition options.c:643
option_video_mode_get
struct video_mode option_video_mode_get(const struct option *poption)
Definition options.c:1263
optset_category_name
const char * optset_category_name(const struct option_set *poptset, int category)
Definition options.c:502
option_font_set
bool option_font_set(struct option *poption, const char *font)
Definition options.c:1209
options_save
void options_save(option_save_log_callback log_cb)
Definition options.c:6341
string_to_video_mode
bool string_to_video_mode(const char *buf, struct video_mode *mode)
Definition options.c:6761
option_font_get
const char * option_font_get(const struct option *poption)
Definition options.c:1176
option_int_set
bool option_int_set(struct option *poption, int val)
Definition options.c:913
options_iterate
#define options_iterate(poptset, poption)
Definition options.h:588
options_iterate_end
#define options_iterate_end
Definition options.h:593
len
int len
Definition packhand.c:127
pages_g.h
str_to_int
bool str_to_int(const char *str, int *pint)
Definition shared.c:515
MIN
#define MIN(x, y)
Definition shared.h:55
MAX
#define MAX(x, y)
Definition shared.h:54
strvec_destroy
void strvec_destroy(struct strvec *psv)
Definition string_vector.c:72
strvec_set
bool strvec_set(struct strvec *psv, size_t svindex, const char *string)
Definition string_vector.c:306
strvec_append
void strvec_append(struct strvec *psv, const char *string)
Definition string_vector.c:279
strvec_reserve
void strvec_reserve(struct strvec *psv, size_t reserve)
Definition string_vector.c:81
strvec_get
const char * strvec_get(const struct strvec *psv, size_t svindex)
Definition string_vector.c:389
strvec_new
struct strvec * strvec_new(void)
Definition string_vector.c:59
strvec_size
size_t strvec_size(const struct strvec *psv)
Definition string_vector.c:344
string_vector.h
advanced_dialog
Definition widget.h:180
advanced_dialog::begin_active_widget_list
struct widget * begin_active_widget_list
Definition widget.h:184
advanced_dialog::end_widget_list
struct widget * end_widget_list
Definition widget.h:182
advanced_dialog::end_active_widget_list
struct widget * end_active_widget_list
Definition widget.h:185
advanced_dialog::active_widget_list
struct widget * active_widget_list
Definition widget.h:186
advanced_dialog::scroll
struct scroll_bar * scroll
Definition widget.h:187
advanced_dialog::begin_widget_list
struct widget * begin_widget_list
Definition widget.h:181
civclient::conn
struct connection conn
Definition client_main.h:96
connection::established
bool established
Definition connection.h:140
global_worklist
Definition global_worklist.c:49
option_dialog_optset
Definition optiondlg.c:78
option_dialog_optset::poptset
const struct option_set * poptset
Definition optiondlg.c:79
option_dialog_optset::category
int category
Definition optiondlg.c:81
option_dialog_optset::widget_list
struct widget * widget_list
Definition optiondlg.c:80
option_dialog_worklist
Definition optiondlg.c:84
option_dialog_worklist::edited_name
struct widget * edited_name
Definition optiondlg.c:85
option_dialog
Definition optiondlg.c:41
option_dialog::optset
struct option_dialog_optset optset
Definition optiondlg.c:96
option_dialog::mode
enum option_dialog_mode mode
Definition optiondlg.c:94
option_dialog::main_widget_list
struct widget * main_widget_list
Definition optiondlg.c:91
option_dialog::worklist
struct option_dialog_worklist worklist
Definition optiondlg.c:97
option_dialog::core_widget_list
struct widget * core_widget_list
Definition optiondlg.c:90
option_dialog::advanced
struct advanced_dialog * advanced
Definition optiondlg.c:93
option_dialog::begin_widget_list
struct widget * begin_widget_list
Definition optiondlg.c:92
option_dialog::poptset
const struct option_set * poptset
Definition optiondlg.c:42
option_dialog::end_widget_list
struct widget * end_widget_list
Definition optiondlg.c:89
option_set
Definition options.c:444
option
Definition options.c:514
scroll_bar::up_left_button
struct widget * up_left_button
Definition widget_scrollbar.h:21
sdl2_data::gui
struct gui_layer * gui
Definition graphics.h:215
sdl2_data::event
SDL_Event event
Definition graphics.h:217
strvec
Definition string_vector.c:29
utf8_str
Definition gui_string.h:52
utf8_str::style
Uint8 style
Definition gui_string.h:53
utf8_str::text
char * text
Definition gui_string.h:60
video_mode
Definition options.h:46
video_mode::width
int width
Definition options.h:47
widget
Definition widget.h:112
widget::key
SDL_Keycode key
Definition widget.h:153
widget::theme
SDL_Surface * theme
Definition widget.h:118
widget::widget
struct widget * widget
Definition widget.h:132
widget::prev
struct widget * prev
Definition widget.h:114
widget::dst
struct gui_layer * dst
Definition widget.h:116
widget::string_utf8
utf8_str * string_utf8
Definition widget.h:121
widget::vector
const struct strvec * vector
Definition widget.h:126
widget::action
int(* action)(struct widget *)
Definition widget.h:157
widget::area
SDL_Rect area
Definition widget.h:149
widget::gfx
SDL_Surface * gfx
Definition widget.h:120
widget::next
struct widget * next
Definition widget.h:113
widget::destroy
void(* destroy)(struct widget *pwidget)
Definition widget.h:170
widget::info_label
utf8_str * info_label
Definition widget.h:122
widget::id
Uint16 id
Definition widget.h:155
widget::size
SDL_Rect size
Definition widget.h:145
widget::data
union widget::@217 data
worklist
Definition worklist.h:28
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
fc_break_lines
int fc_break_lines(char *str, size_t desired_len)
Definition support.c:1135
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
set_client_page
void set_client_page(enum client_pages page)
Definition update_queue.c:496