Crossfire Client, Trunk
GTK-V2 client keybinding window functions.
+ Collaboration diagram for GTK-V2 client keybinding window functions.:

Functions

static int keybind_overwrite_confirm (struct keybind *kb)
 
static void keybinding_get_data (guint32 *keysym, guint8 *flags, const char **command)
 
gboolean keybinding_selection_func (GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer userdata)
 
void on_kb_scope_togglebutton_character_toggled (GtkToggleButton *toggle_button, gpointer user_data)
 
void on_kb_scope_togglebutton_global_toggled (GtkToggleButton *toggle_button, gpointer user_data)
 
void on_keybinding_button_bind_clicked (GtkButton *button, gpointer user_data)
 
void on_keybinding_button_clear_clicked (GtkButton *button, gpointer user_data)
 
void on_keybinding_button_close_clicked (GtkButton *button, gpointer user_data)
 
void on_keybinding_button_remove_clicked (GtkButton *button, gpointer user_data)
 
void on_keybinding_button_update_clicked (GtkButton *button, gpointer user_data)
 
void on_keybinding_checkbutton_any_clicked (GtkCheckButton *cb, gpointer user_data)
 
gboolean on_keybinding_entry_key_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
 
void on_keybindings_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void reset_keybinding_status (void)
 
void toggle_buttons_scope (int scope)
 
void toggle_keybind_scope (int scope, struct keybind *kb)
 
void update_keybinding_list (void)
 

Detailed Description

EndOf GtkV2KeyBinding

Function Documentation

◆ keybind_overwrite_confirm()

static int keybind_overwrite_confirm ( struct keybind kb)
static

Shows a dialog that prompts for confirmation before overwriting a keybind, showing details of the keybind we are about to overwrite.

Parameters
kbThe keybind we are about to overwrite.
Returns
TRUE if the user chooses to overwrite kb, else FALSE.

Definition at line 2038 of file keys.c.

References keybind::command, get_key_modchars(), keybinding_window, keybind::keysym, and MAX_BUF.

Referenced by on_keybinding_button_bind_clicked(), and toggle_keybind_scope().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keybinding_get_data()

static void keybinding_get_data ( guint32 *  keysym,
guint8 *  flags,
const char **  command 
)
static

Gets the state information from checkboxes and other data in the window and puts it in the variables passed. This is used by both the update and add functions.

Parameters
keysym
flags
command

Definition at line 2225 of file keys.c.

References bind_buf, keybind::command, draw_ext_info(), keybind::flags, kb_scope_togglebutton_global, keybinding_checkbutton_alt, keybinding_checkbutton_any, keybinding_checkbutton_control, keybinding_checkbutton_edit, keybinding_checkbutton_meta, keybinding_checkbutton_shift, keybinding_entry_command, keybinding_entry_key, KEYF_ANY, KEYF_EDIT, KEYF_MOD_ALT, KEYF_MOD_CTRL, KEYF_MOD_META, KEYF_MOD_SHIFT, KEYF_R_GLOBAL, keybind::keysym, LOG(), LOG_ERROR, MAX_BUF, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_ERROR, and NDI_RED.

Referenced by on_keybinding_button_bind_clicked(), and on_keybinding_button_update_clicked().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keybinding_selection_func()

gboolean keybinding_selection_func ( GtkTreeSelection *  selection,
GtkTreeModel *  model,
GtkTreePath *  path,
gboolean  path_currently_selected,
gpointer  userdata 
)

Called when the user clicks one of the entries in the list of keybindings and places information about it into the input fields on the dialog. This allows the player to edit and update, or remove bindings.

Parameters
selection
model
path
path_currently_selected
userdata
Returns
TRUE

Definition at line 2409 of file keys.c.

References keybind::command, keybind::flags, keybinding_button_remove, keybinding_button_update, keybinding_checkbutton_alt, keybinding_checkbutton_any, keybinding_checkbutton_control, keybinding_checkbutton_edit, keybinding_checkbutton_meta, keybinding_checkbutton_shift, keybinding_entry_command, keybinding_entry_key, KEYF_ANY, KEYF_EDIT, KEYF_MOD_ALT, KEYF_MOD_CTRL, KEYF_MOD_META, KEYF_MOD_SHIFT, KEYF_R_GLOBAL, keybind::keysym, KLIST_KEY_ENTRY, LOG(), LOG_ERROR, and toggle_buttons_scope().

