![]() |
Crossfire Client, Trunk
|
#include "client.h"
#include <ctype.h>
#include <gtk/gtk.h>
#include "image.h"
#include "main.h"
#include "mapdata.h"
#include "gtk2proto.h"
#include "sound.h"
Go to the source code of this file.
Macros | |
#define | THEME_DEFAULT CF_DATADIR "/themes/Standard" |
Functions | |
static void | combo_box_text_remove_all (GtkComboBoxText *combo_box) |
Removes all the text entries from the combo box. More... | |
static int | combobox_get_value (GtkComboBox *combobox, int column) |
Get an integer value from 'column' of the active field in 'combobox'. More... | |
void | config_check () |
Check that want_config is valid, copy the new configuration to use_config, and apply the new configuration. More... | |
void | config_init (GtkWidget *window_root) |
void | config_load () |
Load settings from the user's configuration file into want_config. More... | |
static void | config_load_legacy () |
Load settings from the legacy file format. More... | |
void | init_theme () |
static bool | IS_DIFFERENT (int type) |
void | load_theme (int reload) |
void | load_window_positions (GtkWidget *window_root) |
Resize the client window and its panels using saved window positions. More... | |
static void | on_config_close (GtkButton *button, gpointer user_data) |
void | on_configure_activate (GtkWidget *menuitem, gpointer user_data) |
void | on_music_volume_changed (GtkWidget *control, gpointer data) |
void | on_save_window_position_activate (GtkMenuItem *menuitem, gpointer user_data) |
Handles saving of the window positions when the Client | Save Window Position menu item is activated. More... | |
static void | read_config_dialog (void) |
This is basically the opposite of setup_config_dialog() above - instead of setting the display state appropriately, we read the display state and update the want_config values. More... | |
void | save_defaults () |
This function saves user settings chosen using the configuration popup dialog. More... | |
void | save_winpos () |
Save client window positions to a file unique to each layout. More... | |
static void | setup_config_dialog () |
static char * | ui_name () |
Return the basename of the current UI file. More... | |
Variables | |
static GKeyFile * | config |
GtkWidget * | config_button_cache |
GtkWidget * | config_button_download |
GtkWidget * | config_button_echo |
GtkWidget * | config_button_fasttcp |
GtkWidget * | config_button_fog |
GtkWidget * | config_button_foodbeep |
GtkWidget * | config_button_grad_color |
GtkWidget * | config_button_smoothing |
GtkWidget * | config_button_sound |
GtkWidget * | config_button_timestamp |
GtkComboBox * | config_combobox_displaymode |
GtkComboBoxText * | config_combobox_faceset |
GtkComboBox * | config_combobox_lighting |
GtkWidget * | config_dialog |
GtkRange * | config_music_volume |
static GString * | config_path |
static char ** | default_files = NULL |
Sets up player-specific client and layout rc files and handles loading of a client theme if one is selected. More... | |
char * | last_server |
int | predict_alpha = 10 |
Speed of local map prediction scrolling, 0-100 (0 to disable). More... | |
static char * | theme |
GtkFileChooser * | theme_filechooser |
bool | time_map_redraw = false |
GtkFileChooser * | ui_filechooser |
Implement client configuration dialog
Definition in file config.c.
|
static |
Removes all the text entries from the combo box.
This function is not available in GTK+2, so implement it ourselves.
Definition at line 622 of file config.c.
Referenced by setup_config_dialog().
|
static |
Get an integer value from 'column' of the active field in 'combobox'.
Definition at line 704 of file config.c.
Referenced by read_config_dialog().
void config_init | ( | GtkWidget * | window_root | ) |
Definition at line 548 of file config.c.
References CFG_DM_OPENGL, CFG_DM_PIXMAP, CFG_DM_SDL, config_button_cache, config_button_download, config_button_echo, config_button_fasttcp, config_button_fog, config_button_foodbeep, config_button_grad_color, config_button_smoothing, config_button_sound, config_button_timestamp, config_combobox_displaymode, config_combobox_faceset, config_combobox_lighting, config_dialog, config_music_volume, dialog_xml, on_config_close(), on_music_volume_changed(), theme_filechooser, and ui_filechooser.
Referenced by init_ui().
void config_load | ( | ) |
Load settings from the user's configuration file into want_config.
Definition at line 446 of file config.c.
References config, config_dir, config_load_legacy(), config_names, CONFIG_NUMS, config_path, face_info, last_server, LOG(), LOG_DEBUG, predict_alpha, theme, THEME_DEFAULT, use_config, want_config, Face_Information_struct::want_faceset, and window_xml_file.
Referenced by main().
|
static |
Load settings from the legacy file format.
Definition at line 220 of file config.c.
References CFG_DM_SDL, CFG_LT_PIXEL, CFG_LT_TILE, CONFIG_DISPLAYMODE, CONFIG_LIGHTING, CONFIG_MAPHEIGHT, CONFIG_MAPWIDTH, config_names, CONFIG_NUMS, CONFIG_POPUPS, CONFIG_RESISTS, CONFIG_SPLASH, face_info, LOG(), LOG_INFO, LOG_WARNING, MAX_BUF, theme, want_config, Face_Information_struct::want_faceset, and window_xml_file.
Referenced by config_load().
void init_theme | ( | ) |
Definition at line 95 of file config.c.
References config_dir, default_files, MAX_BUF, and ui_name().
Referenced by init_ui().
|
static |
Definition at line 60 of file config.c.
References use_config, and want_config.
Referenced by read_config_dialog().
void load_theme | ( | int | reload | ) |
Definition at line 157 of file config.c.
References Player_Struct::below, cpl, default_files, draw_lists(), draw_message_window(), draw_stats(), info_get_styles(), item_struct::inv_updated, inventory_get_styles(), LOG(), LOG_ERROR, Player_Struct::ob, spell_get_styles(), stats_get_styles(), theme, THEME_DEFAULT, and update_spell_information().
Referenced by init_ui(), and read_config_dialog().
void load_window_positions | ( | GtkWidget * | window_root | ) |
Resize the client window and its panels using saved window positions.
window_root | The client's main window. |
Definition at line 864 of file config.c.
References config, ui_name(), window_root, and window_xml.
Referenced by init_ui().
|
static |
Definition at line 799 of file config.c.
References config_check(), config_dialog, read_config_dialog(), and save_defaults().
Referenced by config_init().
void on_configure_activate | ( | GtkWidget * | menuitem, |
gpointer | user_data | ||
) |
Definition at line 794 of file config.c.
References config_dialog, and setup_config_dialog().
Referenced by init_menu_items(), and metaserver_ui_init().
void on_music_volume_changed | ( | GtkWidget * | control, |
gpointer | data | ||
) |
Definition at line 543 of file config.c.
References CONFIG_MUSIC_VOL, config_music_volume, set_music_volume(), use_config, and want_config.
Referenced by config_init().
void on_save_window_position_activate | ( | GtkMenuItem * | menuitem, |
gpointer | user_data | ||
) |
Handles saving of the window positions when the Client | Save Window Position menu item is activated.
menuitem | |
user_data |
Definition at line 850 of file config.c.
References save_winpos().
Referenced by init_menu_items().
|
static |
This is basically the opposite of setup_config_dialog() above - instead of setting the display state appropriately, we read the display state and update the want_config values.
Since the combo box does not have the "has-entry" property set to TRUE, we cannot use gtk_combo_box_text_get_active_text to get the currently selected option. Since we really have no good reason to turn that on and open up the box for arbitrary faceset strings, we can treat it more like a regular combo box. We need to use an iterator retrieval and gtk_tree_model_get to fetch the text, which is significantly more of a pain in the posterior.
Daniel Hawkins – 2020-11-21
Definition at line 719 of file config.c.
References combobox_get_value(), config_button_cache, config_button_download, config_button_echo, config_button_fasttcp, config_button_fog, config_button_foodbeep, config_button_grad_color, config_button_smoothing, config_button_sound, config_button_timestamp, CONFIG_CACHE, config_combobox_displaymode, config_combobox_faceset, config_combobox_lighting, CONFIG_DISPLAYMODE, CONFIG_DOWNLOAD, CONFIG_ECHO, CONFIG_FASTTCP, CONFIG_FOGWAR, CONFIG_FOODBEEP, CONFIG_GRAD_COLOR, CONFIG_LIGHTING, CONFIG_SMOOTH, CONFIG_SOUND, CONFIG_TIMESTAMP, draw_stats(), face_info, IS_DIFFERENT(), load_theme(), LOG(), LOG_ERROR, theme, theme_filechooser, ui_filechooser, want_config, Face_Information_struct::want_faceset, and window_xml_file.
Referenced by on_config_close().
void save_defaults | ( | ) |
This function saves user settings chosen using the configuration popup dialog.
Definition at line 517 of file config.c.
References config, config_names, CONFIG_NUMS, config_path, draw_ext_info(), face_info, last_server, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_CONFIG, NDI_RED, predict_alpha, theme, want_config, Face_Information_struct::want_faceset, and window_xml_file.
Referenced by do_savedefaults(), metaserver_connect_to(), on_auto_afk_response(), on_config_close(), and save_winpos().
void save_winpos | ( | ) |
Save client window positions to a file unique to each layout.
Definition at line 809 of file config.c.
References config, draw_ext_info(), get_window_coord(), MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_CONFIG, NDI_BLUE, save_defaults(), ui_name(), window_root, and window_xml.
Referenced by do_savewinpos(), and on_save_window_position_activate().
|
static |
Definition at line 634 of file config.c.
References combo_box_text_remove_all(), config_button_cache, config_button_download, config_button_echo, config_button_fasttcp, config_button_fog, config_button_foodbeep, config_button_grad_color, config_button_smoothing, config_button_sound, config_button_timestamp, CONFIG_CACHE, config_combobox_displaymode, config_combobox_faceset, config_combobox_lighting, CONFIG_DISPLAYMODE, CONFIG_DOWNLOAD, CONFIG_ECHO, CONFIG_FASTTCP, CONFIG_FOGWAR, CONFIG_FOODBEEP, CONFIG_GRAD_COLOR, CONFIG_LIGHTING, CONFIG_MUSIC_VOL, config_music_volume, CONFIG_SMOOTH, CONFIG_SOUND, CONFIG_TIMESTAMP, face_info, Face_Information_struct::facesets, FaceSets_struct::fullname, Face_Information_struct::have_faceset_info, MAX_FACE_SETS, theme, theme_filechooser, ui_filechooser, want_config, Face_Information_struct::want_faceset, and window_xml_file.
Referenced by on_configure_activate().
|
static |
Return the basename of the current UI file.
Definition at line 67 of file config.c.
References window_xml_file.
Referenced by init_theme(), load_window_positions(), and save_winpos().
|
static |
Definition at line 30 of file config.c.
Referenced by config_load(), load_window_positions(), save_defaults(), and save_winpos().
GtkWidget * config_button_cache |
Definition at line 35 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_download |
Definition at line 36 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_echo |
Definition at line 33 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_fasttcp |
Definition at line 33 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_fog |
Definition at line 36 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_foodbeep |
Definition at line 35 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_grad_color |
Definition at line 34 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_smoothing |
Definition at line 36 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_sound |
Definition at line 35 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget * config_button_timestamp |
Definition at line 34 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkComboBox* config_combobox_displaymode |
Definition at line 40 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkComboBoxText* config_combobox_faceset |
Definition at line 39 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkComboBox * config_combobox_lighting |
Definition at line 40 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
GtkWidget* config_dialog |
Definition at line 33 of file config.c.
Referenced by config_init(), on_config_close(), and on_configure_activate().
GtkRange* config_music_volume |
Definition at line 41 of file config.c.
Referenced by config_init(), on_music_volume_changed(), and setup_config_dialog().
|
static |
Definition at line 31 of file config.c.
Referenced by config_load(), and save_defaults().
|
static |
Sets up player-specific client and layout rc files and handles loading of a client theme if one is selected.
First, the player-specific rc files are added to the GTK rc default files list. ${HOME}/.crossfire/gtkrc is added first. All client sessions are affected by this rc file if it exists. Next, ${HOME}/.crossfire/[layout].gtkrc is added, where [layout] is the name of the layout file that is loaded. IE. If gtk-v2.ui is loaded, [layout] is "gtk-v2". This sets up the possibility for a player to make a layout-specific rc file. Finally, if the client theme is not "None", the client theme file is added. In most cases, the player-specific files are probably not going to exist, so the theme system will continue to work the way it always has. The player will have to "do something" to get the extra functionality. At some point, conceptually the client itself could be enhanced to allow it to save some basic settings to either or both of the player-specific rc files.
reload | If true, user has changed theme after initial startup. In this mode, we need to call the routines that store away private theme data. When program is starting up, this is false, because all the widgets haven't been realized yet, and the initialize routines will get the theme data at that time. |
Definition at line 93 of file config.c.
Referenced by init_theme(), and load_theme().
char* last_server |
Definition at line 47 of file config.c.
Referenced by config_load(), metaserver_connect_to(), metaserver_show_prompt(), and save_defaults().
int predict_alpha = 10 |
Speed of local map prediction scrolling, 0-100 (0 to disable).
Definition at line 56 of file config.c.
Referenced by config_load(), save_defaults(), and update_global_offset().
|
static |
Definition at line 46 of file config.c.
Referenced by config_load(), config_load_legacy(), load_theme(), read_config_dialog(), save_defaults(), and setup_config_dialog().
GtkFileChooser * theme_filechooser |
Definition at line 38 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().
bool time_map_redraw = false |
Definition at line 53 of file config.c.
Referenced by draw_map().
GtkFileChooser* ui_filechooser |
Definition at line 38 of file config.c.
Referenced by config_init(), read_config_dialog(), and setup_config_dialog().