The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Typedefs | Enumerations | Functions | Variables
hotkey Namespace Reference

Keyboard shortcuts for game actions. More...

Classes

class  basic_handler
 
class  command_executor
 
class  command_executor_default
 
class  hotkey_base
 This is the base class for hotkey event matching. More...
 
struct  hotkey_command
 Stores all information related to functions that can be bound to hotkeys. More...
 
struct  hotkey_command_temp
 Do not use this outside hotkeys.cpp. More...
 
class  hotkey_joystick
 
class  hotkey_keyboard
 This class is responsible for handling keys, not modifiers. More...
 
class  hotkey_mouse
 This class is responsible for handling mouse button presses. More...
 
class  hotkey_void
 This class is used to return non-valid results in order to save other people from null checks. More...
 
class  manager
 this class is initialized once at game start put all initialization and wipe code in the methods here. More...
 
class  scope_changer
 

Typedefs

typedef std::bitset< SCOPE_COUNThk_scopes
 
typedef boost::ptr_vector
< hotkey_command
t_hotkey_command_list
 
typedef boost::shared_ptr
< hotkey_base
hotkey_ptr
 
typedef boost::shared_ptr
< hotkey_mouse
hotkey_mouse_ptr
 
typedef boost::shared_ptr
< hotkey_keyboard
hotkey_keyboard_ptr
 
typedef std::vector
< hotkey::hotkey_ptr
hotkey_list
 
typedef std::vector
< hotkey::hotkey_ptr >
::iterator 
hotkey_list_iter
 

Enumerations

enum  ACTION_STATE {
  ACTION_STATELESS, ACTION_ON, ACTION_OFF, ACTION_SELECTED,
  ACTION_DESELECTED
}
 
enum  scope { SCOPE_MAIN_MENU, SCOPE_GAME, SCOPE_EDITOR, SCOPE_COUNT }
 Available hotkey scopes. More...
 