Referenced by keys_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_kb_scope_togglebutton_character_toggled()

void on_kb_scope_togglebutton_character_toggled ( GtkToggleButton *  toggle_button,
gpointer  user_data 
)

Called when "This character" is clicked. Toggles scope of the selected binding and handles the togglebuttons' state.

Parameters
toggle_button
user_data

Definition at line 2149 of file keys.c.

References kb_scope_togglebutton_character, keybinding_selection, KLIST_KEY_ENTRY, toggle_buttons_scope(), and toggle_keybind_scope().

Referenced by keys_init(), and toggle_buttons_scope().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_kb_scope_togglebutton_global_toggled()

void on_kb_scope_togglebutton_global_toggled ( GtkToggleButton *  toggle_button,
gpointer  user_data 
)

Called when "All characters" is clicked. Toggles scope of the selected binding and handles the togglebuttons' state.

Parameters
toggle_button
user_data

Definition at line 2171 of file keys.c.

References kb_scope_togglebutton_global, keybinding_selection, KLIST_KEY_ENTRY, toggle_buttons_scope(), and toggle_keybind_scope().

Referenced by keys_init(), and toggle_buttons_scope().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_keybinding_button_bind_clicked()

void on_keybinding_button_bind_clicked ( GtkButton *  button,
gpointer  user_data 
)

Sets up a new binding when the "Add" button is clicked.

Parameters
button
user_data

Definition at line 2292 of file keys.c.

References keybind::command, keybind::flags, keybind_find(), keybind_insert(), keybind_overwrite_confirm(), keybinding_get_data(), KEYF_R_GLOBAL, keybind::keysym, reset_keybinding_status(), save_keys(), and update_keybinding_list().

Referenced by keys_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_keybinding_button_clear_clicked()

void on_keybinding_button_clear_clicked ( GtkButton *  button,
gpointer  user_data 
)

Implements the "Clear Fields" button function on the keybinding dialog. If a keybinding is highlighted (selected), de-select it first, then clear all of * the input boxes and reset any buttons to an appropriate state.

Parameters
button
user_data

Definition at line 2517 of file keys.c.

References keybinding_selection, and reset_keybinding_status().

Referenced by keys_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_keybinding_button_close_clicked()

void on_keybinding_button_close_clicked ( GtkButton *  button,
gpointer  user_data 
)

Deactivates the keybinding dialog when the "Close Window" button is clicked.

Parameters
button
user_data

Definition at line 2375 of file keys.c.

References keybinding_window.

Referenced by keys_init().

+ Here is the caller graph for this function:

◆ on_keybinding_button_remove_clicked()

void on_keybinding_button_remove_clicked ( GtkButton *  button,
gpointer  user_data 
)

Implements the "Remove Binding" button function that unbinds the currently selected keybinding.

Parameters
button
user_data

Definition at line 2193 of file keys.c.

References keybind_free(), keybind_remove(), keybinding_selection, KLIST_KEY_ENTRY, LOG(), LOG_ERROR, save_keys(), and update_keybinding_list().

Referenced by keys_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_keybinding_button_update_clicked()

void on_keybinding_button_update_clicked ( GtkButton *  button,
gpointer  user_data 
)

Implements the "Update Binding" button to update the currently selected keybinding to match the currently shown identifiers, key, or command input fields. If a keybinding is highlighted, so something. If not, log an error since the "Update Binding" button should have been disabled.

Parameters
button
user_data

Definition at line 2326 of file keys.c.

References keybind::command, keybind::flags, keybind_free(), keybind_insert(), keybind_remove(), keybinding_get_data(), keybinding_selection, keybind::keysym, KLIST_KEY_ENTRY, LOG(), LOG_ERROR, save_keys(), and update_keybinding_list().

