Freeciv-3.2: /fast/freeciv/nightly/S3_2/client/gui-sdl2/optiondlg.c Source File

Freeciv-3.2

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