enum  HOTKEY_COMMAND {
  HOTKEY_CYCLE_UNITS, HOTKEY_CYCLE_BACK_UNITS, HOTKEY_UNIT_HOLD_POSITION, HOTKEY_END_UNIT_TURN,
  HOTKEY_LEADER, HOTKEY_UNDO, HOTKEY_REDO, HOTKEY_ZOOM_IN,
  HOTKEY_ZOOM_OUT, HOTKEY_ZOOM_DEFAULT, HOTKEY_FULLSCREEN, HOTKEY_SCREENSHOT,
  HOTKEY_MAP_SCREENSHOT, HOTKEY_ACCELERATED, HOTKEY_TERRAIN_DESCRIPTION, HOTKEY_UNIT_DESCRIPTION,
  HOTKEY_RENAME_UNIT, HOTKEY_DELETE_UNIT, HOTKEY_SAVE_GAME, HOTKEY_SAVE_REPLAY,
  HOTKEY_SAVE_MAP, HOTKEY_LOAD_GAME, HOTKEY_RECRUIT, HOTKEY_REPEAT_RECRUIT,
  HOTKEY_RECALL, HOTKEY_ENDTURN, HOTKEY_TOGGLE_ELLIPSES, HOTKEY_TOGGLE_GRID,
  HOTKEY_STATUS_TABLE, HOTKEY_MUTE, HOTKEY_MOUSE_SCROLL, HOTKEY_SPEAK,
  HOTKEY_CREATE_UNIT, HOTKEY_CHANGE_SIDE, HOTKEY_KILL_UNIT, HOTKEY_PREFERENCES,
  HOTKEY_OBJECTIVES, HOTKEY_UNIT_LIST, HOTKEY_STATISTICS, HOTKEY_STOP_NETWORK,
  HOTKEY_START_NETWORK, HOTKEY_QUIT_GAME, HOTKEY_QUIT_TO_DESKTOP, HOTKEY_LABEL_TEAM_TERRAIN,
  HOTKEY_LABEL_TERRAIN, HOTKEY_CLEAR_LABELS, HOTKEY_SHOW_ENEMY_MOVES, HOTKEY_BEST_ENEMY_MOVES,
  HOTKEY_DELAY_SHROUD, HOTKEY_UPDATE_SHROUD, HOTKEY_CONTINUE_MOVE, HOTKEY_SEARCH,
  HOTKEY_SPEAK_ALLY, HOTKEY_SPEAK_ALL, HOTKEY_HELP, HOTKEY_CHAT_LOG,
  HOTKEY_LANGUAGE, HOTKEY_ANIMATE_MAP, HOTKEY_REPLAY_PLAY, HOTKEY_REPLAY_RESET,
  HOTKEY_REPLAY_STOP, HOTKEY_REPLAY_NEXT_TURN, HOTKEY_REPLAY_NEXT_SIDE, HOTKEY_REPLAY_NEXT_MOVE,
  HOTKEY_REPLAY_SHOW_EVERYTHING, HOTKEY_REPLAY_SHOW_EACH, HOTKEY_REPLAY_SHOW_TEAM1, HOTKEY_REPLAY_SKIP_ANIMATION,
  HOTKEY_REPLAY_EXIT, HOTKEY_SELECT_HEX, HOTKEY_DESELECT_HEX, HOTKEY_MOVE_ACTION,
  HOTKEY_SELECT_AND_ACTION, HOTKEY_SCROLL_UP, HOTKEY_SCROLL_DOWN, HOTKEY_SCROLL_LEFT,
  HOTKEY_SCROLL_RIGHT, HOTKEY_CANCEL, HOTKEY_OKAY, HOTKEY_WB_TOGGLE,
  HOTKEY_WB_EXECUTE_ACTION, HOTKEY_WB_EXECUTE_ALL_ACTIONS, HOTKEY_WB_DELETE_ACTION, HOTKEY_WB_BUMP_UP_ACTION,
  HOTKEY_WB_BUMP_DOWN_ACTION, HOTKEY_WB_SUPPOSE_DEAD, HOTKEY_USER_CMD, HOTKEY_CUSTOM_CMD,
  HOTKEY_AI_FORMULA, HOTKEY_CLEAR_MSG, HOTKEY_LABEL_SETTINGS, HOTKEY_MINIMAP_CODING_TERRAIN,
  HOTKEY_MINIMAP_CODING_UNIT, HOTKEY_MINIMAP_DRAW_UNITS, HOTKEY_MINIMAP_DRAW_VILLAGES, HOTKEY_MINIMAP_DRAW_TERRAIN,
  TITLE_SCREEN__RELOAD_WML, TITLE_SCREEN__NEXT_TIP, TITLE_SCREEN__PREVIOUS_TIP, TITLE_SCREEN__TUTORIAL,
  TITLE_SCREEN__CAMPAIGN, TITLE_SCREEN__MULTIPLAYER, TITLE_SCREEN__ADDONS, TITLE_SCREEN__CORES,
  TITLE_SCREEN__EDITOR, TITLE_SCREEN__CREDITS, GLOBAL__HELPTIP, LUA_CONSOLE,
  HOTKEY_WML, HOTKEY_EDITOR_CUSTOM_TODS, HOTKEY_EDITOR_PARTIAL_UNDO, HOTKEY_EDITOR_PALETTE_ITEM_SWAP,
  HOTKEY_EDITOR_PALETTE_ITEMS_CLEAR, HOTKEY_EDITOR_PALETTE_GROUPS, HOTKEY_EDITOR_PALETTE_UPSCROLL, HOTKEY_EDITOR_PALETTE_DOWNSCROLL,
  HOTKEY_EDITOR_REMOVE_LOCATION, HOTKEY_EDITOR_PLAYLIST, HOTKEY_EDITOR_SCHEDULE, HOTKEY_EDITOR_LOCAL_TIME,
  HOTKEY_EDITOR_UNIT_FACING, HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE, HOTKEY_EDITOR_UNIT_CHANGE_ID,
  HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, HOTKEY_EDITOR_UNIT_RECRUIT_ASSIGN, HOTKEY_EDITOR_BRUSH_NEXT, HOTKEY_EDITOR_BRUSH_DEFAULT,
  HOTKEY_EDITOR_BRUSH_1, HOTKEY_EDITOR_BRUSH_2, HOTKEY_EDITOR_BRUSH_3, HOTKEY_EDITOR_BRUSH_SW_NE,
  HOTKEY_EDITOR_BRUSH_NW_SE, HOTKEY_EDITOR_TOOL_NEXT, HOTKEY_EDITOR_TOOL_PAINT, HOTKEY_EDITOR_TOOL_FILL,
  HOTKEY_EDITOR_TOOL_SELECT, HOTKEY_EDITOR_TOOL_STARTING_POSITION, HOTKEY_EDITOR_TOOL_LABEL, HOTKEY_EDITOR_TOOL_UNIT,
  HOTKEY_EDITOR_TOOL_VILLAGE, HOTKEY_EDITOR_TOOL_ITEM, HOTKEY_EDITOR_TOOL_SOUNDSOURCE, HOTKEY_EDITOR_SELECT_ALL,
  HOTKEY_EDITOR_SELECT_INVERSE, HOTKEY_EDITOR_SELECT_NONE, HOTKEY_EDITOR_CLIPBOARD_PASTE, HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW,
  HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW, HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL, HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL, HOTKEY_EDITOR_SELECTION_CUT,
  HOTKEY_EDITOR_SELECTION_COPY, HOTKEY_EDITOR_SELECTION_ROTATE, HOTKEY_EDITOR_SELECTION_FLIP, HOTKEY_EDITOR_SELECTION_FILL,
  HOTKEY_EDITOR_SELECTION_EXPORT, HOTKEY_EDITOR_SELECTION_GENERATE, HOTKEY_EDITOR_SELECTION_RANDOMIZE, HOTKEY_EDITOR_MAP_NEW,
  HOTKEY_EDITOR_MAP_LOAD, HOTKEY_EDITOR_MAP_SAVE, HOTKEY_EDITOR_MAP_SAVE_AS, HOTKEY_EDITOR_MAP_SAVE_ALL,
  HOTKEY_EDITOR_MAP_REVERT, HOTKEY_EDITOR_MAP_INFO, HOTKEY_EDITOR_MAP_CLOSE, HOTKEY_EDITOR_MAP_SWITCH,
  HOTKEY_EDITOR_MAP_RESIZE, HOTKEY_EDITOR_MAP_ROTATE, HOTKEY_EDITOR_MAP_GENERATE, HOTKEY_EDITOR_MAP_APPLY_MASK,
  HOTKEY_EDITOR_MAP_CREATE_MASK_TO, HOTKEY_EDITOR_UPDATE_TRANSITIONS, HOTKEY_EDITOR_TOGGLE_TRANSITIONS, HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS,
  HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS, HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS, HOTKEY_EDITOR_REFRESH, HOTKEY_EDITOR_REFRESH_IMAGE_CACHE,
  HOTKEY_EDITOR_DRAW_COORDINATES, HOTKEY_EDITOR_DRAW_TERRAIN_CODES, HOTKEY_EDITOR_SIDE_NEW, HOTKEY_EDITOR_SIDE_EDIT,
  HOTKEY_EDITOR_SIDE_REMOVE, HOTKEY_EDITOR_AREA_REMOVE, HOTKEY_EDITOR_AREA_ADD, HOTKEY_EDITOR_AREA_SAVE,
  HOTKEY_EDITOR_AREA_RENAME, HOTKEY_EDITOR_SCENARIO_EDIT, HOTKEY_EDITOR_SCENARIO_NEW, HOTKEY_EDITOR_SCENARIO_SAVE_AS,
  HOTKEY_NULL
}
 

