Crossfire Client, Branches
R11627
|
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <ctype.h>
#include "client.h"
#include "main.h"
#include "image.h"
#include "gtk2proto.h"
#include <dirent.h>
Go to the source code of this file.
Macros | |
#define | IS_DIFFERENT(TYPE) (want_config[TYPE] != use_config[TYPE]) |
Functions | |
void | config_init (GtkWidget *window_root) |
static void | fill_combobox_from_datadir (GtkWidget *combobox, char *active, uint64 want_none, char *subdir, int(*scandir_filter)()) |
void | load_defaults (void) |
void | load_theme (int reload) |
void | load_window_positions (GtkWidget *window_root) |
void | on_config_button_apply_clicked (GtkButton *button, gpointer user_data) |
void | on_config_button_close_clicked (GtkButton *button, gpointer user_data) |
void | on_config_button_save_clicked (GtkButton *button, gpointer user_data) |
void | on_configure_activate (GtkMenuItem *menuitem, gpointer user_data) |
void | on_save_window_position_activate (GtkMenuItem *menuitem, gpointer user_data) |
static void | read_config_window (void) |
void | save_defaults (void) |
void | save_winpos (void) |
static int | scandir_glade_filter (const struct dirent *d) |
static int | scandir_theme_filter (const struct dirent *d) |
static void | setup_config_window (void) |
Variables | |
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_combobox_displaymode |
GtkWidget * | config_combobox_faceset |
GtkWidget * | config_combobox_glade |
GtkWidget * | config_combobox_lighting |
GtkWidget * | config_combobox_theme |
GtkWidget * | config_spinbutton_cwindow |
GtkWidget * | config_spinbutton_iconscale |
GtkWidget * | config_spinbutton_mapheight |
GtkWidget * | config_spinbutton_mapscale |
GtkWidget * | config_spinbutton_mapwidth |
GtkWidget * | config_window |
static const char *const | display_modes [] = {"Pixmap", "SDL", "OpenGL"} |
static char * | gladedir = "glade-gtk2" |
const char *const | rcsid_gtk2_config_c |
static char * | theme = "Standard" |
static char * | themedir = "themes" |
Covers configuration issues.
Definition in file config.c.
#define IS_DIFFERENT | ( | TYPE | ) | (want_config[TYPE] != use_config[TYPE]) |
Definition at line 784 of file config.c.
Referenced by read_config_window().
void config_init | ( | GtkWidget * | window_root | ) |
Set up the configuration popup dialog using libglade and the XML layout file loaded from main.c and connect various signals associated with this dialog.
Definition at line 407 of file config.c.
References dialog_xml, has_init, on_config_button_apply_clicked(), on_config_button_close_clicked(), and on_config_button_save_clicked().
Referenced by main().
|
static |
Load a control with entries created from a directory that has files suited to a particular function. IE. themes, and UI layout files.
This sees what themes or layouts are in the directory and puts them in the pulldown menu for the selection box. The presumption is made that these files won't change during run time, so we only need to do this once.
combobox | a glade combobox widget to be filled with filenames. |
active | a pointer to a string that is the active combobox item. |
want_none | 1 if a "None" entry is added to the filename list; 0 if not. |
subdir | the subdirectory that contains filenames to add to the combobox list. |
scandir_filter | a pointer to a function that is called by scandir() to filter filenames to add to the combobox. The function returns 1 if the filename is valid for addition to the combobox list. |
Definition at line 565 of file config.c.
References LOG(), LOG_DEBUG, LOG_ERROR, and MAX_BUF.
Referenced by setup_config_window().
void load_defaults | ( | void | ) |
This function processes the user saved settings file and establishes the configuration of the client.
Definition at line 207 of file config.c.
References CFG_DM_SDL, CFG_LT_PIXEL, CFG_LT_TILE, CONFIG_DARKNESS, CONFIG_DISPLAYMODE, CONFIG_ICONSCALE, CONFIG_LIGHTING, CONFIG_MAPHEIGHT, CONFIG_MAPSCALE, CONFIG_MAPWIDTH, config_names, CONFIG_NUMS, CONFIG_POPUPS, CONFIG_RESISTS, CONFIG_SPLASH, DEFAULT_IMAGE_SIZE, face_info, FALSE, image_size, LOG(), LOG_WARNING, map_image_half_size, map_image_size, MAP_MAX_SIZE, MAX_BUF, server, strdup_local(), TRUE, use_config, want_config, Face_Information_struct::want_faceset, and window_xml_file.
void load_theme | ( | int | reload | ) |
Loads the theme stored away in the theme value above. the theme string is loaded/saved into the config file, and can also be changed by the user in the config menu.
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 116 of file config.c.
References Player_Struct::below, cpl, draw_lists(), draw_message_window(), draw_stats(), info_get_styles(), item_struct::inv_updated, inventory_get_styles(), LOG(), LOG_ERROR, MAX_BUF, Player_Struct::ob, spell_get_styles(), stats_get_styles(), TRUE, and update_spell_information().
Referenced by main(), and read_config_window().
void load_window_positions | ( | GtkWidget * | window_root | ) |
Retrieves saved window positions saved with the Client | Save Window Position menu item.
window_root | The client's main window. |
Definition at line 1064 of file config.c.
References draw_info(), LOG(), LOG_ERROR, LOG_INFO, MAX_BUF, NDI_RED, and window_xml_file.
Referenced by main().
void on_config_button_apply_clicked | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
Defines the behavior invoked when the configuration dialog apply button is pressed.
button | |
user_data |
Definition at line 941 of file config.c.
References read_config_window().
Referenced by config_init().
void on_config_button_close_clicked | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
Defines the behavior invoked when the configuration dialog close button is pressed.
button | |
user_data |
Definition at line 955 of file config.c.
Referenced by config_init().
void on_config_button_save_clicked | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
Defines the behavior invoked when the configuration dialog save button is pressed.
button | |
user_data |
Definition at line 926 of file config.c.
References read_config_window(), and save_defaults().
Referenced by config_init().
void on_configure_activate | ( | GtkMenuItem * | menuitem, |
gpointer | user_data | ||
) |
Defines the behavior invoked when the configuration dialog is activated.
menuitem | |
user_data |
Definition at line 968 of file config.c.
References setup_config_window().
Referenced by enable_menu_items().
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 1048 of file config.c.
References save_winpos().
Referenced by enable_menu_items().
|
static |
This is basically the opposite of setup_config_window() above - instead of setting the display state appropriately, we read the display state and update the want_config values.
Definition at line 791 of file config.c.
References CFG_DM_OPENGL, CFG_DM_PIXMAP, CFG_DM_SDL, CFG_LT_NONE, CFG_LT_PIXEL, CFG_LT_PIXEL_BEST, CFG_LT_TILE, CONFIG_CACHE, CONFIG_CWINDOW, CONFIG_DARKNESS, CONFIG_DISPLAYMODE, CONFIG_DOWNLOAD, CONFIG_ECHO, CONFIG_FASTTCP, CONFIG_FOGWAR, CONFIG_FOODBEEP, CONFIG_GRAD_COLOR, CONFIG_ICONSCALE, CONFIG_LIGHTING, CONFIG_MAPHEIGHT, CONFIG_MAPSCALE, CONFIG_MAPWIDTH, CONFIG_SMOOTH, CONFIG_SOUND, cs_print_string(), csocket, draw_stats(), face_info, ClientSocket::fd, init_SDL(), init_sounds(), IS_DIFFERENT, load_theme(), MAX_BUF, SOL_TCP, strdup_local(), TRUE, use_config, want_config, Face_Information_struct::want_faceset, and window_xml_file.
Referenced by on_config_button_apply_clicked(), and on_config_button_save_clicked().
void save_defaults | ( | void | ) |
This function saves user settings chosen using the configuration popup dialog.
Definition at line 365 of file config.c.
References config_names, CONFIG_NUMS, draw_info(), face_info, LOG(), LOG_ERROR, make_path_to_file(), MAX_BUF, NDI_BLUE, server, want_config, Face_Information_struct::want_faceset, and window_xml_file.
void save_winpos | ( | void | ) |
Handles saving of the window positions when the Client | Save Window Position menu item is executed. All hpaned and vpaned widget settings have the information required, and the code automatically works for Glade XML layouts that follow the glade-2's default widget naming convention.
Definition at line 981 of file config.c.
References draw_info(), get_window_coord(), MAX_BUF, NDI_BLUE, NDI_RED, window_root, and window_xml_file.
Referenced by on_save_window_position_activate().
|
static |
This function is used by scandir below to get only the directory entries needed. In the case of glade files, skip all files that do not end with ".glade" and the default glade XML file that defines auxilliary dialogs.
d | the dirent entry from scandir. |
function returns 1 if the file is a valid glade XML file name, 0 for files that are not.
Definition at line 517 of file config.c.
References DIALOG_XML_FILENAME, and MAX_BUF.
Referenced by setup_config_window().
|
static |
This function is used by scandir below to get only the directory entries needed. In the case of themes, simply skip dot files.
d | the dirent entry from scandir. |
function returns 1 if the file is a valid theme file name, 0 for files that are not.
Definition at line 500 of file config.c.
Referenced by setup_config_window().
|
static |
Definition at line 631 of file config.c.
References CFG_LT_NONE, CFG_LT_PIXEL, CFG_LT_PIXEL_BEST, CFG_LT_TILE, CONFIG_CACHE, CONFIG_CWINDOW, CONFIG_DISPLAYMODE, CONFIG_DOWNLOAD, CONFIG_ECHO, CONFIG_FASTTCP, CONFIG_FOGWAR, CONFIG_FOODBEEP, CONFIG_GRAD_COLOR, CONFIG_ICONSCALE, CONFIG_LIGHTING, CONFIG_MAPHEIGHT, CONFIG_MAPSCALE, CONFIG_MAPWIDTH, CONFIG_SMOOTH, CONFIG_SOUND, face_info, Face_Information_struct::facesets, fill_combobox_from_datadir(), FaceSets_struct::fullname, Face_Information_struct::have_faceset_info, LOG(), LOG_ERROR, MAX_FACE_SETS, scandir_glade_filter(), scandir_theme_filter(), want_config, Face_Information_struct::want_faceset, and window_xml_file.
Referenced by on_configure_activate().
|
static |
const char* const rcsid_gtk2_config_c |