Classes | Enumerations | Functions | Variables

hotkey Namespace Reference

Keyboard shortcuts for game actions. More...

Classes

class  hotkey_item
class  manager
class  scope_changer
class  command_executor
struct  basic_handler

Enumerations

enum  scope { SCOPE_GENERAL, 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_UNIT_DESCRIPTION, HOTKEY_RENAME_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_PREFERENCES, HOTKEY_OBJECTIVES, HOTKEY_UNIT_LIST, HOTKEY_STATISTICS,
  HOTKEY_STOP_NETWORK, HOTKEY_START_NETWORK, HOTKEY_QUIT_GAME, 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_PLAY_REPLAY, HOTKEY_RESET_REPLAY, HOTKEY_STOP_REPLAY,
  HOTKEY_REPLAY_NEXT_TURN, HOTKEY_REPLAY_NEXT_SIDE, HOTKEY_REPLAY_SHOW_EVERYTHING, HOTKEY_REPLAY_SHOW_EACH,
  HOTKEY_REPLAY_SHOW_TEAM1, HOTKEY_REPLAY_SKIP_ANIMATION, HOTKEY_ANIMATE_MAP, HOTKEY_LEFT_MOUSE_CLICK,
  HOTKEY_RIGHT_MOUSE_CLICK, 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_EDITOR_QUIT_TO_DESKTOP, HOTKEY_EDITOR_CLOSE_MAP,
  HOTKEY_EDITOR_SWITCH_MAP, HOTKEY_EDITOR_SETTINGS, HOTKEY_EDITOR_PARTIAL_UNDO, 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_PALETTE_ITEM_SWAP, HOTKEY_EDITOR_PALETTE_GROUPS,
  HOTKEY_EDITOR_PALETTE_UPSCROLL, HOTKEY_EDITOR_PALETTE_DOWNSCROLL, 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_BRUSH_NEXT, HOTKEY_EDITOR_BRUSH_DEFAULT, HOTKEY_EDITOR_CUT,
  HOTKEY_EDITOR_COPY, HOTKEY_EDITOR_PASTE, HOTKEY_EDITOR_EXPORT_SELECTION_COORDS, HOTKEY_EDITOR_SELECT_ALL,
  HOTKEY_EDITOR_SELECT_INVERSE, HOTKEY_EDITOR_SELECT_NONE, HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW, HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW,
  HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL, HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL, HOTKEY_EDITOR_SELECTION_ROTATE, HOTKEY_EDITOR_SELECTION_FLIP,
  HOTKEY_EDITOR_SELECTION_FILL, HOTKEY_EDITOR_SELECTION_GENERATE, HOTKEY_EDITOR_SELECTION_RANDOMIZE, 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_REFRESH, HOTKEY_EDITOR_UPDATE_TRANSITIONS, HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS, HOTKEY_EDITOR_REFRESH_IMAGE_CACHE,
  HOTKEY_EDITOR_DRAW_COORDINATES, HOTKEY_EDITOR_DRAW_TERRAIN_CODES, HOTKEY_USER_CMD, HOTKEY_CUSTOM_CMD,
  HOTKEY_AI_FORMULA, HOTKEY_CLEAR_MSG, 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__EDITOR, TITLE_SCREEN__CREDITS, GLOBAL__HELPTIP,
  HOTKEY_NULL
}
enum  ACTION_STATE { ACTION_STATELESS, ACTION_ON, ACTION_OFF }

Functions