Functions

static void event_execute (const SDL_Event &event, command_executor *executor)
 
void mbutton_event (const SDL_Event &event, command_executor *executor)
 
void jbutton_event (const SDL_Event &event, command_executor *executor)
 
void jhat_event (const SDL_Event &event, command_executor *executor)
 
void key_event (const SDL_Event &event, command_executor *executor)
 
void execute_command (const hotkey_command &command, command_executor *executor, int index, bool press)
 
void deactivate_all_scopes ()
 
void set_scope_active (scope s, bool set)
 
void set_active_scopes (hk_scopes s)
 
bool is_scope_active (hk_scopes s)
 
const hotkey_commandget_hotkey_command (const std::string &command)
 returns the hotkey_command with the given name More...
 
const boost::ptr_vector
< hotkey_command > & 
get_hotkey_commands ()
 returns a container that contains all currently active hotkey_commands. More...
 
bool remove_wml_hotkey (const std::string &id)
 removes a wml hotkey with the given id, returns true if the deletion was successful More...
 
bool has_hotkey_command (const std::string &id)
 
void add_wml_hotkey (const std::string &id, const t_string &description, const config &default_hotkey)
 adds a new wml hotkey to the list, but only if there is no hotkey with that id yet on the list. More...
 
const hotkey_commandget_hotkey_null ()
 returns the hotkey_command that is treated as null. More...
 
void delete_all_wml_hotkeys ()
 deletes all wml hotkeys, should be called after a game has ended More...
 
const std::stringget_description (const std::string &command)
 
const std::stringget_tooltip (const std::string &command)
 
void init_hotkey_commands ()
 
void clear_hotkey_commands ()
 
HOTKEY_COMMAND get_id (const std::string &command)
 returns get_hotkey_command(command).id More...
 
static unsigned int sdl_get_mods ()
 
hotkey_ptr create_hotkey (const std::string &id, SDL_Event &event)
 Create a new hotkey item for a command from an SDL_Event. More...
 
hotkey_ptr load_from_config (const config &cfg)
 Create and instantiate a hotkey from a config element. More...
 
bool has_hotkey_item (const std::string &command)
 
void del_hotkey (const hotkey_ptr item)
 Remove a hotkey from the list of hotkeys. More...
 
void add_hotkey (const hotkey_ptr item)
 Add a hotkey to the list of hotkeys. More...
 
void clear_hotkeys (const std::string &command)
 Unset the command bindings for all hotkeys matching the command. More...
 
void clear_hotkeys ()
 Unset the bindings for all hotkeys. More...
 
const hotkey_ptr get_hotkey (const SDL_Event &event)
 Iterate through the list of hotkeys and return a hotkey that matches the SDL_Event and the current keyboard modifier state. More...
 
void load_hotkeys (const config &cfg, bool set_as_default=false)
 Iterates through all hotkeys present in the config struct and creates and adds them to the hotkey list. More...
 
void reset_default_hotkeys ()
 Reset all hotkeys to the defaults. More...
 
const hotkey_listget_hotkeys ()
 Returns the list of hotkeys. More...
 
void save_hotkeys (config &cfg)
 Save the non-default hotkeys to the config. More...
 
std::string get_names (std::string id)
 Returns a comma-separated string of hotkey names. More...
 
hotkey_ptr show_binding_dialog (CVideo &video, const std::string &id)
 

Variables

hotkey_list hotkeys_
 
config default_hotkey_cfg_
 

Detailed Description

Keyboard shortcuts for game actions.

Hotkey commands can be loaded from configuration objects. When a keyboard event corresponding to a hotkey occurs, a command_executor object can execute the hotkeys actions. For this to work, key_event() must be called whenever a keyboard event happens.

Typedef Documentation

typedef std::bitset<SCOPE_COUNT> hotkey::hk_scopes

Definition at line 191 of file hotkey_command.hpp.

Definition at line 35 of file hotkey_item.hpp.

Definition at line 37 of file hotkey_item.hpp.

typedef std::vector<hotkey::hotkey_ptr>::iterator hotkey::hotkey_list_iter

Definition at line 38 of file hotkey_item.hpp.

Definition at line 34 of file hotkey_item.hpp.

Definition at line 32 of file hotkey_item.hpp.

typedef boost::ptr_vector<hotkey_command> hotkey::t_hotkey_command_list

Definition at line 248 of file hotkey_command.hpp.

Enumeration Type Documentation

Enumerator
ACTION_STATELESS 
ACTION_ON 
ACTION_OFF 
ACTION_SELECTED 
ACTION_DESELECTED 

Definition at line 27 of file command_executor.hpp.

