| 
    KiCad PCB EDA Suite
    
   | 
 
Manage TOOL_ACTION objects. More...
#include <action_manager.h>
Public Member Functions | |
| ACTION_MANAGER (TOOL_MANAGER *aToolManager) | |
| ~ACTION_MANAGER () | |
| Unregister every registered action.   | |
| void | RegisterAction (TOOL_ACTION *aAction) | 
| Add a tool action to the manager and sets it up.   | |
| const std::map< std::string, TOOL_ACTION * > & | GetActions () const | 
| Get a list of currently-registered actions mapped by their name.   | |
| bool | IsActionUIId (int aId) const | 
| Test if a UI ID corresponds to an action ID in our system.   | |
| TOOL_ACTION * | FindAction (const std::string &aActionName) const | 
| Find an action with a given name (if there is one available).   | |
| bool | RunHotKey (int aHotKey) const | 
| Run an action associated with a hotkey (if there is one available).   | |
| int | GetHotKey (const TOOL_ACTION &aAction) const | 
| Return the hot key associated with a given action or 0 if there is none.   | |
| void | UpdateHotKeys (bool aFullUpdate) | 
| Optionally read the hotkey config files and then rebuilds the internal hotkey maps.   | |
| void | SetConditions (const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions) | 
| Set the conditions the UI elements for activating a specific tool action should use for determining the current UI state (e.g.   | |
| const ACTION_CONDITIONS * | GetCondition (const TOOL_ACTION &aAction) const | 
| Get the conditions to use for a specific tool action.   | |
Static Public Member Functions | |
| static int | MakeActionId (const std::string &aActionName) | 
| Generate an unique ID from for an action with given name.   | |
| static std::list< TOOL_ACTION * > & | GetActionList () | 
| Return list of TOOL_ACTIONs.   | |
Private Types | |
| typedef std::map< int, std::list< TOOL_ACTION * > > | HOTKEY_LIST | 
Private Member Functions | |
| void | processHotKey (TOOL_ACTION *aAction, const std::map< std::string, int > &aLegacyMap, const std::map< std::string, std::pair< int, int > > &aHotKeyMap) | 
| Tool manager needed to run actions.   | |
Private Attributes | |
| TOOL_MANAGER * | m_toolMgr | 
| Map for indexing actions by their names.   | |
| std::map< std::string, TOOL_ACTION * > | m_actionNameIndex | 
| Map for recording actions that have custom UI IDs.   | |
| std::map< int, TOOL_ACTION * > | m_customUIIdIndex | 
| Map for indexing actions by their hotkeys.   | |
| HOTKEY_LIST | m_actionHotKeys | 
| Quick action<->hot key lookup.   | |
| std::map< int, int > | m_hotkeys | 
| std::map< int, ACTION_CONDITIONS > | m_uiConditions | 
| Map the command ID that wx uses for the action to the UI conditions for the menu/toolbar items.   | |
Manage TOOL_ACTION objects.
Registering them and allows one to run them using associated hot keys, names or ids.
Definition at line 85 of file action_manager.h.
      
  | 
  private | 
Definition at line 196 of file action_manager.h.
| ACTION_MANAGER::ACTION_MANAGER | ( | TOOL_MANAGER * | aToolManager | ) | 
| aToolManager | is a tool manager instance that is used to pass events to tools. | 
Definition at line 37 of file action_manager.cpp.
References GetActionList(), group, kicadTraceToolStack, m_toolMgr, MakeActionId(), and RegisterAction().
| ACTION_MANAGER::~ACTION_MANAGER | ( | ) | 
Unregister every registered action.
Definition at line 70 of file action_manager.cpp.
| TOOL_ACTION * ACTION_MANAGER::FindAction | ( | const std::string & | aActionName | ) | const | 
Find an action with a given name (if there is one available).
| aActionName | is the searched action. | 
Definition at line 132 of file action_manager.cpp.
References m_actionNameIndex.
Referenced by TOOLS_HOLDER::ShowChangedLanguage().
      
  | 
  inlinestatic | 
Return list of TOOL_ACTIONs.
#TOOL_ACTIONs add themselves to the list upon their creation.
Definition at line 156 of file action_manager.h.
Referenced by ACTION_MANAGER(), PCB::IFACE::CreateKiWindow(), NL_3D_VIEWER_PLUGIN_IMPL::exportCommandsAndImages(), NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL::exportCommandsAndImages(), NL_GERBVIEW_PLUGIN_IMPL::exportCommandsAndImages(), NL_PCBNEW_PLUGIN_IMPL::exportCommandsAndImages(), NL_PL_EDITOR_PLUGIN_IMPL::exportCommandsAndImages(), NL_SCHEMATIC_PLUGIN_IMPL::exportCommandsAndImages(), KIFACE_BASE::GetActions(), KIWAY::GetActions(), SaveFileAs(), NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand(), NL_GERBVIEW_PLUGIN_IMPL::SetActiveCommand(), NL_PCBNEW_PLUGIN_IMPL::SetActiveCommand(), NL_PL_EDITOR_PLUGIN_IMPL::SetActiveCommand(), NL_SCHEMATIC_PLUGIN_IMPL::SetActiveCommand(), TOOL_ACTION::TOOL_ACTION(), TOOL_ACTION::TOOL_ACTION(), and TOOL_ACTION::~TOOL_ACTION().
| const std::map< std::string, TOOL_ACTION * > & ACTION_MANAGER::GetActions | ( | ) | const | 
Get a list of currently-registered actions mapped by their name.
Definition at line 268 of file action_manager.cpp.
References m_actionNameIndex.
Referenced by DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), and EDA_BASE_FRAME::ShowPreferences().
| const ACTION_CONDITIONS * ACTION_MANAGER::GetCondition | ( | const TOOL_ACTION & | aAction | ) | const | 
Get the conditions to use for a specific tool action.
| aAction | is the tool action. | 
Definition at line 112 of file action_manager.cpp.
References TOOL_ACTION::GetId(), and m_uiConditions.
Referenced by RunHotKey(), NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand(), NL_GERBVIEW_PLUGIN_IMPL::SetActiveCommand(), NL_PCBNEW_PLUGIN_IMPL::SetActiveCommand(), NL_PL_EDITOR_PLUGIN_IMPL::SetActiveCommand(), and NL_SCHEMATIC_PLUGIN_IMPL::SetActiveCommand().
| int ACTION_MANAGER::GetHotKey | ( | const TOOL_ACTION & | aAction | ) | const | 
Return the hot key associated with a given action or 0 if there is none.
| aAction | is the queried action. | 
Definition at line 274 of file action_manager.cpp.
References TOOL_ACTION::GetId(), and m_hotkeys.
| bool ACTION_MANAGER::IsActionUIId | ( | int | aId | ) | const | 
Test if a UI ID corresponds to an action ID in our system.
Definition at line 255 of file action_manager.cpp.
References TOOL_ACTION::GetBaseUIId(), and m_customUIIdIndex.
Referenced by ACTION_MENU::OnMenuEvent().
      
  | 
  static | 