void deactivate_all_scopes ()
void set_scope_active (scope s, bool set)
bool is_scope_active (scope s)
static void key_event_execute (display &disp, const SDL_KeyboardEvent &event, command_executor *executor)
static void button_event_execute (display &disp, const SDL_JoyButtonEvent &event, command_executor *executor)
static void hat_event_execute (display &disp, const SDL_JoyHatEvent &event, command_executor *executor)
void load_descriptions ()
void set_hotkey_tag_name (const std::string &name)
void load_hotkeys (const config &cfg, bool set_as_default)
void reset_default_hotkeys ()
void save_hotkeys (config &cfg)
hotkey_itemget_hotkey (HOTKEY_COMMAND id)
hotkey_itemget_hotkey (const std::string &command)
HOTKEY_COMMAND get_hotkey_command (const std::string &command)
hotkey_itemget_hotkey (int joy_num, int button_num)
hotkey_itemget_hotkey (int joy_num, int hat_num, int hat_value)
hotkey_itemget_hotkey (int character, int keycode, bool shift, bool ctrl, bool alt, bool cmd)
hotkey_itemget_hotkey (const SDL_JoyButtonEvent &event)
hotkey_itemget_hotkey (const SDL_JoyHatEvent &event)
hotkey_itemget_hotkey (const SDL_KeyboardEvent &event)
static void _get_visible_hotkey_itor (int index, std::vector< hotkey_item >::iterator &itor)
hotkey_itemget_visible_hotkey (int index)
std::vector< hotkey_item > & get_hotkeys ()
void button_event (display &disp, const SDL_JoyButtonEvent &event, command_executor *executor)
void hat_event (display &disp, const SDL_JoyHatEvent &event, command_executor *executor)
void key_event (display &disp, const SDL_KeyboardEvent &event, command_executor *executor)
void execute_command (display &disp, HOTKEY_COMMAND command, command_executor *executor, int index)

Variables

const std::string CLEARED_TEXT = "__none__"

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.


Enumeration Type Documentation

Enumerator:
ACTION_STATELESS 
ACTION_ON 
ACTION_OFF 

Definition at line 279 of file hotkeys.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_UNIT_DESCRIPTION 
HOTKEY_RENAME_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_PREFERENCES 
HOTKEY_OBJECTIVES 
HOTKEY_UNIT_LIST 
HOTKEY_STATISTICS 
HOTKEY_STOP_NETWORK 
HOTKEY_START_NETWORK 
HOTKEY_QUIT_GAME 
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 
HOTKE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OOL_UNIT 
HOTKEY_EDITOR_BRUSH_NEXT 
HOTKEY_EDITOR_BRUSH_DEFAULT 
HOTKEY_EDITOR_CUT 
HOTKEY_EDITOR_COPY 
HOTKEY_EDITOR_PASTE 
HOTKEY_EDITOR_EXPORT_SELECTION_COORDS 
HOTKEY_EDITOR_SELECT_ALL 
HOTKEY_EDITOR_SELECT_INVERSE 
HOTKEY_EDITOR_SELECT_NONE 
HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW 
HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW 
HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL 
HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL 
HOTKEY_EDITOR_SELECTION_ROTATE 
HOTKEY_EDITOR_SELECTION_FLIP 
HOTKEY_EDITOR_SELECTION_FILL 
HOTKEY_EDITOR_SELECTION_GENERATE 
HOTKEY_EDITOR_SELECTION_RANDOMIZE 
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_REFRESH 
HOTKEY_EDITOR_UPDATE_TRANSITIONS 
HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS 
HOTKEY_EDITOR_REFRESH_IMAGE_CACHE 
HOTKEY_EDITOR_DRAW_COORDINATES 
HOTKEY_EDITOR_DRAW_TERRAIN_CODES 
HOTKEY_USER_CMD 
HOTKEY_CUSTOM_CMD 
HOTKEY_AI_FORMULA 
HOTKEY_CLEAR_MSG 
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__EDITOR 
TITLE_SCREEN__CREDITS 
GLOBAL__HELPTIP 
HOTKEY_NULL 

Definition at line 40 of file hotkeys.hpp.

Available hotkey scopes.

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

Enumerator:
SCOPE_GENERAL 
SCOPE_GAME 
SCOPE_EDITOR 
SCOPE_COUNT 

Definition at line 32 of file hotkeys.hpp.


Function Documentation

static void hotkey::_get_visible_hotkey_itor ( int  index,
std::vector< hotkey_item >::iterator &  itor 
) [static]

Definition at line 843 of file hotkeys.cpp.

