Hot keys settings are synchronized between GAL & legacy
This commit is contained in:
parent
99e5228948
commit
da75c52665
|
@ -350,6 +350,15 @@ bool EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
return false;
|
||||
}
|
||||
|
||||
int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName )
|
||||
{
|
||||
int result = EDA_BASE_FRAME::WriteHotkeyConfig( aDescList, aFullFileName );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
GetToolManager()->UpdateHotKeys();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <macros.h>
|
||||
#include <dialog_hotkeys_editor.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
#include <wx/apptrait.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
@ -482,6 +483,20 @@ EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList )
|
|||
}
|
||||
|
||||
|
||||
EDA_HOTKEY* GetDescriptorFromCommand( int aCommand, EDA_HOTKEY** aList )
|
||||
{
|
||||
for( ; *aList != NULL; aList++ )
|
||||
{
|
||||
EDA_HOTKEY* hk_decr = *aList;
|
||||
|
||||
if( hk_decr->m_Idcommand == aCommand )
|
||||
return hk_decr;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
||||
wxString* aFullFileName )
|
||||
{
|
||||
|
|
|
@ -24,9 +24,12 @@
|
|||
|
||||
#include <tool/action_manager.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_action.h>
|
||||
#include <draw_frame.h>
|
||||
|
||||
#include <hotkeys_basic.h>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
#include <cassert>
|
||||
|
||||
ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) :
|
||||
|
@ -61,18 +64,6 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
|
|||
|
||||
m_actionNameIndex[aAction->m_name] = aAction;
|
||||
m_actionIdIndex[aAction->m_id] = aAction;
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Check if there are two global actions assigned to the same hotkey
|
||||
if( aAction->GetScope() == AS_GLOBAL )
|
||||
{
|
||||
BOOST_FOREACH( const TOOL_ACTION* action, m_actionHotKeys[aAction->m_currentHotKey] )
|
||||
assert( action->GetScope() != AS_GLOBAL );
|
||||
}
|
||||
#endif /* not NDEBUG */
|
||||
|
||||
if( aAction->HasHotKey() )
|
||||
m_actionHotKeys[aAction->m_currentHotKey].push_back( aAction );
|
||||
}
|
||||
|
||||
|
||||
|
@ -181,3 +172,86 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ACTION_MANAGER::UpdateHotKeys()
|
||||
{
|
||||
m_actionHotKeys.clear();
|
||||
std::list<TOOL_ACTION*>& actions = GetActionList();
|
||||
|
||||
for( std::list<TOOL_ACTION*>::iterator it = actions.begin(); it != actions.end(); ++it )
|
||||
{
|
||||
TOOL_ACTION* aAction = *it;
|
||||
|
||||
int hotkey = processHotKey( aAction, true );
|
||||
|
||||
if( hotkey > 0 )
|
||||
m_actionHotKeys[hotkey].push_back( aAction );
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Check if there are two global actions assigned to the same hotkey
|
||||
BOOST_FOREACH( std::list<TOOL_ACTION*>& action_list, m_actionHotKeys | boost::adaptors::map_values )
|
||||
{
|
||||
int global_actions_cnt = 0;
|
||||
|
||||
BOOST_FOREACH( TOOL_ACTION* action, action_list )
|
||||
{
|
||||
if( action->GetScope() == AS_GLOBAL )
|
||||
++global_actions_cnt;
|
||||
}
|
||||
|
||||
assert( global_actions_cnt <= 1 );
|
||||
}
|
||||
#endif /* not NDEBUG */
|
||||
}
|
||||
|
||||
|
||||
int ACTION_MANAGER::processHotKey( TOOL_ACTION* aAction, bool aForceUpdate )
|
||||
{
|
||||
int hotkey = 0;
|
||||
|
||||
if( aForceUpdate )
|
||||
hotkey = aAction->getDefaultHotKey();
|
||||
else
|
||||
hotkey = aAction->GetHotKey();
|
||||
|
||||
if( ( hotkey & TOOL_ACTION::LEGACY_HK ) )
|
||||
{
|
||||
hotkey = hotkey & ~TOOL_ACTION::LEGACY_HK; // it leaves only HK_xxx identifier
|
||||
EDA_DRAW_FRAME* frame = static_cast<EDA_DRAW_FRAME*>( m_toolMgr->GetEditFrame() );
|
||||
EDA_HOTKEY* hk_desc = frame->GetHotKeyDescription( hotkey );
|
||||
|
||||
if( hk_desc )
|
||||
{
|
||||
hotkey = hk_desc->m_KeyCode;
|
||||
|
||||
// Convert modifiers to the ones used by the Tool Framework
|
||||
if( hotkey & GR_KB_CTRL )
|
||||
{
|
||||
hotkey &= ~GR_KB_CTRL;
|
||||
hotkey |= MD_CTRL;
|
||||
}
|
||||
|
||||
if( hotkey & GR_KB_ALT )
|
||||
{
|
||||
hotkey &= ~GR_KB_ALT;
|
||||
hotkey |= MD_ALT;
|
||||
}
|
||||
|
||||
if( hotkey & GR_KB_SHIFT )
|
||||
{
|
||||
hotkey &= ~GR_KB_SHIFT;
|
||||
hotkey |= MD_SHIFT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hotkey = 0;
|
||||
}
|
||||
|
||||
aAction->setHotKey( hotkey );
|
||||
}
|
||||
|
||||
return hotkey;
|
||||
}
|
||||
|
|
|
@ -114,33 +114,15 @@ wxMenuItem* CONTEXT_MENU::Add( const wxString& aLabel, int aId, const BITMAP_OPA
|
|||
wxMenuItem* CONTEXT_MENU::Add( const TOOL_ACTION& aAction )
|
||||
{
|
||||
/// ID numbers for tool actions need to have a value higher than ACTION_ID
|
||||
int id = ACTION_ID + aAction.GetId();
|
||||
const BITMAP_OPAQUE* icon = aAction.GetIcon();
|
||||
|
||||
wxMenuItem* item = new wxMenuItem( this, id, aAction.GetMenuItem(),
|
||||
wxMenuItem* item = new wxMenuItem( this, getMenuId( aAction ), aAction.GetMenuItem(),
|
||||
aAction.GetDescription(), wxITEM_NORMAL );
|
||||
|
||||
if( icon )
|
||||
item->SetBitmap( KiBitmap( icon ) );
|
||||
|
||||
if( aAction.HasHotKey() )
|
||||
{
|
||||
int key = aAction.GetHotKey() & ~MD_MODIFIER_MASK;
|
||||
int mod = aAction.GetHotKey() & MD_MODIFIER_MASK;
|
||||
int flags = wxACCEL_NORMAL;
|
||||
|
||||
switch( mod )
|
||||
{
|
||||
case MD_ALT: flags = wxACCEL_ALT; break;
|
||||
case MD_CTRL: flags = wxACCEL_CTRL; break;
|
||||
case MD_SHIFT: flags = wxACCEL_SHIFT; break;
|
||||
}
|
||||
|
||||
wxAcceleratorEntry accel( flags, key, id, item );
|
||||
item->SetAccel( &accel );
|
||||
}
|
||||
|
||||
m_toolActions[id] = &aAction;
|
||||
m_toolActions[getMenuId( aAction )] = &aAction;
|
||||
|
||||
return Append( item );
|
||||
}
|
||||
|
@ -198,11 +180,44 @@ void CONTEXT_MENU::Clear()
|
|||
void CONTEXT_MENU::UpdateAll()
|
||||
{
|
||||
m_update_handler();
|
||||
updateHotKeys();
|
||||
|
||||
runOnSubmenus( boost::bind( &CONTEXT_MENU::UpdateAll, _1 ) );
|
||||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::updateHotKeys()
|
||||
{
|
||||
for( std::map<int, const TOOL_ACTION*>::const_iterator it = m_toolActions.begin();
|
||||
it != m_toolActions.end(); ++it )
|
||||
{
|
||||
int id = it->first;
|
||||
const TOOL_ACTION& action = *it->second;
|
||||
|
||||
if( action.HasHotKey() )
|
||||
{
|
||||
int key = action.GetHotKey() & ~MD_MODIFIER_MASK;
|
||||
int mod = action.GetHotKey() & MD_MODIFIER_MASK;
|
||||
int flags = wxACCEL_NORMAL;
|
||||
wxMenuItem* item = FindChildItem( id );
|
||||
|
||||
if( item )
|
||||
{
|
||||
switch( mod )
|
||||
{
|
||||
case MD_ALT: flags = wxACCEL_ALT; break;
|
||||
case MD_CTRL: flags = wxACCEL_CTRL; break;
|
||||
case MD_SHIFT: flags = wxACCEL_SHIFT; break;
|
||||
}
|
||||
|
||||
wxAcceleratorEntry accel( flags, key, id, item );
|
||||
item->SetAccel( &accel );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
|
||||
{
|
||||
OPT_TOOL_EVENT evt;
|
||||
|
|
|
@ -332,6 +332,12 @@ void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aPara
|
|||
}
|
||||
|
||||
|
||||
void TOOL_MANAGER::UpdateHotKeys()
|
||||
{
|
||||
m_actionMgr->UpdateHotKeys();
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_MANAGER::invokeTool( TOOL_BASE* aTool )
|
||||
{
|
||||
wxASSERT( aTool != NULL );
|
||||
|
@ -723,6 +729,7 @@ void TOOL_MANAGER::SetEnvironment( EDA_ITEM* aModel, KIGFX::VIEW* aView,
|
|||
m_view = aView;
|
||||
m_viewControls = aViewControls;
|
||||
m_editFrame = aFrame;
|
||||
m_actionMgr->UpdateHotKeys();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -96,6 +96,9 @@ public:
|
|||
void InstallOptionsDisplay( wxCommandEvent& event );
|
||||
MODULE* Get_Module( const wxString& CmpName );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const { return NULL; }
|
||||
|
||||
void Process_Settings( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
|
|
|
@ -353,6 +353,18 @@ struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[] =
|
|||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
EDA_HOTKEY* SCH_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||
{
|
||||
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
||||
|
||||
if( HK_Descr == NULL )
|
||||
HK_Descr = GetDescriptorFromCommand( aCommand, schematic_Hotkey_List );
|
||||
|
||||
return HK_Descr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Hot keys. Some commands are relative to the item under the mouse cursor
|
||||
* Commands are case insensitive
|
||||
|
@ -581,6 +593,17 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
}
|
||||
|
||||
|
||||
EDA_HOTKEY* LIB_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||
{
|
||||
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
||||
|
||||
if( HK_Descr == NULL )
|
||||
HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
|
||||
|
||||
return HK_Descr;
|
||||
}
|
||||
|
||||
|
||||
bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
|
||||
{
|
||||
if( aHotKey == 0 )
|
||||
|
@ -749,6 +772,18 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
EDA_HOTKEY* LIB_VIEW_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||
{
|
||||
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
||||
|
||||
if( HK_Descr == NULL )
|
||||
HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
|
||||
|
||||
return HK_Descr;
|
||||
}
|
||||
|
||||
|
||||
bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||
EDA_ITEM* aItem )
|
||||
{
|
||||
|
|
|
@ -337,6 +337,9 @@ public:
|
|||
double BestZoom(); // Returns the best zoom
|
||||
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
|
||||
|
||||
bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
|
||||
|
||||
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
|
||||
|
|
|
@ -357,6 +357,10 @@ public:
|
|||
void ReCreateVToolbar();
|
||||
void ReCreateOptToolbar();
|
||||
void ReCreateMenuBar();
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
|
||||
|
||||
bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,6 +96,9 @@ public:
|
|||
|
||||
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
|
||||
|
||||
/**
|
||||
* Function OnHotKey
|
||||
* handle hot key events.
|
||||
|
|
|
@ -515,6 +515,9 @@ public:
|
|||
*/
|
||||
void OnQuit( wxCommandEvent& event );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
|
||||
|
||||
/**
|
||||
* Function OnHotKey.
|
||||
* ** Commands are case insensitive **
|
||||
|
|
|
@ -102,6 +102,14 @@ struct EDA_HOTKEY_CONFIG GerbviewHokeysDescr[] =
|
|||
};
|
||||
|
||||
|
||||
EDA_HOTKEY* GERBVIEW_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||
{
|
||||
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, gerbviewHotkeyList );
|
||||
|
||||
return HK_Descr;
|
||||
}
|
||||
|
||||
|
||||
bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem )
|
||||
{
|
||||
#define CHANGE( x ) ( x ) = not (x )
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <kiway_player.h>
|
||||
|
||||
class wxSingleInstanceChecker;
|
||||
|
||||
class EDA_HOTKEY;
|
||||
|
||||
/**
|
||||
* Class EDA_DRAW_FRAME
|
||||
|
@ -324,6 +324,18 @@ public:
|
|||
*/
|
||||
void SkipNextLeftButtonReleaseEvent();
|
||||
|
||||
///> @copydoc EDA_BASE_FRAME::WriteHotkeyConfig
|
||||
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL );
|
||||
|
||||
/**
|
||||
* Function GetHotKeyDescription
|
||||
* Searches lists of hot key identifiers (HK_xxx) used in the frame to find a matching
|
||||
* hot key descriptor.
|
||||
* @param aCommand is the hot key identifier.
|
||||
* @return Hot key descriptor or NULL if none found.
|
||||
*/
|
||||
virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
|
||||
|
||||
virtual bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||
EDA_ITEM* aItem = NULL );
|
||||
|
||||
|
|
|
@ -196,12 +196,21 @@ void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aList
|
|||
|
||||
/**
|
||||
* Function GetDescriptorFromHotkey
|
||||
* Return a EDA_HOTKEY * pointer from a key code for OnHotKey() function
|
||||
* Returns a EDA_HOTKEY* pointer from a key code for OnHotKey() function
|
||||
* @param aKey = key code (ascii value, or wxWidgets value for function keys
|
||||
* @param aList = pointer to a EDA_HOTKEY list of commands
|
||||
* @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
|
||||
*/
|
||||
EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList );
|
||||
EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList );
|
||||
|
||||
/**
|
||||
* Function GetDescriptorFromCommand
|
||||
* Returns a EDA_HOTKEY* pointer from a hot key identifier.
|
||||
* @param aCommand = hot key identifier (@see hotkeys.h)
|
||||
* @param aList = pointer to a EDA_HOTKEY list of commands
|
||||
* @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
|
||||
*/
|
||||
EDA_HOTKEY* GetDescriptorFromCommand( int aCommand, EDA_HOTKEY** aList );
|
||||
|
||||
/**
|
||||
* Function ReadHotkeyConfig
|
||||
|
|
|
@ -91,6 +91,13 @@ public:
|
|||
bool RunHotKey( int aHotKey ) const;
|
||||
|
||||
/**
|
||||
* Function UpdateHotKeys()
|
||||
* Updates TOOL_ACTIONs hot key assignment according to the current frame's Hot Key Editor settings.
|
||||
*/
|
||||
void UpdateHotKeys();
|
||||
|
||||
/**
|
||||
* Function GetActionList()
|
||||
* Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their
|
||||
* creation.
|
||||
* @return List of TOOL_ACTIONs.
|
||||
|
@ -104,6 +111,13 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
///> Resolves a reference to legacy hot key settings to a particular hot key.
|
||||
///> @param aAction is the action to be resolved.
|
||||
///> @param aForceUpdate determines whether it should be resolved only when the current hot key
|
||||
///> setting contains a reference to legacy settings, or update the hot key basing on the
|
||||
///> originally assigned reference.
|
||||
int processHotKey( TOOL_ACTION* aAction, bool aForceUpdate = false );
|
||||
|
||||
///> Tool manager needed to run actions
|
||||
TOOL_MANAGER* m_toolMgr;
|
||||
|
||||
|
|
|
@ -173,6 +173,9 @@ private:
|
|||
*/
|
||||
void setTool( TOOL_INTERACTIVE* aTool );
|
||||
|
||||
///> Updates hot key settings for TOOL_ACTIONs in this menu.
|
||||
void updateHotKeys();
|
||||
|
||||
///> Traverses the submenus tree looking for a submenu capable of handling a particular menu
|
||||
///> event. In case it is handled, it is returned the aToolEvent parameter.
|
||||
void runEventHandlers( const wxMenuEvent& aMenuEvent, OPT_TOOL_EVENT& aToolEvent );
|
||||
|
@ -180,6 +183,12 @@ private:
|
|||
///> Runs a function on the menu and all its submenus.
|
||||
void runOnSubmenus( boost::function<void(CONTEXT_MENU*)> aFunction );
|
||||
|
||||
///> Returns the corresponding wxMenuItem identifier for a TOOL_ACTION object.
|
||||
static inline int getMenuId( const TOOL_ACTION& aAction )
|
||||
{
|
||||
return aAction.GetId() + ACTION_ID;
|
||||
}
|
||||
|
||||
///> Flag indicating that the menu title was set up.
|
||||
bool m_titleSet;
|
||||
|
||||
|
|
|
@ -96,30 +96,6 @@ public:
|
|||
return m_currentHotKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function ChangeHotKey()
|
||||
* Assigns a new hot key.
|
||||
*
|
||||
* @param aNewHotKey is the new hot key.
|
||||
*/
|
||||
void ChangeHotKey( int aNewHotKey )
|
||||
{
|
||||
assert( false );
|
||||
// hotkey has to be changed in the ACTION_MANAGER, or change the implementation
|
||||
m_currentHotKey = aNewHotKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function RestoreHotKey()
|
||||
* Changes the assigned hot key to the default one.
|
||||
*/
|
||||
void RestoreHotKey()
|
||||
{
|
||||
assert( false );
|
||||
// hotkey has to be changed in the ACTION_MANAGER, or change the implementation
|
||||
m_currentHotKey = m_defaultHotKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function HasHotKey()
|
||||
* Checks if the action has a hot key assigned.
|
||||
|
@ -128,7 +104,7 @@ public:
|
|||
*/
|
||||
bool HasHotKey() const
|
||||
{
|
||||
return m_currentHotKey > 0;
|
||||
return m_currentHotKey != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,9 +180,35 @@ public:
|
|||
return m_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a hot key code that refers to a legacy hot key setting, instead of a particular key.
|
||||
* @param aHotKey is an ID of hot key to be referred (see @hotkeys.h).
|
||||
*/
|
||||
inline static int LegacyHotKey( int aHotKey )
|
||||
{
|
||||
assert( ( aHotKey & LEGACY_HK ) == 0 );
|
||||
|
||||
return aHotKey | LEGACY_HK;
|
||||
}
|
||||
private:
|
||||
friend class ACTION_MANAGER;
|
||||
|
||||
/// Returns the hot key assigned in the object definition. It may refer to a legacy hot key setting
|
||||
/// (if LEGACY_HK flag is set).
|
||||
int getDefaultHotKey()
|
||||
{
|
||||
return m_defaultHotKey;
|
||||
}
|
||||
|
||||
/// Changes the assigned hot key.
|
||||
void setHotKey( int aHotKey )
|
||||
{
|
||||
// it is not the right moment to use legacy hot key, it should be given in the object definition
|
||||
assert( ( aHotKey & LEGACY_HK ) == 0 );
|
||||
|
||||
m_currentHotKey = aHotKey;
|
||||
}
|
||||
|
||||
/// Name of the action (convention is: app.[tool.]action.name)
|
||||
std::string m_name;
|
||||
|
||||
|
@ -236,6 +238,10 @@ private:
|
|||
|
||||
/// Generic parameter
|
||||
void* m_param;
|
||||
|
||||
/// Flag to determine the hot key settings is not a particular key, but a reference to legacy
|
||||
/// hot key setting.
|
||||
static const int LEGACY_HK = 0x800000;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -146,6 +146,9 @@ public:
|
|||
RunAction( aAction, aNow, (void*) NULL );
|
||||
}
|
||||
|
||||
///> @copydoc ACTION_MANAGER::UpdateHotKeys()
|
||||
void UpdateHotKeys();
|
||||
|
||||
/**
|
||||
* Function FindTool()
|
||||
* Searches for a tool with given ID.
|
||||
|
|
|
@ -431,6 +431,9 @@ public:
|
|||
m_useCmpFileForFpNames = aUseCmpfile;
|
||||
}
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
|
||||
|
||||
/**
|
||||
* Function OnHotKey.
|
||||
* ** Commands are case insensitive **
|
||||
|
|
|
@ -285,7 +285,7 @@ public:
|
|||
* the output format is: shortcut "key" "function"
|
||||
* lines starting with # are comments
|
||||
*/
|
||||
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL);
|
||||
virtual int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL );
|
||||
|
||||
/**
|
||||
* Function ReadHotkeyConfigFile
|
||||
|
|
|
@ -126,6 +126,17 @@ struct EDA_HOTKEY_CONFIG PlEditorHokeysDescr[] =
|
|||
};
|
||||
|
||||
|
||||
EDA_HOTKEY* PL_EDITOR_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||
{
|
||||
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, s_Common_Hotkey_List );
|
||||
|
||||
if( HK_Descr == NULL )
|
||||
HK_Descr = GetDescriptorFromCommand( aCommand, s_PlEditor_Hotkey_List );
|
||||
|
||||
return HK_Descr;
|
||||
}
|
||||
|
||||
|
||||
bool PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
|
||||
const wxPoint& aPosition, EDA_ITEM* aItem )
|
||||
{
|
||||
|
|
|
@ -236,6 +236,9 @@ public:
|
|||
*/
|
||||
void OnQuit( wxCommandEvent& event );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
|
||||
|
||||
/**
|
||||
* Function OnHotKey.
|
||||
* ** Commands are case insensitive **
|
||||
|
|
|
@ -139,6 +139,8 @@ private:
|
|||
void LoadSettings( wxConfigBase* aCfg ); // override virtual
|
||||
void SaveSettings( wxConfigBase* aCfg ); // override virtual
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int ) const { return NULL; }
|
||||
|
||||
/**
|
||||
* Function OnActivate
|
||||
|
|
|
@ -371,6 +371,17 @@ struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hokeys_Descr[] = {
|
|||
};
|
||||
|
||||
|
||||
EDA_HOTKEY* FOOTPRINT_VIEWER_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||
{
|
||||
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
||||
|
||||
if( HK_Descr == NULL )
|
||||
HK_Descr = GetDescriptorFromCommand( aCommand, module_viewer_Hotkey_List );
|
||||
|
||||
return HK_Descr;
|
||||
}
|
||||
|
||||
|
||||
bool FOOTPRINT_VIEWER_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||
EDA_ITEM* aItem )
|
||||
{
|
||||
|
|
|
@ -107,6 +107,17 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe
|
|||
}
|
||||
|
||||
|
||||
EDA_HOTKEY* PCB_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||
{
|
||||
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
||||
|
||||
if( HK_Descr == NULL )
|
||||
HK_Descr = GetDescriptorFromCommand( aCommand, board_edit_Hotkey_List );
|
||||
|
||||
return HK_Descr;
|
||||
}
|
||||
|
||||
|
||||
bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
|
||||
EDA_ITEM* aItem )
|
||||
{
|
||||
|
|
|
@ -41,6 +41,16 @@
|
|||
* See hotkeys.cpp
|
||||
*/
|
||||
|
||||
EDA_HOTKEY* FOOTPRINT_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
|
||||
{
|
||||
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
||||
|
||||
if( HK_Descr == NULL )
|
||||
HK_Descr = GetDescriptorFromCommand( aCommand, module_edit_Hotkey_List );
|
||||
|
||||
return HK_Descr;
|
||||
}
|
||||
|
||||
|
||||
bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||
EDA_ITEM* aItem )
|
||||
|
|
|
@ -136,10 +136,13 @@ public:
|
|||
*/
|
||||
void OnSaveLibraryAs( wxCommandEvent& aEvent );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
|
||||
|
||||
/**
|
||||
* Function OnHotKey
|
||||
* handle hot key events.
|
||||
* <p?
|
||||
* <p>
|
||||
* Some commands are relative to the item under the mouse cursor. Commands are
|
||||
* case insensitive
|
||||
* </p>
|
||||
|
|
|
@ -118,6 +118,9 @@ private:
|
|||
|
||||
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const;
|
||||
|
||||
/**
|
||||
* Function OnHotKey
|
||||
* handle hot key events.
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <bitmaps.h>
|
||||
#include <wx/defs.h>
|
||||
#include <hotkeys.h>
|
||||
|
||||
// These members are static in class COMMON_ACTIONS: Build them here:
|
||||
|
||||
|
@ -68,11 +69,12 @@ TOOL_ACTION COMMON_ACTIONS::findDummy( "pcbnew.Find.Dummy", // only block the ho
|
|||
AS_GLOBAL, MD_CTRL + int( 'F' ) );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::findMove( "pcbnew.InteractiveSelection.FindMove",
|
||||
AS_GLOBAL, 'T' );
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GET_AND_MOVE_FOOTPRINT ) );
|
||||
|
||||
|
||||
// Edit tool actions
|
||||
TOOL_ACTION COMMON_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.editFootprintInFpEditor",
|
||||
AS_CONTEXT, MD_CTRL + 'E',
|
||||
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_EDIT_MODULE_WITH_MODEDIT ),
|
||||
_( "Open in Footprint Editor" ),
|
||||
_( "Opens the selected footprint in the Footprint Editor" ),
|
||||
module_editor_xpm );
|
||||
|
@ -93,40 +95,40 @@ TOOL_ACTION COMMON_ACTIONS::globalEditPads ( "pcbnew.InteractiveEdit.globalPadEd
|
|||
_( "Changes pad properties globally." ), global_options_pad_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
|
||||
AS_GLOBAL, 'M',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM ),
|
||||
_( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::duplicate( "pcbnew.InteractiveEdit.duplicate",
|
||||
AS_GLOBAL, MD_CTRL + int( 'D' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM ),
|
||||
_( "Duplicate" ), _( "Duplicates the selected item(s)" ), duplicate_module_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
|
||||
AS_GLOBAL, MD_CTRL + MD_SHIFT + int( 'D' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE_ITEM_AND_INCREMENT ),
|
||||
_( "Duplicate" ), _( "Duplicates the selected item(s), incrementing pad numbers" ) );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
|
||||
AS_GLOBAL, MD_CTRL + int( 'M' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_ITEM_EXACT ),
|
||||
_( "Move Exactly..." ), _( "Moves the selected item(s) by an exact amount" ),
|
||||
move_module_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::createArray( "pcbnew.InteractiveEdit.createArray",
|
||||
AS_GLOBAL, MD_CTRL + int( 'N' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CREATE_ARRAY ),
|
||||
_( "Create array" ), _( "Create array" ), array_module_xpm, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::rotate( "pcbnew.InteractiveEdit.rotate",
|
||||
AS_GLOBAL, 'R',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE_ITEM ),
|
||||
_( "Rotate" ), _( "Rotates selected item(s)" ), rotate_cw_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
|
||||
AS_GLOBAL, 'F',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FLIP_ITEM ),
|
||||
_( "Flip" ), _( "Flips selected item(s)" ), swap_layer_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
|
||||
AS_GLOBAL, WXK_DELETE,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
|
||||
_( "Remove" ), _( "Deletes selected item(s)" ), delete_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
|
||||
AS_GLOBAL, 'E',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
|
||||
_( "Properties..." ), _( "Displays properties window" ), editor_xpm );
|
||||
|
||||
|
||||
|
@ -177,17 +179,17 @@ TOOL_ACTION COMMON_ACTIONS::decWidth( "pcbnew.InteractiveDrawing.decWidth",
|
|||
_( "Decrease the line width" ), _( "Decrease the line width" ) );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::arcPosture( "pcbnew.InteractiveDrawing.arcPosture",
|
||||
AS_CONTEXT, '/',
|
||||
AS_CONTEXT, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_POSTURE ),
|
||||
_( "Switch the arc posture" ), _( "Switch the arc posture" ) );
|
||||
|
||||
|
||||
// View Controls
|
||||
TOOL_ACTION COMMON_ACTIONS::zoomIn( "common.Control.zoomIn",
|
||||
AS_GLOBAL, WXK_F1,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_IN ),
|
||||
_( "Zoom In" ), "", zoom_in_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoomOut( "common.Control.zoomOut",
|
||||
AS_GLOBAL, WXK_F2,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_OUT ),
|
||||
_( "Zoom Out" ), "", zoom_out_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoomInCenter( "common.Control.zoomInCenter",
|
||||
|
@ -199,11 +201,11 @@ TOOL_ACTION COMMON_ACTIONS::zoomOutCenter( "common.Control.zoomOutCenter",
|
|||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoomCenter( "common.Control.zoomCenter",
|
||||
AS_GLOBAL, WXK_F4,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_CENTER ),
|
||||
_( "Center" ), "", zoom_center_on_screen_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoomFitScreen( "common.Control.zoomFitScreen",
|
||||
AS_GLOBAL, WXK_HOME,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_AUTO ),
|
||||
_( "Zoom Auto" ), "", zoom_fit_in_page_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoomPreset( "common.Control.zoomPreset",
|
||||
|
@ -213,7 +215,7 @@ TOOL_ACTION COMMON_ACTIONS::zoomPreset( "common.Control.zoomPreset",
|
|||
|
||||
// Display modes
|
||||
TOOL_ACTION COMMON_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
|
||||
AS_GLOBAL, 'K',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_DISPLAY_MODE ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
|
||||
|
@ -237,7 +239,7 @@ TOOL_ACTION COMMON_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutl
|
|||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
|
||||
AS_GLOBAL, 'H',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
|
||||
|
@ -251,43 +253,43 @@ TOOL_ACTION COMMON_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
|
|||
|
||||
// Layer control
|
||||
TOOL_ACTION COMMON_ACTIONS::layerTop( "pcbnew.Control.layerTop",
|
||||
AS_GLOBAL, WXK_PAGEUP,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COMPONENT ),
|
||||
"", "", NULL, AF_NONE, (void*) F_Cu );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerInner1( "pcbnew.Control.layerInner1",
|
||||
AS_GLOBAL, WXK_F5,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER1 ),
|
||||
"", "", NULL, AF_NONE, (void*) In1_Cu );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerInner2( "pcbnew.Control.layerInner2",
|
||||
AS_GLOBAL, WXK_F6,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER2 ),
|
||||
"", "", NULL, AF_NONE, (void*) In2_Cu );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerInner3( "pcbnew.Control.layerInner3",
|
||||
AS_GLOBAL, WXK_F7,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER3 ),
|
||||
"", "", NULL, AF_NONE, (void*) In3_Cu );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerInner4( "pcbnew.Control.layerInner4",
|
||||
AS_GLOBAL, WXK_F8,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER4 ),
|
||||
"", "", NULL, AF_NONE, (void*) In4_Cu );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerInner5( "pcbnew.Control.layerInner5",
|
||||
AS_GLOBAL, WXK_F9,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER5 ),
|
||||
"", "", NULL, AF_NONE, (void*) In5_Cu );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerInner6( "pcbnew.Control.layerInner6",
|
||||
AS_GLOBAL, WXK_F10,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER6 ),
|
||||
"", "", NULL, AF_NONE, (void*) In6_Cu );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerBottom( "pcbnew.Control.layerBottom",
|
||||
AS_GLOBAL, WXK_PAGEDOWN,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COPPER ),
|
||||
"", "", NULL, AF_NONE, (void*) B_Cu );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerNext( "pcbnew.Control.layerNext",
|
||||
AS_GLOBAL, '+',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_NEXT ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerPrev( "pcbnew.Control.layerPrev",
|
||||
AS_GLOBAL, '-',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_PREVIOUS ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
|
||||
|
@ -305,23 +307,23 @@ TOOL_ACTION COMMON_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
|
|||
|
||||
// Grid control
|
||||
TOOL_ACTION COMMON_ACTIONS::gridFast1( "common.Control.gridFast1",
|
||||
AS_GLOBAL, MD_ALT + int( '1' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID1 ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::gridFast2( "common.Control.gridFast2",
|
||||
AS_GLOBAL, MD_ALT + int( '2' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID2 ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::gridNext( "common.Control.gridNext",
|
||||
AS_GLOBAL, 'N',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_NEXT ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::gridPrev( "common.Control.gridPrev",
|
||||
AS_GLOBAL, MD_SHIFT + int( 'N' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_PREVIOUS ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::gridSetOrigin( "common.Control.gridSetOrigin",
|
||||
AS_GLOBAL, 0,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SET_GRID_ORIGIN ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::gridPreset( "common.Control.gridPreset",
|
||||
|
@ -330,11 +332,11 @@ TOOL_ACTION COMMON_ACTIONS::gridPreset( "common.Control.gridPreset",
|
|||
|
||||
// Track & via size control
|
||||
TOOL_ACTION COMMON_ACTIONS::trackWidthInc( "pcbnew.EditorControl.trackWidthInc",
|
||||
AS_GLOBAL, '[',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_NEXT ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::trackWidthDec( "pcbnew.EditorControl.trackWidthDec",
|
||||
AS_GLOBAL, ']',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::viaSizeInc( "pcbnew.EditorControl.viaSizeInc",
|
||||
|
@ -356,7 +358,7 @@ TOOL_ACTION COMMON_ACTIONS::zoneFill( "pcbnew.EditorControl.zoneFill",
|
|||
_( "Fill" ), _( "Fill zone(s)" ), fill_zone_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoneFillAll( "pcbnew.EditorControl.zoneFillAll",
|
||||
AS_GLOBAL, int( 'B' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_FILL_OR_REFILL ),
|
||||
_( "Fill all" ), _( "Fill all zones" ) );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoneUnfill( "pcbnew.EditorControl.zoneUnfill",
|
||||
|
@ -364,7 +366,7 @@ TOOL_ACTION COMMON_ACTIONS::zoneUnfill( "pcbnew.EditorControl.zoneUnfill",
|
|||
_( "Unfill" ), _( "Unfill zone(s)" ), zone_unfill_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoneUnfillAll( "pcbnew.EditorControl.zoneUnfillAll",
|
||||
AS_GLOBAL, MD_CTRL + int( 'B' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZONE_REMOVE_FILLED ),
|
||||
_( "Unfill all" ), _( "Unfill all zones" ) );
|
||||
|
||||
|
||||
|
@ -373,7 +375,7 @@ TOOL_ACTION COMMON_ACTIONS::placeTarget( "pcbnew.EditorControl.placeTarget",
|
|||
_( "Add layer alignment target" ), _( "Add layer alignment target" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::placeModule( "pcbnew.EditorControl.placeModule",
|
||||
AS_GLOBAL, 'O',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_MODULE ),
|
||||
_( "Add modules" ), _( "Add modules" ), NULL, AF_ACTIVATE );
|
||||
|
||||
|
||||
|
@ -387,7 +389,7 @@ TOOL_ACTION COMMON_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads",
|
|||
_( "Enumerate pads" ), _( "Enumerate pads" ), pad_enumerate_xpm, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::copyItems( "pcbnew.ModuleEditor.copyItems",
|
||||
AS_GLOBAL, MD_CTRL + int( 'C' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_COPY_ITEM ),
|
||||
_( "Copy items" ), _( "Copy items" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::pasteItems( "pcbnew.ModuleEditor.pasteItems",
|
||||
|
@ -417,7 +419,7 @@ TOOL_ACTION COMMON_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
|
|||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
|
||||
AS_GLOBAL, MD_CTRL + int( 'U' ),
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_UNITS ),
|
||||
"", "" );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::showHelp( "pcbnew.Control.showHelp",
|
||||
|
@ -430,7 +432,7 @@ TOOL_ACTION COMMON_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
|
|||
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
|
||||
AS_GLOBAL, 'X',
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_TRACK ),
|
||||
_( "Run push & shove router (single tracks)" ),
|
||||
_( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
|
||||
|
||||
|
@ -453,18 +455,16 @@ TOOL_ACTION COMMON_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.T
|
|||
AS_GLOBAL, '7',
|
||||
_( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
|
||||
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
|
||||
AS_GLOBAL, '8',
|
||||
_( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
|
||||
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
|
||||
AS_GLOBAL, '9',
|
||||
_( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
|
||||
AS_GLOBAL, 0,
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG_TRACK_KEEP_SLOPE ),
|
||||
"", "" );
|
||||
|
||||
// Point editor
|
||||
|
|
|
@ -48,7 +48,7 @@ void CONDITIONAL_MENU::AddSeparator( const SELECTION_CONDITION& aCondition, int
|
|||
|
||||
CONTEXT_MENU& CONDITIONAL_MENU::Generate( SELECTION& aSelection )
|
||||
{
|
||||
// Do not delete entries - they are going to be reused
|
||||
// Clear, but do not delete entries - they are going to be reused
|
||||
m_menu.GetMenuItems().clear();
|
||||
|
||||
for( std::list<ENTRY>::iterator it = m_entries.begin(); it != m_entries.end(); ++it )
|
||||
|
|
Loading…
Reference in New Issue