Generate an unique ID from for an action with given name.
Definition at line 124 of file action_manager.cpp.
Referenced by ACTION_GROUP::ACTION_GROUP(), ACTION_GROUP::ACTION_GROUP(), and ACTION_MANAGER().
      
  | 
  private | 
Tool manager needed to run actions.
Definition at line 324 of file action_manager.cpp.
References TOOL_ACTION::m_defaultHotKey, TOOL_ACTION::m_hotKey, TOOL_ACTION::m_legacyName, TOOL_ACTION::m_name, and TOOL_ACTION::SetHotKey().
Referenced by UpdateHotKeys().
| void ACTION_MANAGER::RegisterAction | ( | TOOL_ACTION * | aAction | ) | 
Add a tool action to the manager and sets it up.
After that it is possible to invoke the action using hotkeys or sending a command event with its name.
| aAction | action to be added. Ownership is not transferred. | 
Definition at line 75 of file action_manager.cpp.
References TOOL_ACTION::GetName(), TOOL_ACTION::GetUIId(), TOOL_ACTION::HasCustomUIId(), m_actionNameIndex, m_customUIIdIndex, and TOOL_ACTION::m_name.
Referenced by ACTION_MANAGER().
| bool ACTION_MANAGER::RunHotKey | ( | int | aHotKey | ) | const | 
Run an action associated with a hotkey (if there is one available).
| aHotKey | is the hotkey to be handled. | 
Definition at line 143 of file action_manager.cpp.
References AS_GLOBAL, GetCondition(), TOOL_BASE::GetId(), TOOL_ACTION::GetName(), KeyNameFromKeyCode(), kicadTraceToolStack, m_actionHotKeys, m_toolMgr, MD_MODIFIER_MASK, and MD_SHIFT.
| void ACTION_MANAGER::SetConditions | ( | const TOOL_ACTION & | aAction, | 
| const ACTION_CONDITIONS & | aConditions ) | 
Set the conditions the UI elements for activating a specific tool action should use for determining the current UI state (e.g.
checked, enabled, shown)
| aAction | is the tool action using these conditions. | 
| aConditions | are the conditions to use for the action. | 
Definition at line 92 of file action_manager.cpp.
References TOOL_ACTION::GetId(), TOOL_ACTION::GetName(), kicadTraceToolStack, m_toolMgr, and m_uiConditions.
Referenced by ROUTER_TOOL::Init(), CVPCB_MAINFRAME::setupUIConditions(), DISPLAY_FOOTPRINTS_FRAME::setupUIConditions(), EDA_3D_VIEWER_FRAME::setupUIConditions(), FOOTPRINT_CHOOSER_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), FOOTPRINT_VIEWER_FRAME::setupUIConditions(), GERBVIEW_FRAME::setupUIConditions(), KICAD_MANAGER_FRAME::setupUIConditions(), PCB_EDIT_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), SIMULATOR_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), and SYMBOL_VIEWER_FRAME::setupUIConditions().
| void ACTION_MANAGER::UpdateHotKeys | ( | bool | aFullUpdate | ) | 
Optionally read the hotkey config files and then rebuilds the internal hotkey maps.
Definition at line 285 of file action_manager.cpp.
References TOOL_ACTION::GetHotKey(), TOOL_ACTION::GetHotKeyAlt(), TOOL_ACTION::GetId(), m_actionHotKeys, m_actionNameIndex, m_hotkeys, m_toolMgr, processHotKey(), ReadHotKeyConfig(), and ReadLegacyHotkeyConfig().
Referenced by TOOLS_HOLDER::CommonSettingsChanged().
      
  | 
  private | 
Quick action<->hot key lookup.
Definition at line 197 of file action_manager.h.
Referenced by RunHotKey(), and UpdateHotKeys().
      
  | 
  private | 
Map for recording actions that have custom UI IDs.
Definition at line 190 of file action_manager.h.
Referenced by FindAction(), GetActions(), RegisterAction(), and UpdateHotKeys().
      
  | 
  private | 
Map for indexing actions by their hotkeys.
Definition at line 193 of file action_manager.h.
Referenced by IsActionUIId(), and RegisterAction().
      
  | 
  private | 
Definition at line 200 of file action_manager.h.
Referenced by GetHotKey(), and UpdateHotKeys().
      
  | 
  private | 
Map for indexing actions by their names.
Definition at line 187 of file action_manager.h.
Referenced by ACTION_MANAGER(), RunHotKey(), SetConditions(), and UpdateHotKeys().
      
  | 
  private | 
Map the command ID that wx uses for the action to the UI conditions for the menu/toolbar items.
Definition at line 204 of file action_manager.h.
Referenced by GetCondition(), and SetConditions().