Move layer ID to action mapping to PCB_ACTIONS
This mapping function is better suited for a method of the actions itself rather than just a helper function in one file.
This commit is contained in:
parent
7ae4d78738
commit
50e0a3a500
|
@ -34,48 +34,6 @@
|
|||
#include <tools/pcb_actions.h>
|
||||
|
||||
|
||||
// translate aLayer to its action
|
||||
static TOOL_ACTION* layer2action( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
switch( aLayer )
|
||||
{
|
||||
case F_Cu: return &PCB_ACTIONS::layerTop;
|
||||
case In1_Cu: return &PCB_ACTIONS::layerInner1;
|
||||
case In2_Cu: return &PCB_ACTIONS::layerInner2;
|
||||
case In3_Cu: return &PCB_ACTIONS::layerInner3;
|
||||
case In4_Cu: return &PCB_ACTIONS::layerInner4;
|
||||
case In5_Cu: return &PCB_ACTIONS::layerInner5;
|
||||
case In6_Cu: return &PCB_ACTIONS::layerInner6;
|
||||
case In7_Cu: return &PCB_ACTIONS::layerInner7;
|
||||
case In8_Cu: return &PCB_ACTIONS::layerInner8;
|
||||
case In9_Cu: return &PCB_ACTIONS::layerInner9;
|
||||
case In10_Cu: return &PCB_ACTIONS::layerInner10;
|
||||
case In11_Cu: return &PCB_ACTIONS::layerInner11;
|
||||
case In12_Cu: return &PCB_ACTIONS::layerInner12;
|
||||
case In13_Cu: return &PCB_ACTIONS::layerInner13;
|
||||
case In14_Cu: return &PCB_ACTIONS::layerInner14;
|
||||
case In15_Cu: return &PCB_ACTIONS::layerInner15;
|
||||
case In16_Cu: return &PCB_ACTIONS::layerInner16;
|
||||
case In17_Cu: return &PCB_ACTIONS::layerInner17;
|
||||
case In18_Cu: return &PCB_ACTIONS::layerInner18;
|
||||
case In19_Cu: return &PCB_ACTIONS::layerInner19;
|
||||
case In20_Cu: return &PCB_ACTIONS::layerInner20;
|
||||
case In21_Cu: return &PCB_ACTIONS::layerInner21;
|
||||
case In22_Cu: return &PCB_ACTIONS::layerInner22;
|
||||
case In23_Cu: return &PCB_ACTIONS::layerInner23;
|
||||
case In24_Cu: return &PCB_ACTIONS::layerInner24;
|
||||
case In25_Cu: return &PCB_ACTIONS::layerInner25;
|
||||
case In26_Cu: return &PCB_ACTIONS::layerInner26;
|
||||
case In27_Cu: return &PCB_ACTIONS::layerInner27;
|
||||
case In28_Cu: return &PCB_ACTIONS::layerInner28;
|
||||
case In29_Cu: return &PCB_ACTIONS::layerInner29;
|
||||
case In30_Cu: return &PCB_ACTIONS::layerInner30;
|
||||
case B_Cu: return &PCB_ACTIONS::layerBottom;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// class to display a layer list in a wxBitmapComboBox.
|
||||
|
||||
// Reload the Layers
|
||||
|
@ -111,7 +69,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
|
|||
|
||||
if( m_layerhotkeys )
|
||||
{
|
||||
TOOL_ACTION* action = layer2action( layerid );
|
||||
TOOL_ACTION* action = PCB_ACTIONS::LayerIDToAction( layerid );
|
||||
|
||||
if( action )
|
||||
layername = AddHotkeyName( layername, action->GetHotKey(), IS_COMMENT );
|
||||
|
|
|
@ -1029,6 +1029,49 @@ TOOL_ACTION PCB_ACTIONS::zoneDisplayToggle( "pcbnew.Control.zoneDisplayToggle",
|
|||
|
||||
|
||||
// Layer control
|
||||
|
||||
// Translate aLayer to the action that switches to it
|
||||
TOOL_ACTION* PCB_ACTIONS::LayerIDToAction( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
switch( aLayer )
|
||||
{
|
||||
case F_Cu: return &PCB_ACTIONS::layerTop;
|
||||
case In1_Cu: return &PCB_ACTIONS::layerInner1;
|
||||
case In2_Cu: return &PCB_ACTIONS::layerInner2;
|
||||
case In3_Cu: return &PCB_ACTIONS::layerInner3;
|
||||
case In4_Cu: return &PCB_ACTIONS::layerInner4;
|
||||
case In5_Cu: return &PCB_ACTIONS::layerInner5;
|
||||
case In6_Cu: return &PCB_ACTIONS::layerInner6;
|
||||
case In7_Cu: return &PCB_ACTIONS::layerInner7;
|
||||
case In8_Cu: return &PCB_ACTIONS::layerInner8;
|
||||
case In9_Cu: return &PCB_ACTIONS::layerInner9;
|
||||
case In10_Cu: return &PCB_ACTIONS::layerInner10;
|
||||
case In11_Cu: return &PCB_ACTIONS::layerInner11;
|
||||
case In12_Cu: return &PCB_ACTIONS::layerInner12;
|
||||
case In13_Cu: return &PCB_ACTIONS::layerInner13;
|
||||
case In14_Cu: return &PCB_ACTIONS::layerInner14;
|
||||
case In15_Cu: return &PCB_ACTIONS::layerInner15;
|
||||
case In16_Cu: return &PCB_ACTIONS::layerInner16;
|
||||
case In17_Cu: return &PCB_ACTIONS::layerInner17;
|
||||
case In18_Cu: return &PCB_ACTIONS::layerInner18;
|
||||
case In19_Cu: return &PCB_ACTIONS::layerInner19;
|
||||
case In20_Cu: return &PCB_ACTIONS::layerInner20;
|
||||
case In21_Cu: return &PCB_ACTIONS::layerInner21;
|
||||
case In22_Cu: return &PCB_ACTIONS::layerInner22;
|
||||
case In23_Cu: return &PCB_ACTIONS::layerInner23;
|
||||
case In24_Cu: return &PCB_ACTIONS::layerInner24;
|
||||
case In25_Cu: return &PCB_ACTIONS::layerInner25;
|
||||
case In26_Cu: return &PCB_ACTIONS::layerInner26;
|
||||
case In27_Cu: return &PCB_ACTIONS::layerInner27;
|
||||
case In28_Cu: return &PCB_ACTIONS::layerInner28;
|
||||
case In29_Cu: return &PCB_ACTIONS::layerInner29;
|
||||
case In30_Cu: return &PCB_ACTIONS::layerInner30;
|
||||
case B_Cu: return &PCB_ACTIONS::layerBottom;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::layerTop( TOOL_ACTION_ARGS()
|
||||
.Name( "pcbnew.Control.layerTop" )
|
||||
.Scope( AS_GLOBAL )
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#ifndef __PCB_ACTIONS_H
|
||||
#define __PCB_ACTIONS_H
|
||||
|
||||
#include <layer_ids.h>
|
||||
#include <tool/tool_action.h>
|
||||
#include <tool/actions.h>
|
||||
|
||||
|
@ -48,6 +49,14 @@ enum class ZONE_MODE
|
|||
class PCB_ACTIONS : public ACTIONS
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Translate a layer ID into the action that switches to that layer.
|
||||
*
|
||||
* @param aLayerID is the layer to switch to
|
||||
* @return the action that will switch to the specified layer
|
||||
*/
|
||||
static TOOL_ACTION* LayerIDToAction( PCB_LAYER_ID aLayerID );
|
||||
|
||||
// Selection Tool
|
||||
/// Activation of the selection tool
|
||||
static TOOL_ACTION selectionActivate;
|
||||
|
|
Loading…
Reference in New Issue