Enumerator
HOTKEY_CYCLE_UNITS 
HOTKEY_CYCLE_BACK_UNITS 
HOTKEY_UNIT_HOLD_POSITION 
HOTKEY_END_UNIT_TURN 
HOTKEY_LEADER 
HOTKEY_UNDO 
HOTKEY_REDO 
HOTKEY_ZOOM_IN 
HOTKEY_ZOOM_OUT 
HOTKEY_ZOOM_DEFAULT 
HOTKEY_FULLSCREEN 
HOTKEY_SCREENSHOT 
HOTKEY_MAP_SCREENSHOT 
HOTKEY_ACCELERATED 
HOTKEY_TERRAIN_DESCRIPTION 
HOTKEY_UNIT_DESCRIPTION 
HOTKEY_RENAME_UNIT 
HOTKEY_DELETE_UNIT 
HOTKEY_SAVE_GAME 
HOTKEY_SAVE_REPLAY 
HOTKEY_SAVE_MAP 
HOTKEY_LOAD_GAME 
HOTKEY_RECRUIT 
HOTKEY_REPEAT_RECRUIT 
HOTKEY_RECALL 
HOTKEY_ENDTURN 
HOTKEY_TOGGLE_ELLIPSES 
HOTKEY_TOGGLE_GRID 
HOTKEY_STATUS_TABLE 
HOTKEY_MUTE 
HOTKEY_MOUSE_SCROLL 
HOTKEY_SPEAK 
HOTKEY_CREATE_UNIT 
HOTKEY_CHANGE_SIDE 
HOTKEY_KILL_UNIT 
HOTKEY_PREFERENCES 
HOTKEY_OBJECTIVES 
HOTKEY_UNIT_LIST 
HOTKEY_STATISTICS 
HOTKEY_STOP_NETWORK 
HOTKEY_START_NETWORK 
HOTKEY_QUIT_GAME 
HOTKEY_QUIT_TO_DESKTOP 
HOTKEY_LABEL_TEAM_TERRAIN 
HOTKEY_LABEL_TERRAIN 
HOTKEY_CLEAR_LABELS 
HOTKEY_SHOW_ENEMY_MOVES 
HOTKEY_BEST_ENEMY_MOVES 
HOTKEY_DELAY_SHROUD 
HOTKEY_UPDATE_SHROUD 
HOTKEY_CONTINUE_MOVE 
HOTKEY_SEARCH 
HOTKEY_SPEAK_ALLY 
HOTKEY_SPEAK_ALL 
HOTKEY_HELP 
HOTKEY_CHAT_LOG 
HOTKEY_LANGUAGE 
HOTKEY_ANIMATE_MAP 
HOTKEY_REPLAY_PLAY 
HOTKEY_REPLAY_RESET 
HOTKEY_REPLAY_STOP 
HOTKEY_REPLAY_NEXT_TURN 
HOTKEY_REPLAY_NEXT_SIDE 
HOTKEY_REPLAY_NEXT_MOVE 
HOTKEY_REPLAY_SHOW_EVERYTHING 
HOTKEY_REPLAY_SHOW_EACH 
HOTKEY_REPLAY_SHOW_TEAM1 
HOTKEY_REPLAY_SKIP_ANIMATION 
HOTKEY_REPLAY_EXIT 
HOTKEY_SELECT_HEX 
HOTKEY_DESELECT_HEX 
HOTKEY_MOVE_ACTION 
HOTKEY_SELECT_AND_ACTION 
HOTKEY_SCROLL_UP 
HOTKEY_SCROLL_DOWN 
HOTKEY_SCROLL_LEFT 
HOTKEY_SCROLL_RIGHT 
HOTKEY_CANCEL 
HOTKEY_OKAY 
HOTKEY_WB_TOGGLE 
HOTKEY_WB_EXECUTE_ACTION 
HOTKEY_WB_EXECUTE_ALL_ACTIONS 
HOTKEY_WB_DELETE_ACTION 
HOTKEY_WB_BUMP_UP_ACTION 
HOTKEY_WB_BUMP_DOWN_ACTION 
HOTKEY_WB_SUPPOSE_DEAD 
HOTKEY_USER_CMD 
HOTKEY_CUSTOM_CMD 
HOTKEY_AI_FORMULA 
HOTKEY_CLEAR_MSG 
HOTKEY_LABEL_SETTINGS 
HOTKEY_MINIMAP_CODING_TERRAIN 
HOTKEY_MINIMAP_CODING_UNIT 
HOTKEY_MINIMAP_DRAW_UNITS 
HOTKEY_MINIMAP_DRAW_VILLAGES 
HOTKEY_MINIMAP_DRAW_TERRAIN 
TITLE_SCREEN__RELOAD_WML 
TITLE_SCREEN__NEXT_TIP 
TITLE_SCREEN__PREVIOUS_TIP 
TITLE_SCREEN__TUTORIAL 
TITLE_SCREEN__CAMPAIGN 
TITLE_SCREEN__MULTIPLAYER 
TITLE_SCREEN__ADDONS 
TITLE_SCREEN__CORES 
TITLE_SCREEN__EDITOR 
TITLE_SCREEN__CREDITS 
GLOBAL__HELPTIP 
LUA_CONSOLE 
HOTKEY_WML 
HOTKEY_EDITOR_CUSTOM_TODS 
HOTKEY_EDITOR_PARTIAL_UNDO 
HOTKEY_EDITOR_PALETTE_ITEM_SWAP 
HOTKEY_EDITOR_PALETTE_ITEMS_CLEAR 
HOTKEY_EDITOR_PALETTE_GROUPS 
HOTKEY_EDITOR_PALETTE_UPSCROLL 
HOTKEY_EDITOR_PALETTE_DOWNSCROLL 
HOTKEY_EDITOR_REMOVE_LOCATION 
HOTKEY_EDITOR_PLAYLIST 
HOTKEY_EDITOR_SCHEDULE 
HOTKEY_EDITOR_LOCAL_TIME 
HOTKEY_EDITOR_UNIT_FACING 
HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT 
HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE 
HOTKEY_EDITOR_UNIT_CHANGE_ID 
HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL 
HOTKEY_EDITOR_UNIT_RECRUIT_ASSIGN 
HOTKEY_EDITOR_BRUSH_NEXT 
HOTKEY_EDITOR_BRUSH_DEFAULT 
HOTKEY_EDITOR_BRUSH_1 
HOTKEY_EDITOR_BRUSH_2 
HOTKEY_EDITOR_BRUSH_3 
HOTKEY_EDITOR_BRUSH_SW_NE 
HOTKEY_EDITOR_BRUSH_NW_SE 
HOTKEY_EDITOR_TOOL_NEXT 
HOTKEY_EDITOR_TOOL_PAINT 
HOTKEY_EDITOR_TOOL_FILL 
HOTKEY_EDITOR_TOOL_SELECT 
HOTKEY_EDITOR_TOOL_STARTING_POSITION 
HOTKEY_EDITOR_TOOL_LABEL 
HOTKEY_EDITOR_TOOL_UNIT 
HOTKEY_EDITOR_TOOL_VILLAGE 
HOTKEY_EDITOR_TOOL_ITEM 
HOTKEY_EDITOR_TOOL_SOUNDSOURCE 
HOTKEY_EDITOR_SELECT_ALL 
HOTKEY_EDITOR_SELECT_INVERSE 
HOTKEY_EDITOR_SELECT_NONE 
HOTKEY_EDITOR_CLIPBOARD_PASTE 
HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW 
HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW 
HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL 
HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL 
HOTKEY_EDITOR_SELECTION_CUT 
HOTKEY_EDITOR_SELECTION_COPY 
HOTKEY_EDITOR_SELECTION_ROTATE 
HOTKEY_EDITOR_SELECTION_FLIP 
HOTKEY_EDITOR_SELECTION_FILL 
HOTKEY_EDITOR_SELECTION_EXPORT 
HOTKEY_EDITOR_SELECTION_GENERATE 
HOTKEY_EDITOR_SELECTION_RANDOMIZE 
HOTKEY_EDITOR_MAP_NEW 
HOTKEY_EDITOR_MAP_LOAD 
HOTKEY_EDITOR_MAP_SAVE 
HOTKEY_EDITOR_MAP_SAVE_AS 
HOTKEY_EDITOR_MAP_SAVE_ALL 
HOTKEY_EDITOR_MAP_REVERT 
HOTKEY_EDITOR_MAP_INFO 
HOTKEY_EDITOR_MAP_CLOSE 
HOTKEY_EDITOR_MAP_SWITCH 
HOTKEY_EDITOR_MAP_RESIZE 
HOTKEY_EDITOR_MAP_ROTATE 
HOTKEY_EDITOR_MAP_GENERATE 
HOTKEY_EDITOR_MAP_APPLY_MASK 
HOTKEY_EDITOR_MAP_CREATE_MASK_TO 
HOTKEY_EDITOR_UPDATE_TRANSITIONS 
HOTKEY_EDITOR_TOGGLE_TRANSITIONS 
HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS 
HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS 
HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS 
HOTKEY_EDITOR_REFRESH 
HOTKEY_EDITOR_REFRESH_IMAGE_CACHE 
HOTKEY_EDITOR_DRAW_COORDINATES 
HOTKEY_EDITOR_DRAW_TERRAIN_CODES 
HOTKEY_EDITOR_SIDE_NEW 
HOTKEY_EDITOR_SIDE_EDIT 
HOTKEY_EDITOR_SIDE_REMOVE 
HOTKEY_EDITOR_AREA_REMOVE 
HOTKEY_EDITOR_AREA_ADD 
HOTKEY_EDITOR_AREA_SAVE 
HOTKEY_EDITOR_AREA_RENAME 
HOTKEY_EDITOR_SCENARIO_EDIT 
HOTKEY_EDITOR_SCENARIO_NEW 
HOTKEY_EDITOR_SCENARIO_SAVE_AS 
HOTKEY_NULL 

