Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions | Variables
optiondlg.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
#include "fcintl.h"
#include "log.h"
#include "string_vector.h"
#include "fc_types.h"
#include "game.h"
#include "client_main.h"
#include "climisc.h"
#include "clinet.h"
#include "connectdlg_common.h"
#include "global_worklist.h"
#include "colors.h"
#include "connectdlg.h"
#include "dialogs.h"
#include "graphics.h"
#include "gui_id.h"
#include "gui_main.h"
#include "gui_tilespec.h"
#include "helpdlg.h"
#include "mapctrl.h"
#include "mapview.h"
#include "menu.h"
#include "messagewin.h"
#include "pages.h"
#include "themespec.h"
#include "widget.h"
#include "wldlg.h"
#include "optiondlg.h"

Go to the source code of this file.

Data Structures

struct  option_dialog_optset
 
struct  option_dialog_worklist
 
struct  option_dialog
 

Enumerations

enum  option_dialog_mode { ODM_MAIN , ODM_OPTSET , ODM_WORKLIST }
 

Functions

static struct widgetoption_widget_new (struct option *poption, struct widget *window, bool hide)
 
static void option_widget_update (struct option *poption)
 
static void option_widget_apply (struct option *poption)
 
static struct option_dialogoption_dialog_new (void)
 
static void option_dialog_destroy (struct option_dialog *pdialog)
 
static void option_dialog_optset (struct option_dialog *pdialog, const struct option_set *poptset)
 
static void option_dialog_optset_category (struct option_dialog *pdialog, int category)
 
static void option_dialog_worklist (struct option_dialog *pdialog)
 
static void arrange_widgets (struct widget *window, int widgets_per_row, int rows_shown, struct widget *begin, struct widget *end,...)
 
static int main_optiondlg_callback (struct widget *pwindow)
 
static int back_callback (struct widget *pwidget)
 
static int client_options_callback (struct widget *pwidget)
 
static int server_options_callback (struct widget *pwidget)
 
static int work_lists_callback (struct widget *widget)
 
static int save_client_options_callback (struct widget *pwidget)
 
static int save_game_callback (struct widget *pwidget)
 
static int help_browser_callback (struct widget *pwidget)
 
static int disconnect_callback (struct widget *pwidget)
 
static int exit_callback (struct widget *pwidget)
 
static int option_category_callback (struct widget *widget)
 
static int apply_callback (struct widget *widget)
 
static int none_callback (struct widget *widget)
 
static struct strvecvideo_mode_list (void)
 
static void enum_widget_destroy (struct widget *widget)
 
static void video_mode_widget_destroy (struct widget *widget)
 
static int optset_category_option_count (const struct option_set *poptset, int category)
 
static int edit_worklist_callback (struct widget *widget)
 
static int add_new_worklist_callback (struct widget *widget)
 
int optiondlg_callback (struct widget *pbutton)
 
void enable_options_button (void)
 
void disable_options_button (void)
 
void init_options_button (void)
 
void update_worklist_report_dialog (void)
 
void popup_optiondlg (void)
 
void popdown_optiondlg (bool leave_game)
 
void option_dialog_popup (const char *name, const struct option_set *poptset)
 
void option_dialog_popdown (const struct option_set *poptset)
 
void option_gui_update (struct option *poption)
 
void option_gui_add (struct option *poption)
 
void option_gui_remove (struct option *poption)
 

Variables

static struct option_dialogoption_dialog = NULL
 
struct widgetoptions_button = NULL
 
static bool restore_meswin_dialog = FALSE
 

Enumeration Type Documentation

◆ option_dialog_mode

Enumerator
ODM_MAIN 
ODM_OPTSET 
ODM_WORKLIST 

Definition at line 72 of file optiondlg.c.

Function Documentation

◆ add_new_worklist_callback()

static int add_new_worklist_callback ( struct widget widget)
static

Callback to append a global worklist.

Definition at line 1150 of file optiondlg.c.

Referenced by option_dialog_worklist().

◆ apply_callback()

static int apply_callback ( struct widget widget)
static

Apply the changes for the option category.

Definition at line 428 of file optiondlg.c.