Referenced by keys_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_keybinding_checkbutton_any_clicked()

void on_keybinding_checkbutton_any_clicked ( GtkCheckButton *  cb,
gpointer  user_data 
)

Deactivate the modifier checkboxes if "Any" is selected.

Parameters
button
user_data

Definition at line 2385 of file keys.c.

References keybinding_checkbutton_alt, keybinding_checkbutton_control, keybinding_checkbutton_meta, and keybinding_checkbutton_shift.

Referenced by keys_init().

+ Here is the caller graph for this function:

◆ on_keybinding_entry_key_key_press_event()

gboolean on_keybinding_entry_key_key_press_event ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  user_data 
)

Respond to a key press in the "Key" input box. If the keyboard has modifier keys pressed, set the appropriate "Keybinding Modifiers" checkboxes if the shift or control keys happens to be pressed at the time. Oddly, the Alt and Meta keys are not similarly handled. Checkboxes are never cleared here in case the user had just set the checkboxes ahead of time.

Parameters
widget
event
user_data
Returns
TRUE (Returning TRUE prevents widget from getting this event.)

Definition at line 1945 of file keys.c.

References keybinding_checkbutton_alt, keybinding_checkbutton_control, keybinding_checkbutton_meta, keybinding_checkbutton_shift, and keybinding_entry_key.

Referenced by keys_init().

+ Here is the caller graph for this function:

◆ on_keybindings_activate()

void on_keybindings_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Menubar item to activate keybindings window

Parameters
menuitem
user_data

Definition at line 1927 of file keys.c.

References keybinding_window, and update_keybinding_list().

Referenced by init_menu_items().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_keybinding_status()

void reset_keybinding_status ( void  )

Reset the state of the keybinding dialog. Uncheck all modifier checkboxes, clear the key input box, clear the command input box, and disable the two update and remove keybinding buttons.

Definition at line 2487 of file keys.c.

References keybinding_button_remove, keybinding_button_update, keybinding_checkbutton_alt, keybinding_checkbutton_any, keybinding_checkbutton_control, keybinding_checkbutton_edit, keybinding_checkbutton_meta, keybinding_checkbutton_shift, keybinding_entry_command, keybinding_entry_key, and toggle_buttons_scope().

Referenced by on_keybinding_button_bind_clicked(), on_keybinding_button_clear_clicked(), and update_keybinding_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggle_buttons_scope()

void toggle_buttons_scope ( int  scope)

Toggles buttons state to reflect a scope state. Both togglebuttons change accordingly.

Parameters
scope- State to apply to the "All characters" togglebutton. The "This character" togglebutton will get the opposite state.

Definition at line 1998 of file keys.c.

References kb_scope_togglebutton_character, kb_scope_togglebutton_global, on_kb_scope_togglebutton_character_toggled(), and on_kb_scope_togglebutton_global_toggled().

Referenced by keybinding_selection_func(), on_kb_scope_togglebutton_character_toggled(), on_kb_scope_togglebutton_global_toggled(), reset_keybinding_status(), and toggle_keybind_scope().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggle_keybind_scope()

void toggle_keybind_scope ( int  scope,
struct keybind kb 
)

Toggles a keybinding's scope to the desired value. First checks for existance of another binding with the desired scope and asks for confirmation before overwriting anything.

@scope The new scope to apply to this keybind, 0 meaning char scope, non zero meaning global scope. @kb Keybinding to modify scope.

Definition at line 2073 of file keys.c.

References keybind::command, cpl, draw_ext_info(), keybind::flags, keybind_find(), keybind_free(), keybind_insert(), keybind_overwrite_confirm(), keybind_remove(), keybindings_init(), KEYF_R_CHAR, KEYF_R_GLOBAL, KEYHASH, keys_global, keybind::keysym, MAX_BUF, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_ERROR, Player_Struct::name, NDI_BLACK, keybind::next, save_keys(), toggle_buttons_scope(), and update_keybinding_list().

Referenced by on_kb_scope_togglebutton_character_toggled(), and on_kb_scope_togglebutton_global_toggled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_keybinding_list()

void update_keybinding_list ( void  )