Definition at line 38 of file hotkey_command.hpp.

Available hotkey scopes.

The scope is used to allow command from non-overlapping areas of the game share the same key

Enumerator
SCOPE_MAIN_MENU 
SCOPE_GAME 
SCOPE_EDITOR 
SCOPE_COUNT 

Definition at line 31 of file hotkey_command.hpp.

Function Documentation

void hotkey::add_hotkey ( const hotkey_ptr  item)

Add a hotkey to the list of hotkeys.

Parameters
itemThe item to add.

Definition at line 354 of file hotkey_item.cpp.

References hotkey::hotkey_base::bindings_equal(), get_hotkey_command(), and set_active_scopes().

Referenced by gui2::tpreferences::add_hotkey_callback(), add_wml_hotkey(), and load_hotkeys().

void hotkey::add_wml_hotkey ( const std::string id,
const t_string description,
const config default_hotkey 
)

adds a new wml hotkey to the list, but only if there is no hotkey with that id yet on the list.

the object that is created here will be deleted in "delete_all_wml_hotkeys()"

Definition at line 374 of file hotkey_command.cpp.

References add_hotkey(), DBG_G, config::empty(), ERR_CF, has_hotkey_command(), has_hotkey_item(), HOTKEY_WML, load_from_config(), LOG_G, remove_wml_hotkey(), and t_string::size().