Referenced by option_dialog_optset_category().

◆ arrange_widgets()

static void arrange_widgets ( struct widget window,
int  widgets_per_row,
int  rows_shown,
struct widget begin,
struct widget end,
  ... 
)
static

Arrange the widgets. NB: end argument is excluded. End the argument list with the icons on the top, terminated by NULL.

Definition at line 127 of file optiondlg.c.

Referenced by back_callback(), option_dialog_new(), option_dialog_optset(), and option_dialog_optset_category().

◆ back_callback()

static int back_callback ( struct widget pwidget)
static

◆ client_options_callback()

static int client_options_callback ( struct widget pwidget)
static

Create the client options dialog.

Definition at line 315 of file optiondlg.c.

Referenced by option_dialog_new().

◆ disable_options_button()

void disable_options_button ( void  )

Disable button to open option dialog.

Definition at line 1374 of file optiondlg.c.

Referenced by disable_main_widgets().

◆ disconnect_callback()

static int disconnect_callback ( struct widget pwidget)
static

Client disconnect from server callback.

Definition at line 388 of file optiondlg.c.

Referenced by option_dialog_new().

◆ edit_worklist_callback()

static int edit_worklist_callback ( struct widget widget)
static

Clicked on a global worklist name.

Definition at line 1092 of file optiondlg.c.

Referenced by add_new_worklist_callback(), and option_dialog_worklist().

◆ enable_options_button()

void enable_options_button ( void  )

Enable button to open option dialog.

Definition at line 1366 of file optiondlg.c.

Referenced by back_callback(), disconnect_callback(), enable_main_widgets(), init_options_button(), and show_game_page().

◆ enum_widget_destroy()

static void enum_widget_destroy ( struct widget widget)
static

Free correctly the memory assigned to the enum_widget.

Definition at line 482 of file optiondlg.c.

Referenced by option_widget_new().

◆ exit_callback()

static int exit_callback ( struct widget pwidget)
static

Exit callback.

Definition at line 402 of file optiondlg.c.

Referenced by option_dialog_new().

◆ help_browser_callback()

static int help_browser_callback ( struct widget pwidget)
static

Open Help Browser callback

Definition at line 376 of file optiondlg.c.

Referenced by option_dialog_new().

◆ init_options_button()

void init_options_button ( void  )

Create button to open option dialog.

Definition at line 1382 of file optiondlg.c.

Referenced by show_game_page().

◆ main_optiondlg_callback()

static int main_optiondlg_callback ( struct widget pwindow)
static

User interacted with the option dialog window.

Definition at line 226 of file optiondlg.c.

Referenced by option_dialog_new().

◆ none_callback()

static int none_callback ( struct widget widget)
static

Dummy callback. Disable exit().

Definition at line 447 of file optiondlg.c.

Referenced by option_widget_new().

◆ option_category_callback()

static int option_category_callback ( struct widget widget)
static

Option set category selected.

Definition at line 416 of file optiondlg.c.

Referenced by option_dialog_optset().

◆ option_dialog_destroy()

static void option_dialog_destroy ( struct option_dialog pdialog)
static

Destroys an option dialog.

Definition at line 917 of file optiondlg.c.

◆ option_dialog_new()

static struct option_dialog * option_dialog_new ( void  )
static

Return a new option dialog.

Definition at line 788 of file optiondlg.c.

Referenced by option_dialog_popup(), and popup_optiondlg().

◆ option_dialog_optset()

static void option_dialog_optset ( struct option_dialog pdialog,
const struct option_set poptset 
)
static

Initialize an option set page.

Definition at line 960 of file optiondlg.c.

◆ option_dialog_optset_category()

static void option_dialog_optset_category ( struct option_dialog pdialog,
int  category 
)
static

Initialize an option set category page.

Definition at line 1011 of file optiondlg.c.

Referenced by option_category_callback(), option_gui_add(), and option_gui_remove().

◆ option_dialog_popdown()

void option_dialog_popdown ( const struct option_set poptset)

Popdown the option dialog for the option set.

Definition at line 1492 of file optiondlg.c.

◆ option_dialog_popup()

void option_dialog_popup ( const char name,
const struct option_set poptset 
)

