diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp index 2e1e02fb05..1e338b2b6b 100644 --- a/common/tool/action_manager.cpp +++ b/common/tool/action_manager.cpp @@ -44,9 +44,20 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) : if( action->m_id == -1 ) action->m_id = MakeActionId( action->m_name ); + int groupID = 0; + std::string groupName = "none"; + + std::optional group = action->GetActionGroup(); + + if( group.has_value() ) + { + groupID = group.value().GetGroupID(); + groupName = group.value().GetName(); + } + wxLogTrace( kicadTraceToolStack, - "ACTION_MANAGER::ACTION_MANAGER: Registering action %s with ID %d and UI ID %d", - action->m_name, action->m_id, action->GetUIId() ); + "ACTION_MANAGER::ACTION_MANAGER: Registering action %s with ID %d, UI ID %d, and group %s(%d)", + action->m_name, action->m_id, action->GetUIId(), groupName, groupID ); RegisterAction( action ); } diff --git a/common/tool/tool_action.cpp b/common/tool/tool_action.cpp index d3163a61d8..11ba0a69ba 100644 --- a/common/tool/tool_action.cpp +++ b/common/tool/tool_action.cpp @@ -41,6 +41,7 @@ TOOL_ACTION::TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope, BITMAPS aIcon, TOOL_ACTION_FLAGS aFlags ) : m_name( aName ), m_scope( aScope ), + m_group( std::nullopt ), m_defaultHotKey( aDefaultHotKey ), m_defaultHotKeyAlt( 0 ), m_legacyName( aLegacyHotKeyName ), @@ -57,6 +58,7 @@ TOOL_ACTION::TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope, TOOL_ACTION::TOOL_ACTION() : m_scope( AS_GLOBAL ), + m_group( std::nullopt ), m_defaultHotKey( 0 ), m_defaultHotKeyAlt( 0 ), m_icon( BITMAPS::INVALID_BITMAP ), @@ -94,6 +96,9 @@ TOOL_ACTION::TOOL_ACTION( const TOOL_ACTION_ARGS& aArgs ) : if( aArgs.m_description.has_value() ) m_description = TowxString( aArgs.m_description.value() ); + if( aArgs.m_group.has_value() ) + m_group = aArgs.m_group; + ACTION_MANAGER::GetActionList().push_back( this ); } @@ -115,6 +120,9 @@ TOOL_EVENT TOOL_ACTION::MakeEvent() const else evt = TOOL_EVENT( TC_COMMAND, TA_ACTION, m_name, m_scope ); + if( m_group.has_value() ) + evt.SetActionGroup( m_group.value() ); + if( m_param.has_value() ) evt.SetParameter( m_param ); diff --git a/common/tool/tool_event.cpp b/common/tool/tool_event.cpp index cf7494a3d6..cbae45f06c 100644 --- a/common/tool/tool_event.cpp +++ b/common/tool/tool_event.cpp @@ -84,6 +84,15 @@ bool TOOL_EVENT::IsAction( const TOOL_ACTION* aAction ) const } +bool TOOL_EVENT::IsActionInGroup( const TOOL_ACTION_GROUP& aGroup ) const +{ + if( m_actionGroup.has_value() ) + return m_actionGroup.value() == aGroup; + + return false; +} + + const std::string TOOL_EVENT::Format() const { std::string ev; @@ -142,32 +151,31 @@ const std::string TOOL_EVENT::Format() const { 0, "" } }; - ev = "category: "; - ev += flag2string( m_category, categories ); - ev += " action: "; - ev += flag2string( m_actions, actions ); + ev = "category: " + flag2string( m_category, categories ) + " "; + ev += "action: " + flag2string( m_actions, actions ) + " "; + ev += "action-group: "; + + if( m_actionGroup.has_value() ) + { + ev += m_actionGroup.value().GetName() + + "(" + std::to_string( m_actionGroup.value().GetGroupID() ) + ")" + " "; + } + else + { + ev += "none"; + } if( m_actions & TA_MOUSE ) - { - ev += " btns: "; - ev += flag2string( m_mouseButtons, buttons ); - } + ev += "btns: " + flag2string( m_mouseButtons, buttons ) + " "; if( m_actions & TA_KEYBOARD ) - { - ev += "key: " + std::to_string( m_keyCode ); - } + ev += "key: " + std::to_string( m_keyCode ) + " "; if( m_actions & ( TA_MOUSE | TA_KEYBOARD ) ) - { - ev += " mods: "; - ev += flag2string( m_modifiers, modifiers ); - } + ev += "mods: " + flag2string( m_modifiers, modifiers ) + " "; if( m_commandId ) - { - ev += "cmd-id: " + std::to_string( *m_commandId ); - } + ev += "cmd-id: " + std::to_string( *m_commandId ) + " "; ev += "cmd-str: " + m_commandStr; diff --git a/include/tool/tool_action.h b/include/tool/tool_action.h index 4423aae114..0de10426a1 100644 --- a/include/tool/tool_action.h +++ b/include/tool/tool_action.h @@ -56,6 +56,41 @@ enum TOOL_ACTION_FLAGS AF_NOTIFY = 2 ///< Action is a notification (it is by default passed to all tools) }; +/** + * Define a group that can be used to group actions (and their events) of similar operations. + */ +class TOOL_ACTION_GROUP +{ +public: + TOOL_ACTION_GROUP( std::string aName ) : + m_name( aName ) + { + // Assign a unique group ID to each group + static int groupIDs = 0; + m_groupID = ++groupIDs; + }; + + TOOL_ACTION_GROUP( const TOOL_ACTION_GROUP& aOther ) + { + // Ensure a copy of a group is exactly the same as this one to get + // proper comparisons + m_name = aOther.GetName(); + m_groupID = aOther.GetGroupID(); + } + + int GetGroupID() const { return m_groupID; } + const std::string& GetName() const { return m_name; } + + bool operator==( const TOOL_ACTION_GROUP& aOther ) const + { + return m_groupID == aOther.m_groupID; + } + +private: + int m_groupID; + std::string m_name; +}; + /** * Build up the properties of a TOOL_ACTION in an incremental manner that is static-construction * safe. @@ -181,6 +216,12 @@ public: return *this; } + TOOL_ACTION_ARGS& Group( const TOOL_ACTION_GROUP& aGroup ) + { + m_group = aGroup; + return *this; + } + protected: // Let the TOOL_ACTION constructor have direct access to the members here friend class TOOL_ACTION; @@ -201,6 +242,8 @@ protected: std::optional m_icon; + std::optional m_group; + std::any m_param; }; @@ -333,6 +376,7 @@ public: return param; } + const std::optional GetActionGroup() const { return m_group; } /** * Return name of the tool associated with the action. It is basically the action name @@ -378,6 +422,8 @@ protected: ///< Name of the action (convention is "app.tool.actionName") std::string m_name; TOOL_ACTION_SCOPE m_scope; + + std::optional m_group; // Optional group for the action to belong to const int m_defaultHotKey; // Default hot key const int m_defaultHotKeyAlt; // Default hot key alternate diff --git a/include/tool/tool_event.h b/include/tool/tool_event.h index 57f361fee3..0e7083879d 100644 --- a/include/tool/tool_event.h +++ b/include/tool/tool_event.h @@ -525,6 +525,13 @@ public: m_mousePos = aP; } + void SetActionGroup( const TOOL_ACTION_GROUP& aGroup ) + { + m_actionGroup = aGroup; + } + + bool IsActionInGroup( const TOOL_ACTION_GROUP& aGroup ) const; + private: friend class TOOL_DISPATCHER; friend class TOOL_MANAGER; @@ -575,6 +582,10 @@ private: bool m_hasPosition; bool m_forceImmediate; + + ///< Optional group that the parent action for the event belongs to + std::optional m_actionGroup; + ///< True when the tool is being re-activated from the stack bool m_reactivate; diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index e15beadbc1..833cd07f1c 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -937,9 +937,13 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia ) return 0; } } - else + else if( aEvent.IsActionInGroup( PCB_ACTIONS::layerDirectSwitchActions() ) ) { - targetLayer = UNDEFINED_LAYER; + targetLayer = aEvent.Parameter(); + + if( !enabledLayers.test( targetLayer ) ) + return 0; + } if( targetLayer != UNDEFINED_LAYER ) diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 3185ee1c28..5342dbdf19 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -1443,10 +1443,18 @@ TOOL_ACTION* PCB_ACTIONS::LayerIDToAction( PCB_LAYER_ID aLayer ) } } +// Implemented as an accessor + static variable to ensure it is initialized when used +// in static action constructors +TOOL_ACTION_GROUP PCB_ACTIONS::layerDirectSwitchActions() +{ + static TOOL_ACTION_GROUP group( "pcbnew.Control.DirectLayerActions" ); + return group; +} TOOL_ACTION PCB_ACTIONS::layerTop( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerTop" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .DefaultHotkey( WXK_PAGEUP ) .LegacyHotkeyName( "Switch to Component (F.Cu) layer" ) .MenuText( _( "Switch to Component (F.Cu) layer" ) ) @@ -1457,6 +1465,7 @@ TOOL_ACTION PCB_ACTIONS::layerTop( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner1( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner1" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .LegacyHotkeyName( "Switch to Inner layer 1" ) .MenuText( _( "Switch to Inner layer 1" ) ) .Tooltip( _( "Switch to Inner layer 1" ) ) @@ -1466,6 +1475,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner1( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner2( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner2" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .LegacyHotkeyName( "Switch to Inner layer 2" ) .MenuText( _( "Switch to Inner layer 2" ) ) .Tooltip( _( "Switch to Inner layer 2" ) ) @@ -1475,6 +1485,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner2( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner3( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner3" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .LegacyHotkeyName( "Switch to Inner layer 3" ) .MenuText( _( "Switch to Inner layer 3" ) ) .Tooltip( _( "Switch to Inner layer 3" ) ) @@ -1484,6 +1495,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner3( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner4( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner4" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .LegacyHotkeyName( "Switch to Inner layer 4" ) .MenuText( _( "Switch to Inner layer 4" ) ) .Tooltip( _( "Switch to Inner layer 4" ) ) @@ -1493,6 +1505,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner4( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner5( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner5" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .LegacyHotkeyName( "Switch to Inner layer 5" ) .MenuText( _( "Switch to Inner layer 5" ) ) .Tooltip( _( "Switch to Inner layer 5" ) ) @@ -1502,6 +1515,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner5( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner6( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner6" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .LegacyHotkeyName( "Switch to Inner layer 6" ) .MenuText( _( "Switch to Inner layer 6" ) ) .Tooltip( _( "Switch to Inner layer 6" ) ) @@ -1511,6 +1525,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner6( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner7( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner7" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 7" ) ) .Tooltip( _( "Switch to Inner layer 7" ) ) .Flags( AF_NOTIFY ) @@ -1519,6 +1534,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner7( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner8( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner8" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 8" ) ) .Tooltip( _( "Switch to Inner layer 8" ) ) .Flags( AF_NOTIFY ) @@ -1527,6 +1543,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner8( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner9( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner9" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 9" ) ) .Tooltip( _( "Switch to Inner layer 9" ) ) .Flags( AF_NOTIFY ) @@ -1535,6 +1552,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner9( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner10( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner10" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 10" ) ) .Tooltip( _( "Switch to Inner layer 10" ) ) .Flags( AF_NOTIFY ) @@ -1543,6 +1561,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner10( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner11( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner11" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 11" ) ) .Tooltip( _( "Switch to Inner layer 11" ) ) .Flags( AF_NOTIFY ) @@ -1551,6 +1570,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner11( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner12( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner12" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 12" ) ) .Tooltip( _( "Switch to Inner layer 12" ) ) .Flags( AF_NOTIFY ) @@ -1559,6 +1579,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner12( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner13( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner13" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 13" ) ) .Tooltip( _( "Switch to Inner layer 13" ) ) .Flags( AF_NOTIFY ) @@ -1567,6 +1588,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner13( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner14( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner14" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 14" ) ) .Tooltip( _( "Switch to Inner layer 14" ) ) .Flags( AF_NOTIFY ) @@ -1575,6 +1597,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner14( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner15( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner15" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 15" ) ) .Tooltip( _( "Switch to Inner layer 15" ) ) .Flags( AF_NOTIFY ) @@ -1583,6 +1606,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner15( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner16( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner16" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 16" ) ) .Tooltip( _( "Switch to Inner layer 16" ) ) .Flags( AF_NOTIFY ) @@ -1591,6 +1615,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner16( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner17( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner17" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 17" ) ) .Tooltip( _( "Switch to Inner layer 17" ) ) .Flags( AF_NOTIFY ) @@ -1599,6 +1624,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner17( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner18( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner18" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 18" ) ) .Tooltip( _( "Switch to Inner layer 18" ) ) .Flags( AF_NOTIFY ) @@ -1607,6 +1633,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner18( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner19( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner19" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 19" ) ) .Tooltip( _( "Switch to Inner layer 19" ) ) .Flags( AF_NOTIFY ) @@ -1615,6 +1642,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner19( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner20( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner20" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 20" ) ) .Tooltip( _( "Switch to Inner layer 20" ) ) .Flags( AF_NOTIFY ) @@ -1623,6 +1651,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner20( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner21( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner21" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 21" ) ) .Tooltip( _( "Switch to Inner layer 21" ) ) .Flags( AF_NOTIFY ) @@ -1631,6 +1660,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner21( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner22( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner22" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 22" ) ) .Tooltip( _( "Switch to Inner layer 22" ) ) .Flags( AF_NOTIFY ) @@ -1639,6 +1669,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner22( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner23( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner23" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 23" ) ) .Tooltip( _( "Switch to Inner layer 23" ) ) .Flags( AF_NOTIFY ) @@ -1647,6 +1678,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner23( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner24( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner24" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 24" ) ) .Tooltip( _( "Switch to Inner layer 24" ) ) .Flags( AF_NOTIFY ) @@ -1655,6 +1687,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner24( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner25( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner25" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 25" ) ) .Tooltip( _( "Switch to Inner layer 25" ) ) .Flags( AF_NOTIFY ) @@ -1663,6 +1696,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner25( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner26( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner26" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 26" ) ) .Tooltip( _( "Switch to Inner layer 26" ) ) .Flags( AF_NOTIFY ) @@ -1671,6 +1705,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner26( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner27( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner27" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 27" ) ) .Tooltip( _( "Switch to Inner layer 27" ) ) .Flags( AF_NOTIFY ) @@ -1679,6 +1714,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner27( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner28( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner28" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 28" ) ) .Tooltip( _( "Switch to Inner layer 28" ) ) .Flags( AF_NOTIFY ) @@ -1687,6 +1723,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner28( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner29( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner29" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 29" ) ) .Tooltip( _( "Switch to Inner layer 29" ) ) .Flags( AF_NOTIFY ) @@ -1695,6 +1732,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner29( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerInner30( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerInner30" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .MenuText( _( "Switch to Inner layer 30" ) ) .Tooltip( _( "Switch to Inner layer 30" ) ) .Flags( AF_NOTIFY ) @@ -1703,6 +1741,7 @@ TOOL_ACTION PCB_ACTIONS::layerInner30( TOOL_ACTION_ARGS() TOOL_ACTION PCB_ACTIONS::layerBottom( TOOL_ACTION_ARGS() .Name( "pcbnew.Control.layerBottom" ) .Scope( AS_GLOBAL ) + .Group( PCB_ACTIONS::layerDirectSwitchActions() ) .DefaultHotkey( WXK_PAGEDOWN ) .LegacyHotkeyName( "Switch to Copper (B.Cu) layer" ) .MenuText( _( "Switch to Copper (B.Cu) layer" ) ) diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 7a1699ba0b..79c12dda53 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -355,6 +355,9 @@ public: static TOOL_ACTION layerAlphaDec; static TOOL_ACTION layerToggle; + // Group to link all actions that directly select layers + static TOOL_ACTION_GROUP layerDirectSwitchActions(); + static TOOL_ACTION layerChanged; // notification static TOOL_ACTION flipBoard;