Referenced by game_events::wml_menu_item::init_handler(), game_events::wml_menu_item::update(), and game_events::wml_menu_item::wml_menu_item().

void hotkey::clear_hotkey_commands ( )

Definition at line 502 of file hotkey_command.cpp.

Referenced by hotkey::manager::wipe().

void hotkey::clear_hotkeys ( const std::string command)

Unset the command bindings for all hotkeys matching the command.

Parameters
commandThe binding to be unset

Definition at line 375 of file hotkey_item.cpp.

Referenced by gui2::tpreferences::default_hotkey_callback(), gui2::tpreferences::remove_hotkey_callback(), and hotkey::manager::wipe().

void hotkey::clear_hotkeys ( )

Unset the bindings for all hotkeys.

Definition at line 388 of file hotkey_item.cpp.

hotkey_ptr hotkey::create_hotkey ( const std::string id,
SDL_Event &  event 
)

Create a new hotkey item for a command from an SDL_Event.

Parameters
idThe command to bind to.
eventThe SDL_Event to base the creation on.

Definition at line 158 of file hotkey_item.cpp.

References ERR_G, and sdl_get_mods().

Referenced by show_binding_dialog().

void hotkey::deactivate_all_scopes ( )
void hotkey::del_hotkey ( const hotkey_ptr  item)

Remove a hotkey from the list of hotkeys.

Todo:
unusued?

Definition at line 347 of file hotkey_item.cpp.

References schema_validation::remove.

void hotkey::delete_all_wml_hotkeys ( )

deletes all wml hotkeys, should be called after a game has ended

Definition at line 464 of file hotkey_command.cpp.

References HOTKEY_WML.

Referenced by hotkey::manager::wipe(), and play_controller::~play_controller().

static void hotkey::event_execute ( const SDL_Event &  event,
command_executor *  executor 
)
static
void hotkey::execute_command ( const hotkey_command &  command,
command_executor *  executor,
int  index,
bool  press 
)
const std::string & hotkey::get_description ( const std::string command)
const hotkey_ptr hotkey::get_hotkey ( const SDL_Event &  event)

Iterate through the list of hotkeys and return a hotkey that matches the SDL_Event and the current keyboard modifier state.

Parameters
eventThe SDL_Event to use as a template.
Returns
The newly created hotkey item.

Definition at line 393 of file hotkey_item.cpp.

Referenced by gui2::event::thandler::button_down(), event_execute(), gui2::event::thandler::hat_motion(), gui2::event::thandler::key_down(), and wb::manager::print_help_once().

const hotkey_command & hotkey::get_hotkey_command ( const std::string command)
const boost::ptr_vector< hotkey_command > & hotkey::get_hotkey_commands ( )

returns a container that contains all currently active hotkey_commands.

everything that wants a hotkey, must be in this container.

Definition at line 328 of file hotkey_command.cpp.

Referenced by gui2::tpreferences::setup_hotkey_list().

const hotkey_command & hotkey::get_hotkey_null ( )
const hotkey_list & hotkey::get_hotkeys ( )

Returns the list of hotkeys.

Definition at line 433 of file hotkey_item.cpp.

References hotkeys_.

Referenced by gui2::tpreferences::add_hotkey_callback().

HOTKEY_COMMAND hotkey::get_id ( const std::string command)
std::string hotkey::get_names ( std::string  id)

Returns a comma-separated string of hotkey names.

A hotkey name is in the form of "ctrl+l" or "n" or "mouse 1". The comman separated string is of the form "ctrl+l,n,mouse 1".

Returns
The comma separated string of hotkey names.

Definition at line 450 of file hotkey_item.cpp.

References utils::join().