Popup the option dialog for the option set.

Definition at line 1472 of file optiondlg.c.

◆ option_dialog_worklist()

The Worklist Report part of Options dialog shows all the global worklists that the player has defined.

Definition at line 1223 of file optiondlg.c.

◆ option_gui_add()

void option_gui_add ( struct option poption)

Add the GUI for the option.

Definition at line 1521 of file optiondlg.c.

◆ option_gui_remove()

void option_gui_remove ( struct option poption)

Remove the GUI for the option.

Definition at line 1535 of file optiondlg.c.

◆ option_gui_update()

void option_gui_update ( struct option poption)

Update the GUI for the option.

Definition at line 1504 of file optiondlg.c.

◆ option_widget_apply()

static void option_widget_apply ( struct option poption)
static

Apply the changes for the option.

Definition at line 717 of file optiondlg.c.

Referenced by apply_callback().

◆ option_widget_new()

static struct widget * option_widget_new ( struct option poption,
struct widget window,
bool  hide 
)
static

Create a widget for the option.

Definition at line 499 of file optiondlg.c.

Referenced by option_dialog_optset_category().

◆ option_widget_update()

static void option_widget_update ( struct option poption)
static

Update the widget of the option.

Definition at line 646 of file optiondlg.c.

Referenced by option_gui_update().

◆ optiondlg_callback()

int optiondlg_callback ( struct widget pbutton)

User interacted with the option dialog button.

Definition at line 1345 of file optiondlg.c.

Referenced by init_options_button(), and popup_minimap_window().

◆ optset_category_option_count()

static int optset_category_option_count ( const struct option_set poptset,
int  category 
)
static

Return the number of options of the category.

Definition at line 943 of file optiondlg.c.

Referenced by option_dialog_optset(), and option_dialog_optset_category().

◆ popdown_optiondlg()

void popdown_optiondlg ( bool  leave_game)

Close option dialog.

Definition at line 1451 of file optiondlg.c.

Referenced by back_callback(), disconnect_callback(), exit_callback(), and popdown_all_game_dialogs().

◆ popup_optiondlg()

void popup_optiondlg ( void  )

Popup the main option menu dialog.

Definition at line 1432 of file optiondlg.c.

Referenced by option_dialog_popup(), optiondlg_callback(), and options_callback().

◆ save_client_options_callback()

static int save_client_options_callback ( struct widget pwidget)
static

Option set category selected.

Definition at line 351 of file optiondlg.c.

Referenced by option_dialog_new().

◆ save_game_callback()

static int save_game_callback ( struct widget pwidget)
static

Save game callback.

Definition at line 363 of file optiondlg.c.

Referenced by option_dialog_new().

◆ server_options_callback()

static int server_options_callback ( struct widget pwidget)
static

Create the server options dialog.

Definition at line 327 of file optiondlg.c.

Referenced by option_dialog_new().

◆ update_worklist_report_dialog()

void update_worklist_report_dialog ( void  )

If the Options Dlg is open, force Worklist List contents to be updated. This function is call by exiting worklist editor to update changed worklist name in global worklist report ( Options Dlg )

Definition at line 1409 of file optiondlg.c.

◆ video_mode_list()

static struct strvec * video_mode_list ( void  )
static

Return a string vector containing all video modes.

Definition at line 455 of file optiondlg.c.

Referenced by option_widget_new().

◆ video_mode_widget_destroy()

static void video_mode_widget_destroy ( struct widget widget)
static

Free correctly the memory assigned to the video_mode_widget.

Definition at line 490 of file optiondlg.c.

Referenced by option_widget_new().

◆ work_lists_callback()

static int work_lists_callback ( struct widget widget)
static

Create the worklist editor.

Definition at line 339 of file optiondlg.c.

Referenced by option_dialog_new().

Variable Documentation

◆ option_dialog

Definition at line 102 of file optiondlg.c.

◆ options_button

struct widget* options_button = NULL

◆ restore_meswin_dialog

bool restore_meswin_dialog = FALSE
static

Definition at line 104 of file optiondlg.c.

Referenced by popdown_optiondlg(), and popup_optiondlg().