Update the net highlight action to properly use the action parameters

This commit is contained in:
Ian McInerney 2022-09-29 00:34:45 +01:00
parent 6a2dcd1936
commit 8f3d159905
2 changed files with 19 additions and 18 deletions

View File

@ -872,17 +872,21 @@ TOOL_ACTION PCB_ACTIONS::highlightNetSelection( "pcbnew.EditorControl.highlightN
TOOL_ACTION PCB_ACTIONS::highlightItem( "pcbnew.EditorControl.highlightItem",
AS_GLOBAL );
TOOL_ACTION PCB_ACTIONS::hideNetInRatsnest( "pcbnew.EditorControl.hideNet",
AS_GLOBAL, 0, "",
_( "Hide Net in Ratsnest" ),
_( "Hide the selected net in the ratsnest of unconnected net lines/arcs" ),
BITMAPS::hide_ratsnest );
TOOL_ACTION PCB_ACTIONS::hideNetInRatsnest( TOOL_ACTION_ARGS()
.Name( "pcbnew.EditorControl.hideNet" )
.Scope( AS_GLOBAL )
.MenuText( _( "Hide Net in Ratsnest" ) )
.Tooltip( _( "Hide the selected net in the ratsnest of unconnected net lines/arcs" ) )
.Icon( BITMAPS::hide_ratsnest )
.Parameter( static_cast<int>( 0 ) ) ); // Default to hiding selected net
TOOL_ACTION PCB_ACTIONS::showNetInRatsnest( "pcbnew.EditorControl.showNet",
AS_GLOBAL, 0, "",
_( "Show Net in Ratsnest" ),
_( "Show the selected net in the ratsnest of unconnected net lines/arcs" ),
BITMAPS::show_ratsnest );
TOOL_ACTION PCB_ACTIONS::showNetInRatsnest( TOOL_ACTION_ARGS()
.Name( "pcbnew.EditorControl.showNet" )
.Scope( AS_GLOBAL )
.MenuText( _( "Show Net in Ratsnest" ) )
.Tooltip( _( "Show the selected net in the ratsnest of unconnected net lines/arcs" ) )
.Icon( BITMAPS::show_ratsnest )
.Parameter( static_cast<int>( 0 ) ) ); // Default to showing selected net
TOOL_ACTION PCB_ACTIONS::showEeschema( "pcbnew.EditorControl.showEeschema",
AS_GLOBAL, 0, "",

View File

@ -295,7 +295,7 @@ void NET_GRID_TABLE::updateNetVisibility( const NET_GRID_ENTRY& aNet )
const TOOL_ACTION& action = aNet.visible ? PCB_ACTIONS::showNetInRatsnest
: PCB_ACTIONS::hideNetInRatsnest;
m_frame->GetToolManager()->RunAction( action, true, static_cast<intptr_t>( aNet.code ) );
m_frame->GetToolManager()->RunAction( action, true, aNet.code );
}
@ -2966,20 +2966,17 @@ void APPEARANCE_CONTROLS::onNetContextMenu( wxCommandEvent& aEvent )
break;
case ID_HIGHLIGHT_NET:
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::highlightNet, true,
static_cast<intptr_t>( net.code ) );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::highlightNet, true, net.code );
m_frame->GetCanvas()->Refresh();
break;
case ID_SELECT_NET:
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectNet, true,
static_cast<intptr_t>( net.code ) );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectNet, true, net.code );
m_frame->GetCanvas()->Refresh();
break;
case ID_DESELECT_NET:
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::deselectNet, true,
static_cast<intptr_t>( net.code ) );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::deselectNet, true, net.code );
m_frame->GetCanvas()->Refresh();
break;
@ -3017,7 +3014,7 @@ void APPEARANCE_CONTROLS::showNetclass( const wxString& aClassName, bool aShow )
m_frame->GetToolManager()->RunAction( aShow ? PCB_ACTIONS::showNetInRatsnest
: PCB_ACTIONS::hideNetInRatsnest,
true,
static_cast<intptr_t>( net->GetNetCode() ) );
net->GetNetCode() );
int row = m_netsTable->GetRowByNetcode( net->GetNetCode() );