Referenced by gui2::tpreferences::add_hotkey_callback(), hotkey::command_executor::get_menu_images(), theme::menu::menu(), gui2::tpreferences::remove_hotkey_callback(), gui2::tpreferences::setup_hotkey_list(), gui2::tcontrol::signal_handler_show_tooltip(), play_controller::hotkey_handler::toggle_accelerated_speed(), theme::action::tooltip(), and playsingle_controller::hotkey_handler::whiteboard_toggle().

const std::string & hotkey::get_tooltip ( const std::string command)
bool hotkey::has_hotkey_command ( const std::string id)

Definition at line 369 of file hotkey_command.cpp.

References get_hotkey_command(), HOTKEY_NULL, and hotkey::hotkey_command::id.

Referenced by add_wml_hotkey().

bool hotkey::has_hotkey_item ( const std::string command)

Definition at line 325 of file hotkey_item.cpp.

Referenced by add_wml_hotkey().

void hotkey::init_hotkey_commands ( )

Definition at line 488 of file hotkey_command.cpp.

References i.

Referenced by hotkey::manager::init().

bool hotkey::is_scope_active ( hk_scopes  s)

Definition at line 310 of file hotkey_command.cpp.

Referenced by help::description_type(), and hotkey::hotkey_base::matches().

void hotkey::jbutton_event ( const SDL_Event &  event,
command_executor *  executor 
)
void hotkey::jhat_event ( const SDL_Event &  event,
command_executor *  executor 
)

Definition at line 538 of file command_executor.cpp.

References event_execute().

Referenced by controller_base::handle_event().

void hotkey::key_event ( const SDL_Event &  event,
command_executor *  executor 
)
hotkey_ptr hotkey::load_from_config ( const config cfg)

Create and instantiate a hotkey from a config element.

Parameters
cfgThe config element to read for data.
Returns
The new instance of the hotkey item.

Definition at line 191 of file hotkey_item.cpp.

References ERR_G.

Referenced by add_wml_hotkey(), and load_hotkeys().

void hotkey::load_hotkeys ( const config cfg,
bool  set_as_default = false 
)

Iterates through all hotkeys present in the config struct and creates and adds them to the hotkey list.

Parameters
cfgThe config struct to load from.
set_as_defaultIndicates whether the config struct should be treated as the default game settings.

Definition at line 403 of file hotkey_item.cpp.

References add_hotkey(), config::child_range(), and load_from_config().

Referenced by test_utils::game_config_manager::game_config_manager(), game_config_manager::init_game_config(), preferences::load_hotkeys(), and reset_default_hotkeys().

void hotkey::mbutton_event ( const SDL_Event &  event,
command_executor *  executor 
)
bool hotkey::remove_wml_hotkey ( const std::string id)

removes a wml hotkey with the given id, returns true if the deletion was successful

Definition at line 335 of file hotkey_command.cpp.

References get_hotkey_command(), HOTKEY_NULL, HOTKEY_WML, hotkey::hotkey_command::id, itor, and LOG_G.

Referenced by add_wml_hotkey(), game_events::wml_menu_item::finish_handler(), and game_events::wml_menu_item::update().

void hotkey::reset_default_hotkeys ( )

Reset all hotkeys to the defaults.

Definition at line 422 of file hotkey_item.cpp.

References config::empty(), ERR_G, and load_hotkeys().

Referenced by preferences::clear_hotkeys().

void hotkey::save_hotkeys ( config cfg)

Save the non-default hotkeys to the config.

Parameters
cfgThe config to save to.

Definition at line 438 of file hotkey_item.cpp.

References config::add_child(), and config::clear_children().

Referenced by gui2::tpreferences::post_show(), and preferences::save_hotkeys().

static unsigned int hotkey::sdl_get_mods ( )
static

Definition at line 48 of file hotkey_item.cpp.

Referenced by create_hotkey(), and hotkey::hotkey_base::matches().

void hotkey::set_active_scopes ( hk_scopes  s)

Definition at line 305 of file hotkey_command.cpp.

Referenced by add_hotkey(), and gui2::tpreferences::add_hotkey_callback().

void hotkey::set_scope_active ( scope  s,
bool  set 
)
hotkey::hotkey_ptr hotkey::show_binding_dialog ( CVideo video,
const std::string id 
)

Variable Documentation

config hotkey::default_hotkey_cfg_

Definition at line 46 of file hotkey_item.cpp.

hotkey_list hotkey::hotkeys_

Definition at line 45 of file hotkey_item.cpp.

Referenced by get_hotkeys().