void hotkey::button_event ( display disp,
const SDL_JoyButtonEvent &  event,
command_executor *  executor 
)

Referenced by controller_base::handle_event().

Here is the caller graph for this function:

void hotkey::button_event_execute ( display disp,
const SDL_JoyButtonEvent &  event,
command_executor *  executor 
) [static]

Definition at line 917 of file hotkeys.cpp.

References execute_command(), get_hotkey(), hotkey::hotkey_item::get_id(), and hotkey::hotkey_item::null().

Referenced by hotkey::basic_handler::handle_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void hotkey::deactivate_all_scopes (  ) 
void hotkey::execute_command ( display disp,
HOTKEY_COMMAND  command,
command_executor *  executor,
int  index 
)

Referenced by button_event_execute(), hat_event_execute(), and key_event_execute().

Here is the caller graph for this function:

hotkey_item & hotkey::get_hotkey ( int  joy_num,
int  hat_num,
int  hat_value 
)
hotkey_item & hotkey::get_hotkey ( int  character,
int  keycode,
bool  shift,
bool  ctrl,
bool  alt,
bool  cmd 
)
hotkey_item & hotkey::get_hotkey ( const SDL_JoyButtonEvent &  event  ) 
hotkey_item & hotkey::get_hotkey ( const SDL_JoyHatEvent &  event  ) 
hotkey_item & hotkey::get_hotkey ( const SDL_KeyboardEvent &  event  ) 
hotkey_item & hotkey::get_hotkey ( const std::string &  command  ) 
hotkey_item & hotkey::get_hotkey ( HOTKEY_COMMAND  id  ) 
hotkey_item & hotkey::get_hotkey ( int  joy_num,
int  button_num 
)
HOTKEY_COMMAND hotkey::get_hotkey_command ( const std::string &  command  ) 
std::vector< hotkey_item > & hotkey::get_hotkeys (  ) 
hotkey_item & hotkey::get_visible_hotkey ( int  index  ) 
void hotkey::hat_event ( display disp,
const SDL_JoyHatEvent &  event,
command_executor *  executor 
)

Referenced by controller_base::handle_event().

Here is the caller graph for this function:

void hotkey::hat_event_execute ( display disp,
const SDL_JoyHatEvent &  event,
command_executor *  executor 
) [static]

Definition at line 935 of file hotkeys.cpp.

References execute_command(), get_hotkey(), hotkey::hotkey_item::get_id(), and hotkey::hotkey_item::null().

Here is the call graph for this function:

bool hotkey::is_scope_active ( scope  s  ) 

Referenced by hotkey::hotkey_item::is_in_active_scope().

Here is the caller graph for this function:

void hotkey::key_event ( display disp,
const SDL_KeyboardEvent &  event,
command_executor *  executor 
)

Referenced by hotkey::basic_handler::handle_event(), and controller_base::handle_event().

Here is the caller graph for this function:

void hotkey::key_event_execute ( display disp,
const SDL_KeyboardEvent &  event,
command_executor *  executor 
) [static]

Definition at line 954 of file hotkeys.cpp.

References execute_command(), get_hotkey(), hotkey::hotkey_item::get_id(), and hotkey::hotkey_item::null().

Referenced by hotkey::basic_handler::handle_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void hotkey::load_descriptions (  ) 
void hotkey::load_hotkeys ( const config cfg,
bool  set_as_default 
)
void hotkey::reset_default_hotkeys (  ) 
void hotkey::save_hotkeys ( config cfg  ) 
void hotkey::set_hotkey_tag_name ( const std::string &  name  ) 

Referenced by hotkey::scope_changer::scope_changer(), and hotkey::scope_changer::~scope_changer().

Here is the caller graph for this function:

void hotkey::set_scope_active ( scope  s,
bool  set 
)

Variable Documentation

const std::string hotkey::CLEARED_TEXT = "__none__"

Definition at line 333 of file hotkeys.cpp.

Referenced by hotkey::hotkey_item::load_from_config().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:23:57 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs