Separate immediate and delayed action dispatch

Using a boolean argument just leads to a lot of trailing booleans in the
function calls and is not user friendly. Instead, introduce PostAction()
to send an action that runs after the coroutine (equivalent to passing
false or the default argument), and leave RunAction as the immediate
execution function.
This commit is contained in:
Ian McInerney 2023-06-26 23:16:51 +01:00
parent a318c57d77
commit 2fb6f19a84
102 changed files with 526 additions and 479 deletions

View File

@ -591,7 +591,7 @@ long NL_3D_VIEWER_PLUGIN_IMPL::SetActiveCommand( std::string commandId )
if( runAction ) if( runAction )
{ {
tool_manager->RunAction( *context, true ); tool_manager->RunAction( *context );
m_canvas->Request_refresh(); m_canvas->Request_refresh();
} }
} }

View File

@ -478,14 +478,14 @@ void DIALOG_ABOUT::onCopyVersionInfo( wxCommandEvent& event )
void DIALOG_ABOUT::onDonateClick( wxCommandEvent& event ) void DIALOG_ABOUT::onDonateClick( wxCommandEvent& event )
{ {
if( TOOL_MANAGER* mgr = static_cast<EDA_BASE_FRAME*>( GetParent() )->GetToolManager() ) if( TOOL_MANAGER* mgr = static_cast<EDA_BASE_FRAME*>( GetParent() )->GetToolManager() )
mgr->RunAction( "common.SuiteControl.donate", true ); mgr->RunAction( "common.SuiteControl.donate" );
} }
void DIALOG_ABOUT::onReportBug( wxCommandEvent& event ) void DIALOG_ABOUT::onReportBug( wxCommandEvent& event )
{ {
if( TOOL_MANAGER* mgr = static_cast<EDA_BASE_FRAME*>( GetParent() )->GetToolManager() ) if( TOOL_MANAGER* mgr = static_cast<EDA_BASE_FRAME*>( GetParent() )->GetToolManager() )
mgr->RunAction( "common.SuiteControl.reportBug", true ); mgr->RunAction( "common.SuiteControl.reportBug" );
} }

View File

@ -130,8 +130,8 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
mgr->ResetTools( TOOL_BASE::REDRAW ); mgr->ResetTools( TOOL_BASE::REDRAW );
// Notify GAL // Notify GAL
mgr->RunAction( ACTIONS::gridPreset, true, gridCfg.last_size_idx ); mgr->RunAction( ACTIONS::gridPreset, gridCfg.last_size_idx );
mgr->RunAction( ACTIONS::gridSetOrigin, true, new VECTOR2D( m_parent->GetGridOrigin() ) ); mgr->RunAction( ACTIONS::gridSetOrigin, new VECTOR2D( m_parent->GetGridOrigin() ) );
m_parent->UpdateGridSelectBox(); m_parent->UpdateGridSelectBox();

View File

@ -1260,7 +1260,7 @@ void EDA_BASE_FRAME::DoWithAcceptedFiles()
for( const wxFileName& file : m_AcceptedFiles ) for( const wxFileName& file : m_AcceptedFiles )
{ {
wxString fn = file.GetFullPath(); wxString fn = file.GetFullPath();
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( file.GetExt() ), true, &fn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( file.GetExt() ), &fn );
} }
} }

View File

@ -276,7 +276,7 @@ void EDA_DRAW_FRAME::unitsChangeRefresh()
{ {
// Notify all tools the units have changed // Notify all tools the units have changed
if( m_toolManager ) if( m_toolManager )
m_toolManager->RunAction( ACTIONS::updateUnits, true ); m_toolManager->RunAction( ACTIONS::updateUnits );
UpdateStatusBar(); UpdateStatusBar();
UpdateMsgPanel(); UpdateMsgPanel();
@ -347,7 +347,7 @@ void EDA_DRAW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
// Notify all tools the preferences have changed // Notify all tools the preferences have changed
if( m_toolManager ) if( m_toolManager )
m_toolManager->RunAction( ACTIONS::updatePreferences, true ); m_toolManager->RunAction( ACTIONS::updatePreferences );
} }
@ -465,11 +465,11 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
// (Only matters on some versions of GTK.) // (Only matters on some versions of GTK.)
wxSafeYield(); wxSafeYield();
m_toolManager->RunAction( ACTIONS::gridProperties, true ); m_toolManager->RunAction( ACTIONS::gridProperties );
} }
else else
{ {
m_toolManager->RunAction( ACTIONS::gridPreset, true, idx ); m_toolManager->RunAction( ACTIONS::gridPreset, idx );
} }
UpdateStatusBar(); UpdateStatusBar();
@ -556,7 +556,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) ) if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
return; return;
m_toolManager->RunAction( ACTIONS::zoomPreset, true, id ); m_toolManager->RunAction( ACTIONS::zoomPreset, id );
UpdateStatusBar(); UpdateStatusBar();
m_canvas->Refresh(); m_canvas->Refresh();
// Needed on Windows because clicking on m_zoomSelectBox remove the focus from m_canvas // Needed on Windows because clicking on m_zoomSelectBox remove the focus from m_canvas
@ -913,7 +913,7 @@ void EDA_DRAW_FRAME::HardRedraw()
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
{ {
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
} }

View File

@ -205,7 +205,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
KeyNameFromKeyCode( aHotKey ) ); KeyNameFromKeyCode( aHotKey ) );
if( runAction ) if( runAction )
return m_toolMgr->RunAction( *context, true ); return m_toolMgr->RunAction( *context );
} }
else if( !global.empty() ) else if( !global.empty() )
{ {
@ -222,7 +222,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
act->GetName(), act->GetName(),
KeyNameFromKeyCode( aHotKey ) ); KeyNameFromKeyCode( aHotKey ) );
if( runAction && m_toolMgr->RunAction( *act, true ) ) if( runAction && m_toolMgr->RunAction( *act ) )
return true; return true;
} }
} }

View File

@ -405,7 +405,7 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
if( type == wxEVT_MENU_OPEN ) if( type == wxEVT_MENU_OPEN )
{ {
if( m_dirty && m_tool ) if( m_dirty && m_tool )
getToolManager()->RunAction<ACTION_MENU*>( ACTIONS::updateMenu, true, this ); getToolManager()->RunAction<ACTION_MENU*>( ACTIONS::updateMenu, this );
wxMenu* parent = dynamic_cast<wxMenu*>( GetParent() ); wxMenu* parent = dynamic_cast<wxMenu*>( GetParent() );

View File

@ -163,7 +163,7 @@ int COMMON_TOOLS::CursorControl( const TOOL_EVENT& aEvent )
} }
getViewControls()->SetCursorPosition( cursor, true, true, type ); getViewControls()->SetCursorPosition( cursor, true, true, type );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
return 0; return 0;
} }

View File

@ -328,7 +328,7 @@ void CVPCB_MAINFRAME::setupEventHandlers()
[this]( wxCommandEvent& ) [this]( wxCommandEvent& )
{ {
// saveAssociations must be run immediately // saveAssociations must be run immediately
GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociationsToFile, true ); GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociationsToFile );
} ); } );
// Connect the handlers for the ok/cancel buttons // Connect the handlers for the ok/cancel buttons
@ -336,7 +336,7 @@ void CVPCB_MAINFRAME::setupEventHandlers()
[this]( wxCommandEvent& ) [this]( wxCommandEvent& )
{ {
// saveAssociations must be run immediately, before running Close( true ) // saveAssociations must be run immediately, before running Close( true )
GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociationsToSchematic, true ); GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociationsToSchematic );
Close( true ); Close( true );
}, wxID_OK ); }, wxID_OK );
Bind( wxEVT_BUTTON, Bind( wxEVT_BUTTON,
@ -503,7 +503,7 @@ void CVPCB_MAINFRAME::updateFootprintViewerOnIdle( wxIdleEvent& aEvent )
// If the footprint view window is displayed, update the footprint. // If the footprint view window is displayed, update the footprint.
if( GetFootprintViewerFrame() ) if( GetFootprintViewerFrame() )
GetToolManager()->RunAction( CVPCB_ACTIONS::showFootprintViewer, true ); GetToolManager()->RunAction( CVPCB_ACTIONS::showFootprintViewer );
DisplayStatus(); DisplayStatus();

View File

@ -572,9 +572,9 @@ void DISPLAY_FOOTPRINTS_FRAME::updateView()
wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL ); wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
if( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED ) if( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED )
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
else else
m_toolManager->RunAction( ACTIONS::centerContents, true ); m_toolManager->RunAction( ACTIONS::centerContents );
UpdateMsgPanel(); UpdateMsgPanel();
} }

View File

@ -205,7 +205,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
void FOOTPRINTS_LISTBOX::OnLeftDClick( wxListEvent& event ) void FOOTPRINTS_LISTBOX::OnLeftDClick( wxListEvent& event )
{ {
GetParent()->GetToolManager()->RunAction( CVPCB_ACTIONS::associate, true ); GetParent()->GetToolManager()->RunAction( CVPCB_ACTIONS::associate );
} }

View File

@ -221,7 +221,7 @@ int CVPCB_ASSOCIATION_TOOL::Associate( const TOOL_EVENT& aEvent )
} }
// Move to the next not associated component // Move to the next not associated component
m_toolMgr->RunAction( CVPCB_ACTIONS::gotoNextNA ); m_toolMgr->PostAction( CVPCB_ACTIONS::gotoNextNA );
return 0; return 0;
} }

View File

@ -70,13 +70,13 @@ int CVPCB_CONTROL::Main( const TOOL_EVENT& aEvent )
{ {
// The right arrow moves focus to the focusable object to the right // The right arrow moves focus to the focusable object to the right
case WXK_RIGHT: case WXK_RIGHT:
m_toolMgr->RunAction( CVPCB_ACTIONS::changeFocusRight ); m_toolMgr->PostAction( CVPCB_ACTIONS::changeFocusRight );
handled = true; handled = true;
break; break;
// The left arrow moves focus to the focusable object to the left // The left arrow moves focus to the focusable object to the left
case WXK_LEFT: case WXK_LEFT:
m_toolMgr->RunAction( CVPCB_ACTIONS::changeFocusLeft ); m_toolMgr->PostAction( CVPCB_ACTIONS::changeFocusLeft );
handled = true; handled = true;
break; break;

View File

@ -64,7 +64,7 @@ int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
} }
else if( evt->IsDblClick( BUT_MIDDLE ) ) else if( evt->IsDblClick( BUT_MIDDLE ) )
{ {
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); m_toolMgr->RunAction( ACTIONS::zoomFitScreen );
} }
else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE ) else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
{ {

View File

@ -215,12 +215,12 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( strcmp( idcmd, "$CONFIG" ) == 0 ) if( strcmp( idcmd, "$CONFIG" ) == 0 )
{ {
GetToolManager()->RunAction( ACTIONS::showSymbolLibTable, true ); GetToolManager()->RunAction( ACTIONS::showSymbolLibTable );
return; return;
} }
else if( strcmp( idcmd, "$ERC" ) == 0 ) else if( strcmp( idcmd, "$ERC" ) == 0 )
{ {
GetToolManager()->RunAction( EE_ACTIONS::runERC, true ); GetToolManager()->RunAction( EE_ACTIONS::runERC );
return; return;
} }
else if( strcmp( idcmd, "$NET:" ) == 0 ) else if( strcmp( idcmd, "$NET:" ) == 0 )
@ -235,7 +235,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
else else
m_highlightedConn = wxEmptyString; m_highlightedConn = wxEmptyString;
GetToolManager()->RunAction( EE_ACTIONS::updateNetHighlighting, true ); GetToolManager()->RunAction( EE_ACTIONS::updateNetHighlighting );
SetStatusText( _( "Selected net:" ) + wxS( " " ) + UnescapeString( netName ) ); SetStatusText( _( "Selected net:" ) + wxS( " " ) + UnescapeString( netName ) );
return; return;
@ -970,7 +970,7 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
break; break;
case MAIL_SCH_UPDATE: case MAIL_SCH_UPDATE:
m_toolManager->RunAction( ACTIONS::updateSchematicFromPcb, true ); m_toolManager->RunAction( ACTIONS::updateSchematicFromPcb );
break; break;
case MAIL_RELOAD_LIB: case MAIL_RELOAD_LIB:

View File

@ -276,7 +276,7 @@ void DIALOG_ERC::OnDeleteOneClick( wxCommandEvent& aEvent )
if( m_notebook->GetSelection() == 0 ) if( m_notebook->GetSelection() == 0 )
{ {
// Clear the selection. It may be the selected ERC marker. // Clear the selection. It may be the selected ERC marker.
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true ); m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_markerTreeModel->DeleteCurrentItem( true ); m_markerTreeModel->DeleteCurrentItem( true );
@ -632,8 +632,8 @@ void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent )
if( !sheet.empty() && sheet != m_parent->GetCurrentSheet() ) if( !sheet.empty() && sheet != m_parent->GetCurrentSheet() )
{ {
m_parent->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true ); m_parent->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true ); m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_parent->SetCurrentSheet( sheet ); m_parent->SetCurrentSheet( sheet );
m_parent->DisplayCurrentSheet(); m_parent->DisplayCurrentSheet();
@ -951,7 +951,7 @@ void DIALOG_ERC::OnSeverity( wxCommandEvent& aEvent )
void DIALOG_ERC::deleteAllMarkers( bool aIncludeExclusions ) void DIALOG_ERC::deleteAllMarkers( bool aIncludeExclusions )
{ {
// Clear current selection list to avoid selection of deleted items // Clear current selection list to avoid selection of deleted items
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true ); m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_markerTreeModel->DeleteItems( false, aIncludeExclusions, false ); m_markerTreeModel->DeleteItems( false, aIncludeExclusions, false );

View File

@ -68,7 +68,7 @@ DIALOG_MIGRATE_BUSES::DIALOG_MIGRATE_BUSES( SCH_EDIT_FRAME* aParent )
loadGraphData(); loadGraphData();
updateUi(); updateUi();
aParent->GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); aParent->GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
} }

View File

@ -286,7 +286,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// Do not leave g_RootSheet == NULL because it is expected to be // Do not leave g_RootSheet == NULL because it is expected to be
// a valid sheet. Therefore create a dummy empty root sheet and screen. // a valid sheet. Therefore create a dummy empty root sheet and screen.
CreateScreens(); CreateScreens();
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
msg.Printf( _( "Failed to load '%s'." ), fullFileName ); msg.Printf( _( "Failed to load '%s'." ), fullFileName );
SetMsgPanel( wxEmptyString, msg ); SetMsgPanel( wxEmptyString, msg );
@ -1287,7 +1287,7 @@ void SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
// Do not leave g_RootSheet == NULL because it is expected to be // Do not leave g_RootSheet == NULL because it is expected to be
// a valid sheet. Therefore create a dummy empty root sheet and screen. // a valid sheet. Therefore create a dummy empty root sheet and screen.
CreateScreens(); CreateScreens();
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
wxString msg = wxString::Format( _( "Error loading schematic '%s'." ), aFileName ); wxString msg = wxString::Format( _( "Error loading schematic '%s'." ), aFileName );
DisplayErrorMessage( this, msg, ioe.What() ); DisplayErrorMessage( this, msg, ioe.What() );
@ -1298,7 +1298,7 @@ void SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
catch( const std::exception& exc ) catch( const std::exception& exc )
{ {
CreateScreens(); CreateScreens();
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
wxString msg = wxString::Format( _( "Unhandled exception occurred loading schematic " wxString msg = wxString::Format( _( "Unhandled exception occurred loading schematic "
"'%s'." ), aFileName ); "'%s'." ), aFileName );

View File

@ -478,7 +478,7 @@ long NL_SCHEMATIC_PLUGIN_IMPL::SetActiveCommand( std::string commandId )
if( runAction ) if( runAction )
{ {
tool_manager->RunAction( *context, true ); tool_manager->RunAction( *context );
} }
} }
else else

View File

@ -305,7 +305,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_SYMBOL* aSymbol )
// If selected make sure all the now-included pins are selected // If selected make sure all the now-included pins are selected
if( aSymbol->IsSelected() ) if( aSymbol->IsSelected() )
m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, true, aSymbol ); m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, aSymbol );
UpdateItem( aSymbol, false, true ); UpdateItem( aSymbol, false, true );
commit.Push( _( "Convert Symbol" ) ); commit.Push( _( "Convert Symbol" ) );

View File

@ -479,7 +479,7 @@ void SCH_EDIT_FRAME::setupTools()
m_toolManager->InitTools(); m_toolManager->InitTools();
// Run the selection tool, it is supposed to be always active // Run the selection tool, it is supposed to be always active
m_toolManager->RunAction( EE_ACTIONS::selectionActivate ); m_toolManager->PostAction( EE_ACTIONS::selectionActivate );
GetCanvas()->SetEventDispatcher( m_toolDispatcher ); GetCanvas()->SetEventDispatcher( m_toolDispatcher );
} }
@ -885,7 +885,7 @@ bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
// Note this this will commit *some* pending changes. For instance, the EE_POINT_EDITOR // Note this this will commit *some* pending changes. For instance, the EE_POINT_EDITOR
// will cancel any drag currently in progress, but commit all changes from previous drags. // will cancel any drag currently in progress, but commit all changes from previous drags.
if( m_toolManager ) if( m_toolManager )
m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); m_toolManager->RunAction( ACTIONS::cancelInteractive );
// Shutdown blocks must be determined and vetoed as early as possible // Shutdown blocks must be determined and vetoed as early as possible
if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION
@ -1256,7 +1256,7 @@ void SCH_EDIT_FRAME::OnFindDialogClose()
m_findReplaceDialog->Destroy(); m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr; m_findReplaceDialog = nullptr;
m_toolManager->RunAction( ACTIONS::updateFind, true ); m_toolManager->RunAction( ACTIONS::updateFind );
} }
@ -1664,7 +1664,7 @@ void SCH_EDIT_FRAME::updateTitle()
void SCH_EDIT_FRAME::initScreenZoom() void SCH_EDIT_FRAME::initScreenZoom()
{ {
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
GetScreen()->m_zoomInitialized = true; GetScreen()->m_zoomInitialized = true;
} }
@ -1965,7 +1965,7 @@ void SCH_EDIT_FRAME::UpdateNetHighlightStatus()
void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen ) void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
{ {
if( m_toolManager ) if( m_toolManager )
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection );
SCH_BASE_FRAME::SetScreen( aScreen ); SCH_BASE_FRAME::SetScreen( aScreen );
GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) ); GetCanvas()->DisplaySheet( static_cast<SCH_SCREEN*>( aScreen ) );
@ -2067,7 +2067,7 @@ void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
// We only need this until the frame is done resizing and the final client size is // We only need this until the frame is done resizing and the final client size is
// established. // established.
Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this ); Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
} }
// Skip() is called in the base class. // Skip() is called in the base class.
@ -2149,13 +2149,13 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
{ {
wxCHECK( m_toolManager, /* void */ ); wxCHECK( m_toolManager, /* void */ );
m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); m_toolManager->RunAction( ACTIONS::cancelInteractive );
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection );
SCH_SCREEN* screen = GetCurrentSheet().LastScreen(); SCH_SCREEN* screen = GetCurrentSheet().LastScreen();
wxCHECK( screen, /* void */ ); wxCHECK( screen, /* void */ );
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection );
SCH_BASE_FRAME::SetScreen( screen ); SCH_BASE_FRAME::SetScreen( screen );

View File

@ -287,7 +287,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
if( eda_item->Type() == SCH_SHEET_T ) if( eda_item->Type() == SCH_SHEET_T )
{ {
if( static_cast<SCH_SHEET*>( eda_item )->GetScreen() == GetScreen() ) if( static_cast<SCH_SHEET*>( eda_item )->GetScreen() == GetScreen() )
GetToolManager()->RunAction( EE_ACTIONS::leaveSheet ); GetToolManager()->PostAction( EE_ACTIONS::leaveSheet );
} }
SCH_ITEM* schItem = static_cast<SCH_ITEM*>( eda_item ); SCH_ITEM* schItem = static_cast<SCH_ITEM*>( eda_item );

View File

@ -613,7 +613,7 @@ void SIMULATOR_FRAME::doCloseWindow()
m_simulator->Clean(); m_simulator->Clean();
// Cancel a running simProbe or simTune tool // Cancel a running simProbe or simTune tool
m_schematicFrame->GetToolManager()->RunAction( ACTIONS::cancelInteractive ); m_schematicFrame->GetToolManager()->PostAction( ACTIONS::cancelInteractive );
SaveSettings( config() ); SaveSettings( config() );

View File

@ -223,7 +223,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
bbox.SetSize( max_size_x, max_size_y ); bbox.SetSize( max_size_x, max_size_y );
GetCanvas()->GetView()->SetBoundary( bbox ); GetCanvas()->GetView()->SetBoundary( bbox );
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
m_acceptedExts.emplace( KiCadSymbolLibFileExtension, &ACTIONS::ddAddLibrary ); m_acceptedExts.emplace( KiCadSymbolLibFileExtension, &ACTIONS::ddAddLibrary );
DragAcceptFiles( true ); DragAcceptFiles( true );
@ -660,8 +660,8 @@ void SYMBOL_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event )
if( ( i == wxNOT_FOUND ) || ( ( i + 1 ) == m_unit ) ) if( ( i == wxNOT_FOUND ) || ( ( i + 1 ) == m_unit ) )
return; return;
m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); m_toolManager->RunAction( ACTIONS::cancelInteractive );
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection );
m_unit = i + 1; m_unit = i + 1;
@ -717,7 +717,7 @@ wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom ) void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
{ {
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection );
GetCanvas()->GetView()->Clear(); GetCanvas()->GetView()->Clear();
delete m_symbol; delete m_symbol;
@ -748,7 +748,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
GetCanvas()->GetView()->ClearHiddenFlags(); GetCanvas()->GetView()->ClearHiddenFlags();
if( aUpdateZoom ) if( aUpdateZoom )
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
GetCanvas()->Refresh(); GetCanvas()->Refresh();
@ -1152,7 +1152,7 @@ void SYMBOL_EDIT_FRAME::emptyScreen()
SetCurSymbol( nullptr, false ); SetCurSymbol( nullptr, false );
SetScreen( m_dummyScreen ); SetScreen( m_dummyScreen );
ClearUndoRedoList(); ClearUndoRedoList();
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
Refresh(); Refresh();
} }

View File

@ -241,7 +241,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, in
m_SyncPinEdit = GetCurSymbol()->IsMulti() && !GetCurSymbol()->UnitsLocked(); m_SyncPinEdit = GetCurSymbol()->IsMulti() && !GetCurSymbol()->UnitsLocked();
ClearUndoRedoList(); ClearUndoRedoList();
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
SetShowDeMorgan( GetCurSymbol()->Flatten()->HasConversion() ); SetShowDeMorgan( GetCurSymbol()->Flatten()->HasConversion() );
if( aUnit > 0 ) if( aUnit > 0 )
@ -265,7 +265,7 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux( LIB_SYMBOL* aEntry, const wxStr
return false; return false;
} }
m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); m_toolManager->RunAction( ACTIONS::cancelInteractive );
// Symbols from the schematic are edited in place and not managed by the library manager. // Symbols from the schematic are edited in place and not managed by the library manager.
if( IsSymbolFromSchematic() ) if( IsSymbolFromSchematic() )
@ -336,7 +336,7 @@ void SYMBOL_EDIT_FRAME::SaveAll()
void SYMBOL_EDIT_FRAME::CreateNewSymbol( const wxString& inheritFromSymbolName ) void SYMBOL_EDIT_FRAME::CreateNewSymbol( const wxString& inheritFromSymbolName )
{ {
m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); m_toolManager->RunAction( ACTIONS::cancelInteractive );
wxArrayString rootSymbols; wxArrayString rootSymbols;
wxString lib = getTargetLib(); wxString lib = getTargetLib();
@ -1032,7 +1032,7 @@ bool SYMBOL_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
SCH_IO_MGR::SCH_FILE_T fileType = SCH_IO_MGR::SCH_FILE_T::SCH_KICAD; SCH_IO_MGR::SCH_FILE_T fileType = SCH_IO_MGR::SCH_FILE_T::SCH_KICAD;
PROJECT& prj = Prj(); PROJECT& prj = Prj();
m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); m_toolManager->RunAction( ACTIONS::cancelInteractive );
if( !aNewFile && ( aLibrary.empty() || !prj.SchSymbolLibTable()->HasLibrary( aLibrary ) ) ) if( !aNewFile && ( aLibrary.empty() || !prj.SchSymbolLibTable()->HasLibrary( aLibrary ) ) )
{ {

View File

@ -62,7 +62,7 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromRedoList()
if( GetRedoCommandCount() <= 0 ) if( GetRedoCommandCount() <= 0 )
return; return;
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection );
// Load the last redo entry // Load the last redo entry
PICKED_ITEMS_LIST* redoCommand = PopCommandFromRedoList(); PICKED_ITEMS_LIST* redoCommand = PopCommandFromRedoList();
@ -115,7 +115,7 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromUndoList()
if( GetUndoCommandCount() <= 0 ) if( GetUndoCommandCount() <= 0 )
return; return;
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection );
// Load the last undo entry // Load the last undo entry
PICKED_ITEMS_LIST* undoCommand = PopCommandFromUndoList(); PICKED_ITEMS_LIST* undoCommand = PopCommandFromUndoList();
@ -165,7 +165,7 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromUndoList()
void SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo() void SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo()
{ {
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); m_toolManager->RunAction( EE_ACTIONS::clearSelection );
// Load the last undo entry // Load the last undo entry
PICKED_ITEMS_LIST* undoCommand = PopCommandFromUndoList(); PICKED_ITEMS_LIST* undoCommand = PopCommandFromUndoList();

View File

@ -266,7 +266,7 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
bbox.SetOrigin( -max_size_x / 2, -max_size_y / 2 ); bbox.SetOrigin( -max_size_x / 2, -max_size_y / 2 );
bbox.SetSize( max_size_x, max_size_y ); bbox.SetSize( max_size_x, max_size_y );
GetCanvas()->GetView()->SetBoundary( bbox ); GetCanvas()->GetView()->SetBoundary( bbox );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
// If a symbol was previously selected in m_symbolList from a previous run, show it // If a symbol was previously selected in m_symbolList from a previous run, show it
wxString symbName = m_symbolList->GetStringSelection(); wxString symbName = m_symbolList->GetStringSelection();
@ -492,7 +492,7 @@ void SYMBOL_VIEWER_FRAME::updatePreviewSymbol()
AppendMsgPanel( _( "Keywords" ), m_previewItem->GetKeyWords() ); AppendMsgPanel( _( "Keywords" ), m_previewItem->GetKeyWords() );
} }
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
GetCanvas()->Refresh(); GetCanvas()->Refresh();
} }
@ -921,7 +921,7 @@ void SYMBOL_VIEWER_FRAME::SetSelectedSymbol( const wxString& aSymbolName )
void SYMBOL_VIEWER_FRAME::DClickOnSymbolList( wxCommandEvent& event ) void SYMBOL_VIEWER_FRAME::DClickOnSymbolList( wxCommandEvent& event )
{ {
m_toolManager->RunAction( EE_ACTIONS::addSymbolToSchematic, true ); m_toolManager->RunAction( EE_ACTIONS::addSymbolToSchematic );
} }

View File

@ -483,9 +483,9 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
EDA_ITEM* item = m_selection.Front(); EDA_ITEM* item = m_selection.Front();
if( item && item->Type() == SCH_SHEET_T ) if( item && item->Type() == SCH_SHEET_T )
m_toolMgr->RunAction( EE_ACTIONS::enterSheet ); m_toolMgr->PostAction( EE_ACTIONS::enterSheet );
else else
m_toolMgr->RunAction( EE_ACTIONS::properties ); m_toolMgr->PostAction( EE_ACTIONS::properties );
} }
else if( evt->IsDblClick( BUT_MIDDLE ) ) else if( evt->IsDblClick( BUT_MIDDLE ) )
{ {
@ -493,9 +493,9 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
// Middle double click? Do zoom to fit or zoom to objects // Middle double click? Do zoom to fit or zoom to objects
if( evt->Modifier( MD_CTRL ) ) // Is CTRL key down? if( evt->Modifier( MD_CTRL ) ) // Is CTRL key down?
m_toolMgr->RunAction( ACTIONS::zoomFitObjects, true ); m_toolMgr->RunAction( ACTIONS::zoomFitObjects );
else else
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); m_toolMgr->RunAction( ACTIONS::zoomFitScreen );
} }
else if( evt->IsDrag( BUT_LEFT ) ) else if( evt->IsDrag( BUT_LEFT ) )
{ {
@ -561,11 +561,11 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
} }
else if( evt->IsMouseDown( BUT_AUX1 ) ) else if( evt->IsMouseDown( BUT_AUX1 ) )
{ {
m_toolMgr->RunAction( EE_ACTIONS::navigateBack, true ); m_toolMgr->RunAction( EE_ACTIONS::navigateBack );
} }
else if( evt->IsMouseDown( BUT_AUX2 ) ) else if( evt->IsMouseDown( BUT_AUX2 ) )
{ {
m_toolMgr->RunAction( EE_ACTIONS::navigateForward, true ); m_toolMgr->RunAction( EE_ACTIONS::navigateForward );
} }
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE ) else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
{ {
@ -585,7 +585,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
&& *evt->GetCommandId() <= ID_POPUP_SCH_UNFOLD_BUS_END ) && *evt->GetCommandId() <= ID_POPUP_SCH_UNFOLD_BUS_END )
{ {
wxString* net = new wxString( *evt->Parameter<wxString*>() ); wxString* net = new wxString( *evt->Parameter<wxString*>() );
m_toolMgr->RunAction<wxString*>( EE_ACTIONS::unfoldBus, true, net ); m_toolMgr->RunAction<wxString*>( EE_ACTIONS::unfoldBus, net );
} }
} }
else if( evt->IsCancelInteractive() ) else if( evt->IsCancelInteractive() )
@ -907,7 +907,7 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& a
// Try to call selectionMenu via RunAction() to avoid event-loop contention // Try to call selectionMenu via RunAction() to avoid event-loop contention
// But it we cannot handle the event, then we don't have an active tool loop, so // But it we cannot handle the event, then we don't have an active tool loop, so
// handle it directly. // handle it directly.
if( !m_toolMgr->RunAction<COLLECTOR*>( EE_ACTIONS::selectionMenu, true, &aCollector ) ) if( !m_toolMgr->RunAction<COLLECTOR*>( EE_ACTIONS::selectionMenu, &aCollector ) )
{ {
if( !doSelectionMenu( &aCollector ) ) if( !doSelectionMenu( &aCollector ) )
aCollector.m_MenuCancelled = true; aCollector.m_MenuCancelled = true;

View File

@ -153,7 +153,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
{ {
m_frame->SaveCopyForRepeatItem( aSymbol ); m_frame->SaveCopyForRepeatItem( aSymbol );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_selectionTool->AddItemToSel( aSymbol ); m_selectionTool->AddItemToSel( aSymbol );
aSymbol->SetFlags( IS_NEW | IS_MOVING ); aSymbol->SetFlags( IS_NEW | IS_MOVING );
@ -163,7 +163,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
// Set IS_MOVING again, as AddItemToCommitAndScreen() will have cleared it. // Set IS_MOVING again, as AddItemToCommitAndScreen() will have cleared it.
aSymbol->SetFlags( IS_MOVING ); aSymbol->SetFlags( IS_MOVING );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
}; };
auto setCursor = auto setCursor =
@ -176,7 +176,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&]() [&]()
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_view->ClearPreview(); m_view->ClearPreview();
delete symbol; delete symbol;
symbol = nullptr; symbol = nullptr;
@ -299,7 +299,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
{ {
if( !symbol ) if( !symbol )
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
// Pick the symbol to be placed // Pick the symbol to be placed
bool footprintPreviews = m_frame->eeconfig()->m_Appearance.footprint_preview; bool footprintPreviews = m_frame->eeconfig()->m_Appearance.footprint_preview;
@ -422,7 +422,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
if( symbol ) if( symbol )
{ {
m_frame->SelectUnit( symbol, unit ); m_frame->SelectUnit( symbol, unit );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
} }
} }
@ -486,7 +486,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
REENTRANCY_GUARD guard( &m_inPlaceImage ); REENTRANCY_GUARD guard( &m_inPlaceImage );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
// Add all the drawable symbols to preview // Add all the drawable symbols to preview
if( image ) if( image )
@ -510,7 +510,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->RecacheAllItems(); m_view->RecacheAllItems();
delete image; delete image;
@ -528,7 +528,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
// Prime the pump // Prime the pump
if( image ) if( image )
{ {
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else if( aEvent.HasPosition() ) else if( aEvent.HasPosition() )
{ {
@ -601,7 +601,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
{ {
if( !image ) if( !image )
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
wxFileDialog dlg( m_frame, _( "Choose Image" ), m_mruPath, wxEmptyString, wxFileDialog dlg( m_frame, _( "Choose Image" ), m_mruPath, wxEmptyString,
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(), _( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
@ -658,7 +658,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
commit.Push( _( "Add Image" ) ); commit.Push( _( "Add Image" ) );
image = nullptr; image = nullptr;
m_toolMgr->RunAction( ACTIONS::activatePointEditor ); m_toolMgr->PostAction( ACTIONS::activatePointEditor );
m_view->ClearPreview(); m_view->ClearPreview();
@ -766,7 +766,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
cursorPos = aEvent.HasPosition() ? aEvent.Position() : controls->GetMousePosition(); cursorPos = aEvent.HasPosition() ? aEvent.Position() : controls->GetMousePosition();
@ -793,7 +793,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
if( aEvent.HasPosition() && type != SCH_SHEET_PIN_T ) if( aEvent.HasPosition() && type != SCH_SHEET_PIN_T )
m_toolMgr->PrimeTool( aEvent.Position() ); m_toolMgr->PrimeTool( aEvent.Position() );
else else
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
// Main loop: keep receiving events // Main loop: keep receiving events
while( TOOL_EVENT* evt = Wait() ) while( TOOL_EVENT* evt = Wait() )
@ -1161,7 +1161,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( isSheetPin ) if( isSheetPin )
sheet = dynamic_cast<SCH_SHEET*>( m_selectionTool->GetSelection().Front() ); sheet = dynamic_cast<SCH_SHEET*>( m_selectionTool->GetSelection().Front() );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -1199,7 +1199,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&]() [&]()
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_view->ClearPreview(); m_view->ClearPreview();
delete item; delete item;
item = nullptr; item = nullptr;
@ -1289,7 +1289,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
// First click creates... // First click creates...
if( !item ) if( !item )
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( isText ) if( isText )
{ {
@ -1380,7 +1380,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( item->Type() != SCH_SHEET_PIN_T ) if( item->Type() != SCH_SHEET_PIN_T )
m_selectionTool->AddItemToSel( item ); m_selectionTool->AddItemToSel( item );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
// update the cursor so it looks correct before another event // update the cursor so it looks correct before another event
setCursor(); setCursor();
@ -1509,7 +1509,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
// gets whacked. // gets whacked.
m_toolMgr->DeactivateTool(); m_toolMgr->DeactivateTool();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -1522,7 +1522,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_view->ClearPreview(); m_view->ClearPreview();
delete item; delete item;
item = nullptr; item = nullptr;
@ -1591,7 +1591,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
} }
else if( evt->IsClick( BUT_LEFT ) && !item ) else if( evt->IsClick( BUT_LEFT ) && !item )
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( isTextBox ) if( isTextBox )
{ {
@ -1677,7 +1677,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
item = nullptr; item = nullptr;
m_view->ClearPreview(); m_view->ClearPreview();
m_toolMgr->RunAction( ACTIONS::activatePointEditor ); m_toolMgr->PostAction( ACTIONS::activatePointEditor );
} }
} }
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) ) else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
@ -1689,7 +1689,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
} }
else if( evt->IsDblClick( BUT_LEFT ) && !item ) else if( evt->IsDblClick( BUT_LEFT ) && !item )
{ {
m_toolMgr->RunAction( EE_ACTIONS::properties, true ); m_toolMgr->RunAction( EE_ACTIONS::properties );
} }
else if( evt->IsClick( BUT_RIGHT ) ) else if( evt->IsClick( BUT_RIGHT ) )
{ {
@ -1729,7 +1729,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
REENTRANCY_GUARD guard( &m_inDrawSheet ); REENTRANCY_GUARD guard( &m_inDrawSheet );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -1742,7 +1742,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_view->ClearPreview(); m_view->ClearPreview();
delete sheet; delete sheet;
sheet = nullptr; sheet = nullptr;
@ -1831,12 +1831,12 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
} }
else if( evt->IsDblClick( BUT_LEFT ) ) else if( evt->IsDblClick( BUT_LEFT ) )
{ {
m_toolMgr->RunAction( EE_ACTIONS::enterSheet, false ); m_toolMgr->PostAction( EE_ACTIONS::enterSheet );
break; break;
} }
} }
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), cursorPos ); sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), cursorPos );
sheet->SetFlags( IS_NEW | IS_MOVING ); sheet->SetFlags( IS_NEW | IS_MOVING );

View File

@ -909,14 +909,14 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( moving ) if( moving )
{ {
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else else
{ {
EE_SELECTION selectionCopy = selection; EE_SELECTION selectionCopy = selection;
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
SCH_LINE_WIRE_BUS_TOOL* lwbTool = m_toolMgr->GetTool<SCH_LINE_WIRE_BUS_TOOL>(); SCH_LINE_WIRE_BUS_TOOL* lwbTool = m_toolMgr->GetTool<SCH_LINE_WIRE_BUS_TOOL>();
lwbTool->TrimOverLappingWires( commit, &selectionCopy ); lwbTool->TrimOverLappingWires( commit, &selectionCopy );
@ -1111,7 +1111,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
EE_SELECTION selectionCopy = selection; EE_SELECTION selectionCopy = selection;
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( connections ) if( connections )
{ {
@ -1213,12 +1213,12 @@ int SCH_EDIT_TOOL::Swap( const TOOL_EVENT& aEvent )
if( isMoving ) if( isMoving )
{ {
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else else
{ {
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( connections ) if( connections )
m_frame->TestDanglingEnds(); m_frame->TestDanglingEnds();
@ -1237,7 +1237,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
if( sourceItems.empty() ) if( sourceItems.empty() )
return 0; return 0;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
SCH_COMMIT commit( m_toolMgr ); SCH_COMMIT commit( m_toolMgr );
EE_SELECTION newItems; EE_SELECTION newItems;
@ -1267,7 +1267,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_y ) ) ); schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_y ) ) );
} }
m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, true, newItem ); m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, newItem );
newItem->SetFlags( IS_NEW ); newItem->SetFlags( IS_NEW );
m_frame->AddToScreen( newItem, m_frame->GetScreen() ); m_frame->AddToScreen( newItem, m_frame->GetScreen() );
commit.Added( newItem, m_frame->GetScreen() ); commit.Added( newItem, m_frame->GetScreen() );
@ -1288,7 +1288,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
annotateStartNum, false, false, reporter ); annotateStartNum, false, false, reporter );
} }
m_toolMgr->RunAction( EE_ACTIONS::move, true, &commit ); m_toolMgr->RunAction( EE_ACTIONS::move, &commit );
while( m_toolMgr->GetTool<SCH_MOVE_TOOL>()->IsToolActive() ) while( m_toolMgr->GetTool<SCH_MOVE_TOOL>()->IsToolActive() )
{ {
@ -1360,7 +1360,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
return 0; return 0;
// Don't leave a freed pointer in the selection // Don't leave a freed pointer in the selection
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
for( EDA_ITEM* item : items ) for( EDA_ITEM* item : items )
item->ClearFlags( STRUCT_DELETED ); item->ClearFlags( STRUCT_DELETED );
@ -1439,7 +1439,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
{ {
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>(); PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_pickerItem = nullptr; m_pickerItem = nullptr;
// Deactivate other tools; particularly important if another PICKER is currently running // Deactivate other tools; particularly important if another PICKER is currently running
@ -1456,7 +1456,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selectionTool->UnbrightenItem( m_pickerItem ); selectionTool->UnbrightenItem( m_pickerItem );
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ ); selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
m_toolMgr->RunAction( ACTIONS::doDelete, true ); m_toolMgr->RunAction( ACTIONS::doDelete );
m_pickerItem = nullptr; m_pickerItem = nullptr;
} }
@ -1494,10 +1494,10 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem ); m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
// Wake the selection tool after exiting to ensure the cursor gets updated // Wake the selection tool after exiting to ensure the cursor gets updated
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); m_toolMgr->PostAction( EE_ACTIONS::selectionActivate );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }
@ -1587,7 +1587,7 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
} }
if( clearSelection ) if( clearSelection )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
return 0; return 0;
} }
@ -1627,7 +1627,7 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
if( moving ) if( moving )
{ {
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else else
{ {
@ -1635,7 +1635,7 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
commit.Push( _( "Autoplace Fields" ) ); commit.Push( _( "Autoplace Fields" ) );
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
} }
return 0; return 0;
@ -1693,10 +1693,10 @@ int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
m_frame->ConvertPart( symbol ); m_frame->ConvertPart( symbol );
if( symbol->IsNew() ) if( symbol->IsNew() )
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
return 0; return 0;
} }
@ -1715,7 +1715,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false ); VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
if( ds && ds->HitTestDrawingSheetItems( getView(), cursorPos ) ) if( ds && ds->HitTestDrawingSheetItems( getView(), cursorPos ) )
m_toolMgr->RunAction( ACTIONS::pageSettings ); m_toolMgr->PostAction( ACTIONS::pageSettings );
} }
return 0; return 0;
@ -2003,7 +2003,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
updateItem( curr_item, true ); updateItem( curr_item, true );
if( clearSelection ) if( clearSelection )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
return 0; return 0;
} }
@ -2312,7 +2312,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
} }
if( selected ) if( selected )
m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::removeItemFromSel, true, item ); m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::removeItemFromSel, item );
SCH_COMMIT commit( m_toolMgr ); SCH_COMMIT commit( m_toolMgr );
@ -2328,7 +2328,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
commit.Push( _( "Change Item Type" ) ); commit.Push( _( "Change Item Type" ) );
if( selected ) if( selected )
m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, true, newtext ); m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, newtext );
// Otherwise, pointer is owned by the undo stack // Otherwise, pointer is owned by the undo stack
if( item->IsNew() ) if( item->IsNew() )
@ -2349,7 +2349,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
} }
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
return 0; return 0;
} }
@ -2410,7 +2410,7 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
m_frame->TestDanglingEnds(); m_frame->TestDanglingEnds();
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();
m_toolMgr->RunAction( EE_ACTIONS::drag, true, &commit ); m_toolMgr->RunAction( EE_ACTIONS::drag, &commit );
while( m_toolMgr->GetTool<SCH_MOVE_TOOL>()->IsToolActive() ) while( m_toolMgr->GetTool<SCH_MOVE_TOOL>()->IsToolActive() )
{ {
@ -2445,7 +2445,7 @@ int SCH_EDIT_TOOL::CleanupSheetPins( const TOOL_EVENT& aEvent )
m_frame->OnModify(); m_frame->OnModify();
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
return 0; return 0;
} }

View File

@ -132,8 +132,8 @@ int SCH_EDITOR_CONTROL::Revert( const TOOL_EVENT& aEvent )
if( m_frame->GetCurrentSheet().Last() != &root ) if( m_frame->GetCurrentSheet().Last() != &root )
{ {
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true ); m_toolMgr->RunAction( ACTIONS::cancelInteractive );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
// Store the current zoom level into the current screen before switching // Store the current zoom level into the current screen before switching
m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale(); m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale();
@ -656,10 +656,10 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
} }
// Wake the selection tool after exiting to ensure the cursor gets updated // Wake the selection tool after exiting to ensure the cursor gets updated
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); m_toolMgr->PostAction( EE_ACTIONS::selectionActivate );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }
@ -746,10 +746,10 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
// ( avoid crash in some cases when the SimTune tool is deselected ) // ( avoid crash in some cases when the SimTune tool is deselected )
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selectionTool->ClearSelection(); selectionTool->ClearSelection();
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); m_toolMgr->PostAction( EE_ACTIONS::selectionActivate );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }
@ -1196,7 +1196,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
return highlightNet( m_toolMgr, aPos ); return highlightNet( m_toolMgr, aPos );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }
@ -1301,7 +1301,7 @@ bool SCH_EDITOR_CONTROL::doCopy( bool aUseDuplicateClipboard )
plugin.Format( &selection, &selPath, schematic, &formatter, true ); plugin.Format( &selection, &selPath, schematic, &formatter, true );
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( aUseDuplicateClipboard ) if( aUseDuplicateClipboard )
{ {
@ -1346,7 +1346,7 @@ int SCH_EDITOR_CONTROL::Cut( const TOOL_EVENT& aEvent )
} }
if( doCopy() ) if( doCopy() )
m_toolMgr->RunAction( ACTIONS::doDelete, true ); m_toolMgr->RunAction( ACTIONS::doDelete );
return 0; return 0;
} }
@ -1853,8 +1853,8 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
m_frame->GetCurrentSheet().UpdateAllScreenReferences(); m_frame->GetCurrentSheet().UpdateAllScreenReferences();
// Now clear the previous selection, select the pasted items, and fire up the "move" tool. // Now clear the previous selection, select the pasted items, and fire up the "move" tool.
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, true, &loadedItems ); m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, &loadedItems );
EE_SELECTION& selection = selTool->GetSelection(); EE_SELECTION& selection = selTool->GetSelection();
@ -1952,7 +1952,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
selection.SetReferencePoint( item->GetPosition() ); selection.SetReferencePoint( item->GetPosition() );
} }
m_toolMgr->RunAction( EE_ACTIONS::move, true, &commit ); m_toolMgr->RunAction( EE_ACTIONS::move, &commit );
while( m_toolMgr->GetTool<SCH_MOVE_TOOL>()->IsToolActive() ) while( m_toolMgr->GetTool<SCH_MOVE_TOOL>()->IsToolActive() )
{ {
@ -1979,7 +1979,7 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
symbol = (SCH_SYMBOL*) selection.Front(); symbol = (SCH_SYMBOL*) selection.Front();
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( !symbol || symbol->GetEditFlags() != 0 ) if( !symbol || symbol->GetEditFlags() != 0 )
return 0; return 0;
@ -1991,7 +1991,7 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
m_toolMgr->RunAction( ACTIONS::showSymbolEditor, true ); m_toolMgr->RunAction( ACTIONS::showSymbolEditor );
symbolEditor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false ); symbolEditor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
if( symbolEditor ) if( symbolEditor )
@ -2232,7 +2232,7 @@ int SCH_EDITOR_CONTROL::ToggleOPCurrents( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::ChangeLineMode( const TOOL_EVENT& aEvent ) int SCH_EDITOR_CONTROL::ChangeLineMode( const TOOL_EVENT& aEvent )
{ {
m_frame->eeconfig()->m_Drawing.line_mode = aEvent.Parameter<LINE_MODE>(); m_frame->eeconfig()->m_Drawing.line_mode = aEvent.Parameter<LINE_MODE>();
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
return 0; return 0;
} }
@ -2241,7 +2241,7 @@ int SCH_EDITOR_CONTROL::NextLineMode( const TOOL_EVENT& aEvent )
{ {
m_frame->eeconfig()->m_Drawing.line_mode++; m_frame->eeconfig()->m_Drawing.line_mode++;
m_frame->eeconfig()->m_Drawing.line_mode %= LINE_MODE::LINE_MODE_COUNT; m_frame->eeconfig()->m_Drawing.line_mode %= LINE_MODE::LINE_MODE_COUNT;
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
return 0; return 0;
} }

View File

@ -290,7 +290,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
const DRAW_SEGMENT_EVENT_PARAMS* params = aEvent.Parameter<const DRAW_SEGMENT_EVENT_PARAMS*>(); const DRAW_SEGMENT_EVENT_PARAMS* params = aEvent.Parameter<const DRAW_SEGMENT_EVENT_PARAMS*>();
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( aEvent.HasPosition() ) if( aEvent.HasPosition() )
{ {
@ -381,7 +381,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const VECTO
if( aPos == VECTOR2I( 0, 0 ) ) if( aPos == VECTOR2I( 0, 0 ) )
pos = static_cast<VECTOR2I>( getViewControls()->GetCursorPosition() ); pos = static_cast<VECTOR2I>( getViewControls()->GetCursorPosition() );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos ); m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos );
m_busUnfold.entry->SetParent( m_frame->GetScreen() ); m_busUnfold.entry->SetParent( m_frame->GetScreen() );
@ -584,7 +584,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
for( SCH_LINE* wire : m_wires ) for( SCH_LINE* wire : m_wires )
delete wire; delete wire;
@ -962,7 +962,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos, currentMode, computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos, currentMode,
posture ); posture );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@ -997,7 +997,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
if( m_busUnfold.in_progress ) if( m_busUnfold.in_progress )
{ {
m_busUnfold.label->Rotate90( evt->IsAction( &EE_ACTIONS::rotateCW ) ); m_busUnfold.label->Rotate90( evt->IsAction( &EE_ACTIONS::rotateCW ) );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else else
{ {
@ -1121,7 +1121,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
// Clear selection when done so that a new wire can be started. // Clear selection when done so that a new wire can be started.
// NOTE: this must be done before simplifyWireList is called or we might end up with // NOTE: this must be done before simplifyWireList is called or we might end up with
// freed selected items. // freed selected items.
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
SCH_SCREEN* screen = m_frame->GetScreen(); SCH_SCREEN* screen = m_frame->GetScreen();
SCH_COMMIT commit( m_toolMgr ); SCH_COMMIT commit( m_toolMgr );

View File

@ -414,13 +414,13 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
// And give it a kick so it doesn't have to wait for the first mouse movement // And give it a kick so it doesn't have to wait for the first mouse movement
// to refresh. // to refresh.
m_toolMgr->RunAction( EE_ACTIONS::restartMove ); m_toolMgr->PostAction( EE_ACTIONS::restartMove );
} }
} }
else else
{ {
// The tool hotkey is interpreted as a click when already dragging/moving // The tool hotkey is interpreted as a click when already dragging/moving
m_toolMgr->RunAction( ACTIONS::cursorClick ); m_toolMgr->PostAction( ACTIONS::cursorClick );
} }
return 0; return 0;
@ -842,11 +842,11 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
} }
else if( evt->IsAction( &EE_ACTIONS::rotateCW ) ) else if( evt->IsAction( &EE_ACTIONS::rotateCW ) )
{ {
m_toolMgr->RunAction( EE_ACTIONS::rotateCW, true, &commit ); m_toolMgr->RunAction( EE_ACTIONS::rotateCW, &commit );
} }
else if( evt->IsAction( &EE_ACTIONS::rotateCCW ) ) else if( evt->IsAction( &EE_ACTIONS::rotateCCW ) )
{ {
m_toolMgr->RunAction( EE_ACTIONS::rotateCCW, true, &commit ); m_toolMgr->RunAction( EE_ACTIONS::rotateCCW, &commit );
} }
else if( evt->Action() == TA_CHOICE_MENU_CHOICE ) else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
{ {
@ -859,7 +859,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
if( symbol ) if( symbol )
{ {
m_frame->SelectUnit( symbol, unit ); m_frame->SelectUnit( symbol, unit );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
} }
} }
@ -982,7 +982,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
item->ClearEditFlags(); item->ClearEditFlags();
if( unselect ) if( unselect )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
else else
m_selectionTool->RebuildSelection(); // Schematic cleanup might have merged lines, etc. m_selectionTool->RebuildSelection(); // Schematic cleanup might have merged lines, etc.

View File

@ -106,8 +106,8 @@ int SCH_NAVIGATE_TOOL::Forward( const TOOL_EVENT& aEvent )
{ {
m_navIndex++; m_navIndex++;
m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true ); m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true ); m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_frame->SetCurrentSheet( *m_navIndex ); m_frame->SetCurrentSheet( *m_navIndex );
m_frame->DisplayCurrentSheet(); m_frame->DisplayCurrentSheet();
@ -127,8 +127,8 @@ int SCH_NAVIGATE_TOOL::Back( const TOOL_EVENT& aEvent )
{ {
m_navIndex--; m_navIndex--;
m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true ); m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true ); m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
m_frame->SetCurrentSheet( *m_navIndex ); m_frame->SetCurrentSheet( *m_navIndex );
m_frame->DisplayCurrentSheet(); m_frame->DisplayCurrentSheet();
@ -278,8 +278,8 @@ void SCH_NAVIGATE_TOOL::pushToHistory( SCH_SHEET_PATH aPath )
void SCH_NAVIGATE_TOOL::changeSheet( SCH_SHEET_PATH aPath ) void SCH_NAVIGATE_TOOL::changeSheet( SCH_SHEET_PATH aPath )
{ {
m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true ); m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true ); m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
// Store the current zoom level into the current screen before switching // Store the current zoom level into the current screen before switching
m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale(); m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale();

View File

@ -314,7 +314,7 @@ int SIMULATOR_CONTROL::Probe( const TOOL_EVENT& aEvent )
if( blocking_dialog ) if( blocking_dialog )
blocking_dialog->Close( true ); blocking_dialog->Close( true );
m_schematicFrame->GetToolManager()->RunAction( EE_ACTIONS::simProbe ); m_schematicFrame->GetToolManager()->PostAction( EE_ACTIONS::simProbe );
m_schematicFrame->Raise(); m_schematicFrame->Raise();
return 0; return 0;
@ -331,7 +331,7 @@ int SIMULATOR_CONTROL::Tune( const TOOL_EVENT& aEvent )
if( blocking_dialog ) if( blocking_dialog )
blocking_dialog->Close( true ); blocking_dialog->Close( true );
m_schematicFrame->GetToolManager()->RunAction( EE_ACTIONS::simTune ); m_schematicFrame->GetToolManager()->PostAction( EE_ACTIONS::simTune );
m_schematicFrame->Raise(); m_schematicFrame->Raise();
return 0; return 0;

View File

@ -416,8 +416,8 @@ int SYMBOL_EDITOR_CONTROL::OnDeMorgan( const TOOL_EVENT& aEvent )
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
{ {
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true ); m_toolMgr->RunAction( ACTIONS::cancelInteractive );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
SYMBOL_EDIT_FRAME* symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame ); SYMBOL_EDIT_FRAME* symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
symbolEditor->SetConvert( convert ); symbolEditor->SetConvert( convert );
@ -681,7 +681,7 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent )
symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false ); symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
schframe->Raise(); schframe->Raise();
schframe->GetToolManager()->RunAction( EE_ACTIONS::placeSymbol, false, symbol ); schframe->GetToolManager()->PostAction( EE_ACTIONS::placeSymbol, symbol );
} }
return 0; return 0;

View File

@ -95,7 +95,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings(); COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
wxString description; wxString description;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -113,7 +113,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_view->ClearPreview(); m_view->ClearPreview();
delete item; delete item;
item = nullptr; item = nullptr;
@ -203,7 +203,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
// First click creates... // First click creates...
if( !item ) if( !item )
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
switch( type ) switch( type )
{ {
@ -350,7 +350,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
// gets whacked. // gets whacked.
m_toolMgr->DeactivateTool(); m_toolMgr->DeactivateTool();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -363,7 +363,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_view->ClearPreview(); m_view->ClearPreview();
delete item; delete item;
item = nullptr; item = nullptr;
@ -429,7 +429,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
if( !symbol ) if( !symbol )
continue; continue;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
int lineWidth = schIUScale.MilsToIU( settings->m_Defaults.line_width ); int lineWidth = schIUScale.MilsToIU( settings->m_Defaults.line_width );
@ -524,7 +524,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
commit.Push( description ); commit.Push( description );
m_frame->RebuildView(); m_frame->RebuildView();
m_toolMgr->RunAction( ACTIONS::activatePointEditor ); m_toolMgr->PostAction( ACTIONS::activatePointEditor );
} }
} }
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) ) else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
@ -535,7 +535,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
} }
else if( evt->IsDblClick( BUT_LEFT ) && !item ) else if( evt->IsDblClick( BUT_LEFT ) && !item )
{ {
m_toolMgr->RunAction( EE_ACTIONS::properties, true ); m_toolMgr->RunAction( EE_ACTIONS::properties );
} }
else if( evt->IsClick( BUT_RIGHT ) ) else if( evt->IsClick( BUT_RIGHT ) )
{ {
@ -654,10 +654,10 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem( const TOOL_EVENT& aEvent )
LIB_PIN* pin = pinTool->RepeatPin( sourcePin ); LIB_PIN* pin = pinTool->RepeatPin( sourcePin );
g_lastPinWeakPtr = pin; g_lastPinWeakPtr = pin;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( pin ) if( pin )
m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, true, pin ); m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, pin );
} }
return 0; return 0;

View File

@ -180,13 +180,13 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( item->IsMoving() ) if( item->IsMoving() )
{ {
m_toolMgr->RunAction( ACTIONS::refreshPreview, true ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
} }
else else
{ {
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( !localCommit.Empty() ) if( !localCommit.Empty() )
localCommit.Push( _( "Rotate" ) ); localCommit.Push( _( "Rotate" ) );
@ -229,12 +229,12 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
if( item->IsMoving() ) if( item->IsMoving() )
{ {
m_toolMgr->RunAction( ACTIONS::refreshPreview, true ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
} }
else else
{ {
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_frame->OnModify(); m_frame->OnModify();
} }
@ -263,7 +263,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
return 0; return 0;
// Don't leave a freed pointer in the selection // Don't leave a freed pointer in the selection
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
commit.Modify( symbol, m_frame->GetScreen() ); commit.Modify( symbol, m_frame->GetScreen() );
@ -337,7 +337,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
{ {
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>(); PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_pickerItem = nullptr; m_pickerItem = nullptr;
// Deactivate other tools; particularly important if another PICKER is currently running // Deactivate other tools; particularly important if another PICKER is currently running
@ -353,7 +353,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selectionTool->UnbrightenItem( m_pickerItem ); selectionTool->UnbrightenItem( m_pickerItem );
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ ); selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
m_toolMgr->RunAction( ACTIONS::doDelete, true ); m_toolMgr->RunAction( ACTIONS::doDelete );
m_pickerItem = nullptr; m_pickerItem = nullptr;
} }
@ -399,10 +399,10 @@ int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem ); m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
// Wake the selection tool after exiting to ensure the cursor gets updated // Wake the selection tool after exiting to ensure the cursor gets updated
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); m_toolMgr->PostAction( EE_ACTIONS::selectionActivate );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }
@ -459,7 +459,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
} }
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
return 0; return 0;
} }
@ -558,8 +558,8 @@ void SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties()
LIB_SYMBOL* symbol = m_frame->GetCurSymbol(); LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
bool partLocked = symbol->UnitsLocked(); bool partLocked = symbol->UnitsLocked();
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true ); m_toolMgr->RunAction( ACTIONS::cancelInteractive );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
DIALOG_LIB_SYMBOL_PROPERTIES dlg( m_frame, symbol ); DIALOG_LIB_SYMBOL_PROPERTIES dlg( m_frame, symbol );
@ -607,7 +607,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
if( !symbol ) if( !symbol )
return 0; return 0;
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
saveCopyInUndoList( symbol, UNDO_REDO::LIBEDIT ); saveCopyInUndoList( symbol, UNDO_REDO::LIBEDIT );
@ -817,7 +817,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
if( !selection.Empty() ) if( !selection.Empty() )
{ {
selection.SetReferencePoint( getViewControls()->GetCursorPosition( true ) ); selection.SetReferencePoint( getViewControls()->GetCursorPosition( true ) );
m_toolMgr->RunAction( EE_ACTIONS::move, true, &commit ); m_toolMgr->RunAction( EE_ACTIONS::move, &commit );
commit.Push( _( "Paste" ) ); commit.Push( _( "Paste" ) );
} }
@ -870,11 +870,11 @@ int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
getView()->Add( newItem ); getView()->Add( newItem );
} }
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, true, &newItems ); m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, &newItems );
selection.SetReferencePoint( mapCoords( getViewControls()->GetCursorPosition( true ) ) ); selection.SetReferencePoint( mapCoords( getViewControls()->GetCursorPosition( true ) ) );
m_toolMgr->RunAction( EE_ACTIONS::move, true, &commit ); m_toolMgr->RunAction( EE_ACTIONS::move, &commit );
commit.Push( _( "Duplicate" ) ); commit.Push( _( "Duplicate" ) );
return 0; return 0;

View File

@ -363,14 +363,14 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
commit->Revert(); commit->Revert();
if( unselect ) if( unselect )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
else else
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent ); m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
} }
else else
{ {
if( unselect ) if( unselect )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
if( !localCommit.Empty() ) if( !localCommit.Empty() )
localCommit.Push( _( "Move" ) ); localCommit.Push( _( "Move" ) );

View File

@ -253,7 +253,7 @@ void HIERARCHY_PANE::onSelectSheetPath( wxTreeEvent& aEvent )
TREE_ITEM_DATA* itemData = static_cast<TREE_ITEM_DATA*>( m_tree->GetItemData( itemSel ) ); TREE_ITEM_DATA* itemData = static_cast<TREE_ITEM_DATA*>( m_tree->GetItemData( itemSel ) );
SetCursor( wxCURSOR_ARROWWAIT ); SetCursor( wxCURSOR_ARROWWAIT );
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( EE_ACTIONS::changeSheet, true, m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( EE_ACTIONS::changeSheet,
&itemData->m_SheetPath ); &itemData->m_SheetPath );
SetCursor( wxCURSOR_ARROW ); SetCursor( wxCURSOR_ARROW );
} }

View File

@ -76,7 +76,7 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
EDA_ITEMS selectedItems; EDA_ITEMS selectedItems;
std::vector<SCH_SEARCH_HIT> selectedHits; std::vector<SCH_SEARCH_HIT> selectedHits;
m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true ); m_frame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection );
for( long row : aItemRows ) for( long row : aItemRows )
{ {
@ -105,7 +105,7 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
} }
if( selectedItems.size() ) if( selectedItems.size() )
m_frame->GetToolManager()->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, true, &selectedItems ); m_frame->GetToolManager()->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, &selectedItems );
m_frame->GetCanvas()->Refresh( false ); m_frame->GetCanvas()->Refresh( false );
} }

View File

@ -64,7 +64,7 @@ SYMBOL_TREE_PANE::~SYMBOL_TREE_PANE()
void SYMBOL_TREE_PANE::onSymbolSelected( wxCommandEvent& aEvent ) void SYMBOL_TREE_PANE::onSymbolSelected( wxCommandEvent& aEvent )
{ {
m_symbolEditFrame->GetToolManager()->RunAction( EE_ACTIONS::editSymbol, true ); m_symbolEditFrame->GetToolManager()->RunAction( EE_ACTIONS::editSymbol );
// Make sure current-part highlighting doesn't get lost in selection highlighting // Make sure current-part highlighting doesn't get lost in selection highlighting
m_tree->Unselect(); m_tree->Unselect();

View File

@ -308,7 +308,7 @@ void DIALOG_PRINT_GERBVIEW::saveSettings()
int GERBVIEW_CONTROL::Print( const TOOL_EVENT& aEvent ) int GERBVIEW_CONTROL::Print( const TOOL_EVENT& aEvent )
{ {
// Selection affects the original item visibility // Selection affects the original item visibility
m_toolMgr->RunAction( GERBVIEW_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( GERBVIEW_ACTIONS::selectionClear );
BOARD_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() ); BOARD_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() );
settings.m_colorSettings = m_frame->GetColorSettings(); settings.m_colorSettings = m_frame->GetColorSettings();

View File

@ -687,7 +687,7 @@ void GERBVIEW_FRAME::DoWithAcceptedFiles()
{ {
wxString fn = file.GetFullPath(); wxString fn = file.GetFullPath();
// Open zip archive in editor // Open zip archive in editor
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( ArchiveFileExtension ), true, &fn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( ArchiveFileExtension ), &fn );
} }
else else
{ {
@ -698,5 +698,5 @@ void GERBVIEW_FRAME::DoWithAcceptedFiles()
// Open files in editor // Open files in editor
if( !gerbFn.IsEmpty() ) if( !gerbFn.IsEmpty() )
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( GerberFileExtension ), true, &gerbFn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( GerberFileExtension ), &gerbFn );
} }

View File

@ -162,7 +162,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
m_auimgr.Update(); m_auimgr.Update();
SetActiveLayer( 0, true ); SetActiveLayer( 0, true );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false ); GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
resolveCanvasType(); resolveCanvasType();
@ -185,7 +185,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
m_acceptedExts.emplace( DrillFileExtension, &GERBVIEW_ACTIONS::loadGerbFiles ); m_acceptedExts.emplace( DrillFileExtension, &GERBVIEW_ACTIONS::loadGerbFiles );
DragAcceptFiles( true ); DragAcceptFiles( true );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
// Ensure the window is on top // Ensure the window is on top
Raise(); Raise();
@ -808,7 +808,7 @@ void GERBVIEW_FRAME::SetActiveLayer( int aLayer, bool doLayerWidgetUpdate )
UpdateTitleAndInfo(); UpdateTitleAndInfo();
m_toolManager->RunAction( GERBVIEW_ACTIONS::layerChanged ); // notify other tools m_toolManager->PostAction( GERBVIEW_ACTIONS::layerChanged ); // notify other tools
GetCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere GetCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere
GetCanvas()->SetHighContrastLayer( GERBER_DRAW_LAYER( aLayer ) ); GetCanvas()->SetHighContrastLayer( GERBER_DRAW_LAYER( aLayer ) );

View File

@ -398,7 +398,7 @@ int GERBVIEW_CONTROL::ClearLayer( const TOOL_EVENT& aEvent )
int GERBVIEW_CONTROL::ClearAllLayers( const TOOL_EVENT& aEvent ) int GERBVIEW_CONTROL::ClearAllLayers( const TOOL_EVENT& aEvent )
{ {
m_frame->Clear_DrawLayers( false ); m_frame->Clear_DrawLayers( false );
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); m_toolMgr->RunAction( ACTIONS::zoomFitScreen );
canvas()->Refresh(); canvas()->Refresh();
m_frame->ClearMsgPanel(); m_frame->ClearMsgPanel();

View File

@ -193,7 +193,7 @@ int GERBVIEW_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
else if( evt->IsDblClick( BUT_MIDDLE ) ) else if( evt->IsDblClick( BUT_MIDDLE ) )
{ {
// Middle double click? Do zoom to fit // Middle double click? Do zoom to fit
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); m_toolMgr->RunAction( ACTIONS::zoomFitScreen );
} }
else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE ) else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
{ {

View File

@ -252,11 +252,11 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
break; break;
case ID_LAYER_MOVE_UP: case ID_LAYER_MOVE_UP:
m_frame->GetToolManager()->RunAction( GERBVIEW_ACTIONS::moveLayerUp, true ); m_frame->GetToolManager()->RunAction( GERBVIEW_ACTIONS::moveLayerUp );
break; break;
case ID_LAYER_MOVE_DOWN: case ID_LAYER_MOVE_DOWN:
m_frame->GetToolManager()->RunAction( GERBVIEW_ACTIONS::moveLayerDown, true ); m_frame->GetToolManager()->RunAction( GERBVIEW_ACTIONS::moveLayerDown );
break; break;
case ID_LAYER_DELETE: case ID_LAYER_DELETE:

View File

@ -127,7 +127,7 @@ public:
void ShutdownTool( const std::string& aToolName ); void ShutdownTool( const std::string& aToolName );
/** /**
* Run the specified action. * Run the specified action immediately, pausing the current action to run the new one.
* *
* The common format for action names is "application.ToolName.Action". * The common format for action names is "application.ToolName.Action".
* *
@ -135,60 +135,110 @@ public:
* action is expecting, otherwise an assert will occur when reading the paramter. * action is expecting, otherwise an assert will occur when reading the paramter.
* *
* @param aActionName is the name of action to be invoked. * @param aActionName is the name of action to be invoked.
* @param aNow decides if the action has to be run immediately or after the current coroutine
* is preemptied.
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning * @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* depends on the action. * depends on the action.
* @return False if the action was not found. * @return False if the action was not found.
*/ */
template<typename T> template<typename T>
bool RunAction( const std::string& aActionName, bool aNow, T aParam ) bool RunAction( const std::string& aActionName, T aParam )
{ {
// Use a cast to ensure the proper type is stored inside the parameter // Use a cast to ensure the proper type is stored inside the parameter
std::any a( static_cast<T>( aParam ) ); std::any a( static_cast<T>( aParam ) );
return doRunAction( aActionName, aNow, a ); return doRunAction( aActionName, true, a );
} }
bool RunAction( const std::string& aActionName, bool aNow = false ) bool RunAction( const std::string& aActionName )
{ {
// Default initialize the parameter argument to an empty std::any // Default initialize the parameter argument to an empty std::any
std::any a; std::any a;
return doRunAction( aActionName, aNow, a ); return doRunAction( aActionName, true, a );
} }
/** /**
* Run the specified action. * Run the specified action immediately, pausing the current action to run the new one.
*
* This function will only return if the action has been handled when the action is run
* immediately (aNow = true), otherwise it will always return false.
* *
* Note: The type of the optional parameter must match exactly with the type the consuming * Note: The type of the optional parameter must match exactly with the type the consuming
* action is expecting, otherwise an assert will occur when reading the paramter. * action is expecting, otherwise an assert will occur when reading the paramter.
* *
* @param aAction is the action to be invoked. * @param aAction is the action to be invoked.
* @param aNow decides if the action has to be run immediately or after the current coroutine
* is preemptied.
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning * @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* depends on the action. * depends on the action.
* @return True if the action was handled immediately * @return True if the action was handled immediately
*/ */
template<typename T> template<typename T>
bool RunAction( const TOOL_ACTION& aAction, bool aNow, T aParam ) bool RunAction( const TOOL_ACTION& aAction, T aParam )
{ {
// Use a cast to ensure the proper type is stored inside the parameter // Use a cast to ensure the proper type is stored inside the parameter
std::any a( static_cast<T>( aParam ) ); std::any a( static_cast<T>( aParam ) );
return doRunAction( aAction, aNow, a ); return doRunAction( aAction, true, a );
} }
bool RunAction( const TOOL_ACTION& aAction, bool aNow = false ) bool RunAction( const TOOL_ACTION& aAction )
{ {
// Default initialize the parameter argument to an empty std::any // Default initialize the parameter argument to an empty std::any
std::any a; std::any a;
return doRunAction( aAction, aNow, a ); return doRunAction( aAction, true, a );
}
/**
* Run the specified action after the current action (coroutine) ends.
*
* The common format for action names is "application.ToolName.Action".
*
* Note: The type of the optional parameter must match exactly with the type the consuming
* action is expecting, otherwise an assert will occur when reading the paramter.
*
* @param aActionName is the name of action to be invoked.
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* depends on the action.
* @return False if the action was not found.
*/
template<typename T>
bool PostAction( const std::string& aActionName, T aParam )
{
// Use a cast to ensure the proper type is stored inside the parameter
std::any a( static_cast<T>( aParam ) );
return doRunAction( aActionName, false, a );
}
bool PostAction( const std::string& aActionName )
{
// Default initialize the parameter argument to an empty std::any
std::any a;
return doRunAction( aActionName, false, a );
}
/**
* Run the specified action after the current action (coroutine) ends.
*
* Note: The type of the optional parameter must match exactly with the type the consuming
* action is expecting, otherwise an assert will occur when reading the paramter.
*
* @param aAction is the action to be invoked.
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* depends on the action.
*/
template<typename T>
bool PostAction( const TOOL_ACTION& aAction, T aParam )
{
// Use a cast to ensure the proper type is stored inside the parameter
std::any a( static_cast<T>( aParam ) );
return doRunAction( aAction, false, a );
}
void PostAction( const TOOL_ACTION& aAction )
{
// Default initialize the parameter argument to an empty std::any
std::any a;
doRunAction( aAction, false, a );
} }
/** /**

View File

@ -440,7 +440,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
if( ext == ProjectFileExtension || ext == LegacyProjectFileExtension ) if( ext == ProjectFileExtension || ext == LegacyProjectFileExtension )
{ {
wxString fn = fileName.GetFullPath(); wxString fn = fileName.GetFullPath();
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), true, &fn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), &fn );
return; return;
} }
@ -464,7 +464,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
else else
{ {
wxString fn = fileName.GetFullPath(); wxString fn = fileName.GetFullPath();
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), true, &fn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), &fn );
} }
} }
@ -477,7 +477,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
{ {
wxString command = fullEditorName + " " + gerberFiles; wxString command = fullEditorName + " " + gerberFiles;
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( GerberFileExtension ), m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( GerberFileExtension ),
true, &command ); &command );
} }
} }
} }
@ -713,7 +713,7 @@ void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event )
wxString filename = dlg.GetPath(); wxString filename = dlg.GetPath();
if( !dlg.GetPath().IsEmpty() && !Pgm().GetTextEditor().IsEmpty() ) if( !dlg.GetPath().IsEmpty() && !Pgm().GetTextEditor().IsEmpty() )
m_toolManager->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::openTextEditor, true, &filename ); m_toolManager->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::openTextEditor, &filename );
} }
@ -882,12 +882,12 @@ void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
if( fn.GetExt() == LegacySchematicFileExtension if( fn.GetExt() == LegacySchematicFileExtension
|| fn.GetExt() == KiCadSchematicFileExtension ) || fn.GetExt() == KiCadSchematicFileExtension )
{ {
GetToolManager()->RunAction( KICAD_MANAGER_ACTIONS::editSchematic, true ); GetToolManager()->RunAction( KICAD_MANAGER_ACTIONS::editSchematic );
} }
else if( fn.GetExt() == LegacyPcbFileExtension else if( fn.GetExt() == LegacyPcbFileExtension
|| fn.GetExt() == KiCadPcbFileExtension ) || fn.GetExt() == KiCadPcbFileExtension )
{ {
GetToolManager()->RunAction( KICAD_MANAGER_ACTIONS::editPCB, true ); GetToolManager()->RunAction( KICAD_MANAGER_ACTIONS::editPCB );
} }
} }

View File

@ -200,9 +200,9 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
case TREE_FILE_TYPE::SEXPR_SCHEMATIC: case TREE_FILE_TYPE::SEXPR_SCHEMATIC:
// Schematics not part of the project are opened in a separate process. // Schematics not part of the project are opened in a separate process.
if( fullFileName == frame->SchFileName() || fullFileName == frame->SchLegacyFileName() ) if( fullFileName == frame->SchFileName() || fullFileName == frame->SchLegacyFileName() )
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSchematic, true ); toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSchematic );
else else
toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editOtherSch, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editOtherSch, &fullFileName );
break; break;
@ -210,9 +210,9 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
case TREE_FILE_TYPE::SEXPR_PCB: case TREE_FILE_TYPE::SEXPR_PCB:
// Boards not part of the project are opened in a separate process. // Boards not part of the project are opened in a separate process.
if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() ) if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() )
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editPCB, true ); toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editPCB );
else else
toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editOtherPCB, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editOtherPCB, &fullFileName );
break; break;
@ -221,7 +221,7 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
case TREE_FILE_TYPE::DRILL: case TREE_FILE_TYPE::DRILL:
case TREE_FILE_TYPE::DRILL_NC: case TREE_FILE_TYPE::DRILL_NC:
case TREE_FILE_TYPE::DRILL_XNC: case TREE_FILE_TYPE::DRILL_XNC:
toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::viewGerbers, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::viewGerbers, &fullFileName );
break; break;
case TREE_FILE_TYPE::HTML: case TREE_FILE_TYPE::HTML:
@ -236,22 +236,22 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
case TREE_FILE_TYPE::TXT: case TREE_FILE_TYPE::TXT:
case TREE_FILE_TYPE::MD: case TREE_FILE_TYPE::MD:
case TREE_FILE_TYPE::REPORT: case TREE_FILE_TYPE::REPORT:
toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::openTextEditor, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::openTextEditor, &fullFileName );
break; break;
case TREE_FILE_TYPE::DRAWING_SHEET: case TREE_FILE_TYPE::DRAWING_SHEET:
toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editDrawingSheet, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editDrawingSheet, &fullFileName );
break; break;
case TREE_FILE_TYPE::FOOTPRINT_FILE: case TREE_FILE_TYPE::FOOTPRINT_FILE:
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editFootprints, true ); toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editFootprints );
packet = fullFileName.ToStdString(); packet = fullFileName.ToStdString();
kiway.ExpressMail( FRAME_FOOTPRINT_EDITOR, MAIL_FP_EDIT, packet ); kiway.ExpressMail( FRAME_FOOTPRINT_EDITOR, MAIL_FP_EDIT, packet );
break; break;
case TREE_FILE_TYPE::SCHEMATIC_LIBFILE: case TREE_FILE_TYPE::SCHEMATIC_LIBFILE:
case TREE_FILE_TYPE::SEXPR_SYMBOL_LIB_FILE: case TREE_FILE_TYPE::SEXPR_SYMBOL_LIB_FILE:
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSymbols, true ); toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSymbols );
packet = fullFileName.ToStdString(); packet = fullFileName.ToStdString();
kiway.ExpressMail( FRAME_SCH_SYMBOL_EDITOR, MAIL_LIB_EDIT, packet ); kiway.ExpressMail( FRAME_SCH_SYMBOL_EDITOR, MAIL_LIB_EDIT, packet );
break; break;

View File

@ -912,7 +912,7 @@ void PL_EDITOR_FRAME::OnNewDrawingSheet()
UpdateTitleAndInfo(); UpdateTitleAndInfo();
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
if( GetCurrentFileName().IsEmpty() ) if( GetCurrentFileName().IsEmpty() )
{ {
@ -970,4 +970,4 @@ void PL_EDITOR_FRAME::UpdateMsgPanelInfo()
SetMsgPanel( msgItems ); SetMsgPanel( msgItems );
} }
#endif #endif

View File

@ -141,7 +141,7 @@ void PL_EDITOR_FRAME::RollbackFromUndo()
if( pageSettingsAndTitleBlock ) if( pageSettingsAndTitleBlock )
{ {
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
HardRedraw(); // items based off of corners will need re-calculating HardRedraw(); // items based off of corners will need re-calculating
} }
else else

View File

@ -76,7 +76,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
DS_DRAW_ITEM_BASE* item = nullptr; DS_DRAW_ITEM_BASE* item = nullptr;
bool isText = aEvent.IsAction( &PL_ACTIONS::placeText ); bool isText = aEvent.IsAction( &PL_ACTIONS::placeText );
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -92,7 +92,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
item = nullptr; item = nullptr;
// There's nothing to roll-back, but we still need to pop the undo stack // There's nothing to roll-back, but we still need to pop the undo stack
@ -152,7 +152,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
{ {
m_frame->SaveCopyInUndoList(); m_frame->SaveCopyInUndoList();
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
item = dataItem->GetDrawItems()[0]; item = dataItem->GetDrawItems()[0];
item->SetFlags( IS_NEW | IS_MOVING ); item->SetFlags( IS_NEW | IS_MOVING );
@ -175,7 +175,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
// Now we re-select and inform other tools, so that the Properties panel // Now we re-select and inform other tools, so that the Properties panel
// is updated. // is updated.
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
m_selectionTool->AddItemToSel( item, false ); m_selectionTool->AddItemToSel( item, false );
item = nullptr; item = nullptr;
@ -223,7 +223,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
// gets whacked. // gets whacked.
m_toolMgr->DeactivateTool(); m_toolMgr->DeactivateTool();
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -251,7 +251,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() || evt->IsActivate() ) if( evt->IsCancelInteractive() || evt->IsActivate() )
{ {
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
if( item ) if( item )
{ {
@ -273,7 +273,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
if( !item ) // start drawing if( !item ) // start drawing
{ {
m_frame->SaveCopyInUndoList(); m_frame->SaveCopyInUndoList();
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
DS_DATA_ITEM* dataItem = m_frame->AddDrawingSheetItem( type ); DS_DATA_ITEM* dataItem = m_frame->AddDrawingSheetItem( type );
dataItem->MoveToUi( cursorPos ); dataItem->MoveToUi( cursorPos );
@ -289,14 +289,14 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
{ {
// Now we re-select and inform other tools, so that the Properties panel // Now we re-select and inform other tools, so that the Properties panel
// is updated. // is updated.
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
m_selectionTool->AddItemToSel( item, false ); m_selectionTool->AddItemToSel( item, false );
item->ClearEditFlags(); item->ClearEditFlags();
item = nullptr; item = nullptr;
// Activate point editor immediately to allow resizing of the item just created // Activate point editor immediately to allow resizing of the item just created
m_toolMgr->RunAction( ACTIONS::activatePointEditor, true ); m_toolMgr->RunAction( ACTIONS::activatePointEditor );
m_frame->OnModify(); m_frame->OnModify();
} }

View File

@ -310,7 +310,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
m_frame->OnModify(); m_frame->OnModify();
if( unselect ) if( unselect )
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
else else
m_toolMgr->PostEvent( EVENTS::SelectedEvent ); m_toolMgr->PostEvent( EVENTS::SelectedEvent );
@ -355,7 +355,7 @@ bool PL_EDIT_TOOL::updateModificationPoint( PL_SELECTION& aSelection )
int PL_EDIT_TOOL::ImportDrawingSheetContent( const TOOL_EVENT& aEvent ) int PL_EDIT_TOOL::ImportDrawingSheetContent( const TOOL_EVENT& aEvent )
{ {
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true ); m_toolMgr->RunAction( ACTIONS::cancelInteractive );
wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE ); wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE );
m_frame->Files_io( evt ); m_frame->Files_io( evt );
@ -427,7 +427,7 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
PL_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PL_SELECTION_TOOL>(); PL_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PL_SELECTION_TOOL>();
selectionTool->UnbrightenItem( m_pickerItem ); selectionTool->UnbrightenItem( m_pickerItem );
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ ); selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
m_toolMgr->RunAction( ACTIONS::doDelete, true ); m_toolMgr->RunAction( ACTIONS::doDelete );
m_pickerItem = nullptr; m_pickerItem = nullptr;
} }
@ -473,10 +473,10 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
m_toolMgr->GetTool<PL_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem ); m_toolMgr->GetTool<PL_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
// Wake the selection tool after exiting to ensure the cursor gets updated // Wake the selection tool after exiting to ensure the cursor gets updated
m_toolMgr->RunAction( PL_ACTIONS::selectionActivate, false ); m_toolMgr->PostAction( PL_ACTIONS::selectionActivate );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }
@ -561,7 +561,7 @@ int PL_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
if( !selection.Empty() ) if( !selection.Empty() )
{ {
selection.SetReferencePoint( selection.GetTopLeftItem()->GetPosition() ); selection.SetReferencePoint( selection.GetTopLeftItem()->GetPosition() );
m_toolMgr->RunAction( PL_ACTIONS::move, false ); m_toolMgr->PostAction( PL_ACTIONS::move );
} }
return 0; return 0;

View File

@ -152,7 +152,7 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( selectionContains( evt->Position() ) ) if( selectionContains( evt->Position() ) )
{ {
// Yes -> run the move tool and wait till it finishes // Yes -> run the move tool and wait till it finishes
m_toolMgr->RunAction( "plEditor.InteractiveMove.move", true ); m_toolMgr->RunAction( "plEditor.InteractiveMove.move" );
} }
else else
{ {
@ -165,7 +165,7 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
// Middle double click? Do zoom to fit or zoom to objects // Middle double click? Do zoom to fit or zoom to objects
else if( evt->IsDblClick( BUT_MIDDLE ) ) else if( evt->IsDblClick( BUT_MIDDLE ) )
{ {
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); m_toolMgr->RunAction( ACTIONS::zoomFitScreen );
} }
else if( evt->IsCancelInteractive() ) else if( evt->IsCancelInteractive() )

View File

@ -205,8 +205,8 @@ void ARRAY_CREATOR::Invoke()
all_added_items.push_back( item ); all_added_items.push_back( item );
} }
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &all_added_items ); m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &all_added_items );
commit.Push( _( "Create an array" ) ); commit.Push( _( "Create an array" ) );
} }

View File

@ -656,7 +656,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
m_toolMgr->PostEvent( EVENTS::UnselectedEvent ); m_toolMgr->PostEvent( EVENTS::UnselectedEvent );
if( autofillZones ) if( autofillZones )
m_toolMgr->RunAction( PCB_ACTIONS::zoneFillDirty ); m_toolMgr->PostAction( PCB_ACTIONS::zoneFillDirty );
if( selectedModified ) if( selectedModified )
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );

View File

@ -96,7 +96,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( strcmp( idcmd, "$CONFIG" ) == 0 ) if( strcmp( idcmd, "$CONFIG" ) == 0 )
{ {
GetToolManager()->RunAction( ACTIONS::showSymbolLibTable, true ); GetToolManager()->RunAction( ACTIONS::showSymbolLibTable );
return; return;
} }
else if( strcmp( idcmd, "$CUSTOM_RULES" ) == 0 ) else if( strcmp( idcmd, "$CUSTOM_RULES" ) == 0 )
@ -106,7 +106,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
} }
else if( strcmp( idcmd, "$DRC" ) == 0 ) else if( strcmp( idcmd, "$DRC" ) == 0 )
{ {
GetToolManager()->RunAction( PCB_ACTIONS::runDRC, true ); GetToolManager()->RunAction( PCB_ACTIONS::runDRC );
return; return;
} }
else if( strcmp( idcmd, "$CLEAR" ) == 0 ) else if( strcmp( idcmd, "$CLEAR" ) == 0 )
@ -192,9 +192,9 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
bbox = footprint->GetBoundingBox( true, false ); // No invisible text in bbox calc bbox = footprint->GetBoundingBox( true, false ); // No invisible text in bbox calc
if( pad ) if( pad )
m_toolManager->RunAction<BOARD_ITEM*>( PCB_ACTIONS::highlightItem, true, pad ); m_toolManager->RunAction<BOARD_ITEM*>( PCB_ACTIONS::highlightItem, pad );
else else
m_toolManager->RunAction<BOARD_ITEM*>( PCB_ACTIONS::highlightItem, true, footprint ); m_toolManager->RunAction<BOARD_ITEM*>( PCB_ACTIONS::highlightItem, footprint );
} }
else if( netcode > 0 || multiHighlight ) else if( netcode > 0 || multiHighlight )
{ {
@ -645,11 +645,11 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
if( selectConnections ) if( selectConnections )
{ {
GetToolManager()->RunAction( PCB_ACTIONS::syncSelectionWithNets, true, &items ); GetToolManager()->RunAction( PCB_ACTIONS::syncSelectionWithNets, &items );
} }
else else
{ {
GetToolManager()->RunAction( PCB_ACTIONS::syncSelection, true, &items ); GetToolManager()->RunAction( PCB_ACTIONS::syncSelection, &items );
} }
// Update 3D viewer highlighting // Update 3D viewer highlighting
@ -662,7 +662,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
} }
case MAIL_PCB_UPDATE: case MAIL_PCB_UPDATE:
m_toolManager->RunAction( ACTIONS::updatePcbFromSchematic, true ); m_toolManager->RunAction( ACTIONS::updatePcbFromSchematic );
break; break;
case MAIL_IMPORT_FILE: case MAIL_IMPORT_FILE:
@ -692,7 +692,7 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
} }
case MAIL_RELOAD_PLUGINS: case MAIL_RELOAD_PLUGINS:
GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true ); GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload );
break; break;
// many many others. // many many others.

View File

@ -98,7 +98,7 @@ void DIALOG_CLEANUP_GRAPHICS::doCleanup( bool aDryRun )
if( !aDryRun ) if( !aDryRun )
{ {
// Clear current selection list to avoid selection of deleted items // Clear current selection list to avoid selection of deleted items
m_parentFrame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_parentFrame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
// ... and to keep the treeModel from trying to refresh a deleted item // ... and to keep the treeModel from trying to refresh a deleted item
m_changesTreeModel->Update( nullptr, RPT_SEVERITY_ACTION ); m_changesTreeModel->Update( nullptr, RPT_SEVERITY_ACTION );

View File

@ -117,7 +117,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
if( !aDryRun ) if( !aDryRun )
{ {
// Clear current selection list to avoid selection of deleted items // Clear current selection list to avoid selection of deleted items
m_parentFrame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_parentFrame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
// ... and to keep the treeModel from trying to refresh a deleted item // ... and to keep the treeModel from trying to refresh a deleted item
m_changesTreeModel->Update( nullptr, RPT_SEVERITY_ACTION ); m_changesTreeModel->Update( nullptr, RPT_SEVERITY_ACTION );

View File

@ -472,7 +472,7 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent )
if( rc_item->GetErrorCode() == DRCE_UNCONNECTED_ITEMS ) if( rc_item->GetErrorCode() == DRCE_UNCONNECTED_ITEMS )
{ {
if( !m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest ) if( !m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest )
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::showRatsnest, true ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::showRatsnest );
if( item->Type() == PCB_ZONE_T ) if( item->Type() == PCB_ZONE_T )
{ {
@ -1016,7 +1016,7 @@ void DIALOG_DRC::ExcludeMarker()
void DIALOG_DRC::deleteAllMarkers( bool aIncludeExclusions ) void DIALOG_DRC::deleteAllMarkers( bool aIncludeExclusions )
{ {
// Clear current selection list to avoid selection of deleted items // Clear current selection list to avoid selection of deleted items
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
m_markersTreeModel->DeleteItems( false, aIncludeExclusions, false ); m_markersTreeModel->DeleteItems( false, aIncludeExclusions, false );
m_unconnectedTreeModel->DeleteItems( false, aIncludeExclusions, false ); m_unconnectedTreeModel->DeleteItems( false, aIncludeExclusions, false );
@ -1099,7 +1099,7 @@ void DIALOG_DRC::OnDeleteOneClick( wxCommandEvent& aEvent )
if( m_Notebook->GetSelection() == 0 ) if( m_Notebook->GetSelection() == 0 )
{ {
// Clear the selection. It may be the selected DRC marker. // Clear the selection. It may be the selected DRC marker.
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
m_markersTreeModel->DeleteCurrentItem( true ); m_markersTreeModel->DeleteCurrentItem( true );

View File

@ -239,7 +239,7 @@ void DIALOG_FIND::search( bool aDirection )
// Search parameters // Search parameters
m_frame->GetFindReplaceData().findString = searchString; m_frame->GetFindReplaceData().findString = searchString;
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
m_frame->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); m_frame->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y );
BOARD* board = m_frame->GetBoard(); BOARD* board = m_frame->GetBoard();
@ -393,7 +393,7 @@ void DIALOG_FIND::search( bool aDirection )
} }
else else
{ {
m_frame->GetToolManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, *m_it ); m_frame->GetToolManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, *m_it );
msg.Printf( _( "'%s' found" ), searchString ); msg.Printf( _( "'%s' found" ), searchString );
m_frame->SetStatusText( msg ); m_frame->SetStatusText( msg );

View File

@ -376,7 +376,7 @@ void DIALOG_FOOTPRINT_CHECKER::refreshEditor()
void DIALOG_FOOTPRINT_CHECKER::OnDeleteOneClick( wxCommandEvent& aEvent ) void DIALOG_FOOTPRINT_CHECKER::OnDeleteOneClick( wxCommandEvent& aEvent )
{ {
// Clear the selection. It may be the selected DRC marker. // Clear the selection. It may be the selected DRC marker.
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
m_markersTreeModel->DeleteCurrentItem( true ); m_markersTreeModel->DeleteCurrentItem( true );
@ -400,7 +400,7 @@ void DIALOG_FOOTPRINT_CHECKER::OnDeleteAllClick( wxCommandEvent& event )
void DIALOG_FOOTPRINT_CHECKER::deleteAllMarkers() void DIALOG_FOOTPRINT_CHECKER::deleteAllMarkers()
{ {
// Clear current selection list to avoid selection of deleted items // Clear current selection list to avoid selection of deleted items
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
m_markersTreeModel->DeleteItems( false, true, false ); m_markersTreeModel->DeleteItems( false, true, false );
m_frame->GetBoard()->DeleteMARKERs( true, true ); m_frame->GetBoard()->DeleteMARKERs( true, true );

View File

@ -118,7 +118,7 @@ void DIALOG_GLOBAL_DELETION::DoGlobalDeletions()
bool delete_all = m_delAll->GetValue(); bool delete_all = m_delAll->GetValue();
// Clear selection before removing any items // Clear selection before removing any items
m_Parent->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_Parent->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
BOARD* board = m_Parent->GetBoard(); BOARD* board = m_Parent->GetBoard();
BOARD_COMMIT commit( m_Parent ); BOARD_COMMIT commit( m_Parent );

View File

@ -106,7 +106,7 @@ bool DIALOG_GROUP_PROPERTIES::TransferDataFromWindow()
m_group->SetName( m_nameCtrl->GetValue() ); m_group->SetName( m_nameCtrl->GetValue() );
m_group->SetLocked( m_locked->GetValue() ); m_group->SetLocked( m_locked->GetValue() );
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_group->RemoveAll(); m_group->RemoveAll();
for( size_t ii = 0; ii < m_membersList->GetCount(); ++ii ) for( size_t ii = 0; ii < m_membersList->GetCount(); ++ii )
@ -115,7 +115,7 @@ bool DIALOG_GROUP_PROPERTIES::TransferDataFromWindow()
m_group->AddItem( item ); m_group->AddItem( item );
} }
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, m_group ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, m_group );
commit.Push( _( "Modified group" ) ); commit.Push( _( "Modified group" ) );
return true; return true;
@ -141,7 +141,7 @@ void DIALOG_GROUP_PROPERTIES::OnMemberSelected( wxCommandEvent& aEvent )
void DIALOG_GROUP_PROPERTIES::OnAddMember( wxCommandEvent& event ) void DIALOG_GROUP_PROPERTIES::OnAddMember( wxCommandEvent& event )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::pickNewGroupMember, true ); m_toolMgr->RunAction( PCB_ACTIONS::pickNewGroupMember );
} }

View File

@ -102,7 +102,7 @@ DIALOG_IMPORT_NETLIST::~DIALOG_IMPORT_NETLIST()
{ {
KIGFX::VIEW_CONTROLS* controls = m_parent->GetCanvas()->GetViewControls(); KIGFX::VIEW_CONTROLS* controls = m_parent->GetCanvas()->GetViewControls();
controls->SetCursorPosition( controls->GetMousePosition() ); controls->SetCursorPosition( controls->GetMousePosition() );
m_parent->GetToolManager()->RunAction( PCB_ACTIONS::move, true ); m_parent->GetToolManager()->RunAction( PCB_ACTIONS::move );
} }
} }

View File

@ -215,7 +215,7 @@ void DIALOG_POSITION_RELATIVE::OnSelectItemClick( wxCommandEvent& event )
POSITION_RELATIVE_TOOL* posrelTool = m_toolMgr->GetTool<POSITION_RELATIVE_TOOL>(); POSITION_RELATIVE_TOOL* posrelTool = m_toolMgr->GetTool<POSITION_RELATIVE_TOOL>();
wxASSERT( posrelTool ); wxASSERT( posrelTool );
m_toolMgr->RunAction( PCB_ACTIONS::selectpositionRelativeItem, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectpositionRelativeItem );
Hide(); Hide();
} }

View File

@ -465,7 +465,7 @@ void DIALOG_PRINT_PCBNEW::saveSettings()
int PCB_CONTROL::Print( const TOOL_EVENT& aEvent ) int PCB_CONTROL::Print( const TOOL_EVENT& aEvent )
{ {
// Selection affects the origin item visibility // Selection affects the origin item visibility
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
PCBNEW_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() ); PCBNEW_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() );
DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings ); DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings );

View File

@ -79,7 +79,7 @@ DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB()
{ {
KIGFX::VIEW_CONTROLS* controls = m_frame->GetCanvas()->GetViewControls(); KIGFX::VIEW_CONTROLS* controls = m_frame->GetCanvas()->GetViewControls();
controls->SetCursorPosition( controls->GetMousePosition() ); controls->SetCursorPosition( controls->GetMousePosition() );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::move, true ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::move );
} }
} }
@ -98,7 +98,7 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun )
if( !aDryRun ) if( !aDryRun )
{ {
m_frame->GetToolManager()->DeactivateTool(); m_frame->GetToolManager()->DeactivateTool();
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
} }
BOARD_NETLIST_UPDATER updater( m_frame, m_frame->GetBoard() ); BOARD_NETLIST_UPDATER updater( m_frame, m_frame->GetBoard() );

View File

@ -167,7 +167,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
break; break;
case PCB_GROUP_T: case PCB_GROUP_T:
m_toolManager->RunAction<PCB_GROUP*>( PCB_ACTIONS::groupProperties, true, m_toolManager->RunAction<PCB_GROUP*>( PCB_ACTIONS::groupProperties,
static_cast<PCB_GROUP*>( aItem ) ); static_cast<PCB_GROUP*>( aItem ) );
break; break;

View File

@ -227,5 +227,5 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
break; break;
} }
m_toolManager->RunAction( PCB_ACTIONS::trackViaSizeChanged, true ); m_toolManager->RunAction( PCB_ACTIONS::trackViaSizeChanged );
} }

View File

@ -825,7 +825,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// we should not ask PLUGINs to do these items: // we should not ask PLUGINs to do these items:
loadedBoard->BuildListOfNets(); loadedBoard->BuildListOfNets();
ResolveDRCExclusions( true ); ResolveDRCExclusions( true );
m_toolManager->RunAction( PCB_ACTIONS::repairBoard, true, true); m_toolManager->RunAction( PCB_ACTIONS::repairBoard, true);
if( loadedBoard->IsModified() ) if( loadedBoard->IsModified() )
OnModify(); OnModify();

View File

@ -298,7 +298,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset ); m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
m_appearancePanel->SetTabIndex( cfg->m_AuiPanels.appearance_panel_tab ); m_appearancePanel->SetTabIndex( cfg->m_AuiPanels.appearance_panel_tab );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false ); GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
UpdateTitle(); UpdateTitle();
setupUnits( GetSettings() ); setupUnits( GetSettings() );
@ -1140,9 +1140,9 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) ); PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
if( pcbframe ) if( pcbframe )
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true ); pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload );
else else
m_toolManager->RunAction( PCB_ACTIONS::pluginsReload, true ); m_toolManager->RunAction( PCB_ACTIONS::pluginsReload );
} }

View File

@ -251,7 +251,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
} }
case PCB_GROUP_T: case PCB_GROUP_T:
m_toolManager->RunAction<PCB_GROUP*>( PCB_ACTIONS::groupProperties, true, m_toolManager->RunAction<PCB_GROUP*>( PCB_ACTIONS::groupProperties,
static_cast<PCB_GROUP*>( aItem ) ); static_cast<PCB_GROUP*>( aItem ) );
break; break;
@ -279,7 +279,7 @@ void FOOTPRINT_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
m_appearancePanel->OnLayerChanged(); m_appearancePanel->OnLayerChanged();
m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
GetCanvas()->SetFocus(); // allow capture of hotkeys GetCanvas()->SetFocus(); // allow capture of hotkeys
GetCanvas()->SetHighContrastLayer( aLayer ); GetCanvas()->SetHighContrastLayer( aLayer );
GetCanvas()->Refresh(); GetCanvas()->Refresh();

View File

@ -794,7 +794,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprint( FOOTPRINT* aFootprint )
PAD_TOOL* padTool = m_toolManager->GetTool<PAD_TOOL>(); PAD_TOOL* padTool = m_toolManager->GetTool<PAD_TOOL>();
if( padTool->InPadEditMode() ) if( padTool->InPadEditMode() )
m_toolManager->RunAction( PCB_ACTIONS::recombinePad, true ); m_toolManager->RunAction( PCB_ACTIONS::recombinePad );
wxString libraryName = aFootprint->GetFPID().GetLibNickname(); wxString libraryName = aFootprint->GetFPID().GetLibNickname();
wxString footprintName = aFootprint->GetFPID().GetLibItemName(); wxString footprintName = aFootprint->GetFPID().GetLibItemName();
@ -968,7 +968,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
return false; return false;
} }
m_toolManager->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolManager->RunAction( PCB_ACTIONS::selectionClear );
BOARD_COMMIT commit( pcbframe ); BOARD_COMMIT commit( pcbframe );
// Create a copy for the board, first using Clone() to keep existing Uuids, and then either // Create a copy for the board, first using Clone() to keep existing Uuids, and then either
@ -1015,7 +1015,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
commit.Push( wxT( "Insert footprint" ) ); commit.Push( wxT( "Insert footprint" ) );
pcbframe->Raise(); pcbframe->Raise();
pcb_ToolManager->RunAction( PCB_ACTIONS::placeFootprint, true, newFootprint ); pcb_ToolManager->RunAction( PCB_ACTIONS::placeFootprint, newFootprint );
} }
newFootprint->ClearFlags(); newFootprint->ClearFlags();

View File

@ -796,7 +796,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
if( blocking_dialog ) if( blocking_dialog )
blocking_dialog->Close( true ); blocking_dialog->Close( true );
toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); toolMgr->RunAction( PCB_ACTIONS::selectionClear );
BOARD_COMMIT commit( pcbframe ); BOARD_COMMIT commit( pcbframe );
// Create the "new" footprint // Create the "new" footprint
@ -831,7 +831,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
commit.Push( wxT( "Insert footprint" ) ); commit.Push( wxT( "Insert footprint" ) );
pcbframe->Raise(); pcbframe->Raise();
toolMgr->RunAction( PCB_ACTIONS::placeFootprint, false, newFootprint ); toolMgr->PostAction( PCB_ACTIONS::placeFootprint, newFootprint );
newFootprint->ClearFlags(); newFootprint->ClearFlags();
} }
@ -1220,9 +1220,9 @@ void FOOTPRINT_VIEWER_FRAME::updateView()
wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_FPVIEWER_AUTOZOOM_TOOL ); wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_FPVIEWER_AUTOZOOM_TOOL );
if( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED ) if( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED )
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
else else
m_toolManager->RunAction( ACTIONS::centerContents, true ); m_toolManager->RunAction( ACTIONS::centerContents );
UpdateMsgPanel(); UpdateMsgPanel();
} }

View File

@ -206,7 +206,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
updateView(); updateView();
SetActiveLayer( F_Cu ); SetActiveLayer( F_Cu );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false ); GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
// Do not Run a dialog here: on some Window Managers, it creates issues. // Do not Run a dialog here: on some Window Managers, it creates issues.
// Reason: the FOOTPRINT_WIZARD_FRAME is run as modal; // Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
@ -291,7 +291,7 @@ void FOOTPRINT_WIZARD_FRAME::updateView()
GetCanvas()->UpdateColors(); GetCanvas()->UpdateColors();
GetCanvas()->DisplayBoard( GetBoard() ); GetCanvas()->DisplayBoard( GetBoard() );
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); m_toolManager->RunAction( ACTIONS::zoomFitScreen );
UpdateMsgPanel(); UpdateMsgPanel();
} }
@ -643,7 +643,7 @@ void FOOTPRINT_WIZARD_FRAME::PythonPluginsReload()
PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) ); PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
if( pcbframe ) if( pcbframe )
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true ); pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload );
else else
GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true ); GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload );
} }

View File

@ -309,7 +309,7 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR
else else
{ {
// at this point, we can save the footprint // at this point, we can save the footprint
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, inductorFP.get() ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, inductorFP.get() );
BOARD_COMMIT commit( this ); BOARD_COMMIT commit( this );
commit.Add( inductorFP.release() ); commit.Add( inductorFP.release() );

View File

@ -459,9 +459,7 @@ long NL_PCBNEW_PLUGIN_IMPL::SetActiveCommand( std::string commandId )
} }
if( runAction ) if( runAction )
{ tool_manager->RunAction( *context );
tool_manager->RunAction( *context, true );
}
} }
else else
{ {

View File

@ -120,7 +120,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR
// Spread new footprints. // Spread new footprints.
std::vector<FOOTPRINT*> newFootprints = aUpdater.GetAddedFootprints(); std::vector<FOOTPRINT*> newFootprints = aUpdater.GetAddedFootprints();
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); GetToolManager()->RunAction( PCB_ACTIONS::selectionClear );
SpreadFootprints( &newFootprints, { 0, 0 }, true ); SpreadFootprints( &newFootprints, { 0, 0 }, true );
@ -128,7 +128,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR
if( !newFootprints.empty() ) if( !newFootprints.empty() )
{ {
for( FOOTPRINT* footprint : newFootprints ) for( FOOTPRINT* footprint : newFootprints )
GetToolManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, footprint ); GetToolManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, footprint );
*aRunDragCommand = true; *aRunDragCommand = true;
} }

View File

@ -371,7 +371,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab ); m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
} }
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false ); GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
// This is used temporarily to fix a client size issue on GTK that causes zoom to fit // This is used temporarily to fix a client size issue on GTK that causes zoom to fit
// to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize(). // to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize().
@ -405,7 +405,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
PythonSyncProjectName(); PythonSyncProjectName();
// Sync action plugins in case they changed since the last time the frame opened // Sync action plugins in case they changed since the last time the frame opened
GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true ); GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload );
GetCanvas()->SwitchBackend( m_canvasType ); GetCanvas()->SwitchBackend( m_canvasType );
ActivateGalCanvas(); ActivateGalCanvas();
@ -1371,7 +1371,7 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
m_appearancePanel->OnLayerChanged(); m_appearancePanel->OnLayerChanged();
m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
GetCanvas()->SetFocus(); // allow capture of hotkeys GetCanvas()->SetFocus(); // allow capture of hotkeys
GetCanvas()->SetHighContrastLayer( aLayer ); GetCanvas()->SetHighContrastLayer( aLayer );
@ -2450,7 +2450,7 @@ void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
// We only need this until the frame is done resizing and the final client size is // We only need this until the frame is done resizing and the final client size is
// established. // established.
Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this ); Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
} }
// Skip() is called in the base class. // Skip() is called in the base class.

View File

@ -279,7 +279,7 @@ void LENGTH_TUNER_TOOL::setTransitions()
int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent ) int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
{ {
// Deselect all items // Deselect all items
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
frame()->PushTool( aEvent ); frame()->PushTool( aEvent );

View File

@ -312,7 +312,7 @@ protected:
{ {
bds.UseCustomTrackViaSize( true ); bds.UseCustomTrackViaSize( true );
bds.m_TempOverrideTrackWidth = true; bds.m_TempOverrideTrackWidth = true;
m_frame.GetToolManager()->RunAction( ACT_CustomTrackWidth, true ); m_frame.GetToolManager()->RunAction( ACT_CustomTrackWidth );
} }
else if( id == ID_POPUP_PCB_SELECT_AUTO_WIDTH ) else if( id == ID_POPUP_PCB_SELECT_AUTO_WIDTH )
{ {
@ -438,7 +438,7 @@ protected:
{ {
bds.UseCustomDiffPairDimensions( true ); bds.UseCustomDiffPairDimensions( true );
TOOL_MANAGER* toolManager = m_frame.GetToolManager(); TOOL_MANAGER* toolManager = m_frame.GetToolManager();
toolManager->RunAction( PCB_ACTIONS::routerDiffPairDialog, true ); toolManager->RunAction( PCB_ACTIONS::routerDiffPairDialog );
} }
else if( id == ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR ) else if( id == ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR )
{ {
@ -1485,7 +1485,7 @@ void ROUTER_TOOL::performRouting()
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW ); frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
controls()->SetAutoPan( false ); controls()->SetAutoPan( false );
{ {
m_toolMgr->RunAction( ACT_CustomTrackWidth, true ); m_toolMgr->RunAction( ACT_CustomTrackWidth );
} }
controls()->SetAutoPan( true ); controls()->SetAutoPan( true );
setCursor(); setCursor();
@ -1636,7 +1636,7 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent )
if( selection.Size() == 0 ) if( selection.Size() == 0 )
return 0; return 0;
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
frame->PushTool( aEvent ); frame->PushTool( aEvent );
@ -1714,9 +1714,9 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent )
bool autoRouted = false; bool autoRouted = false;
if( autoRoute ) if( autoRoute )
m_toolMgr->RunAction( PCB_ACTIONS::routerAttemptFinish, false, &autoRouted ); m_toolMgr->PostAction( PCB_ACTIONS::routerAttemptFinish, &autoRouted );
else if( otherEnd ) else if( otherEnd )
m_toolMgr->RunAction( PCB_ACTIONS::routerContinueFromEnd, false ); m_toolMgr->PostAction( PCB_ACTIONS::routerContinueFromEnd );
// We want autorouted tracks to all be in one undo group except for // We want autorouted tracks to all be in one undo group except for
// any tracks that need to be manually finished. // any tracks that need to be manually finished.
@ -1762,7 +1762,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
} }
// Deselect all items // Deselect all items
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
frame->PushTool( aEvent ); frame->PushTool( aEvent );
@ -1853,7 +1853,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
} }
else if( evt->IsAction( &ACT_PlaceThroughVia ) ) else if( evt->IsAction( &ACT_PlaceThroughVia ) )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::layerToggle, true ); m_toolMgr->RunAction( PCB_ACTIONS::layerToggle );
} }
else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) ) else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
{ {
@ -1923,7 +1923,7 @@ void ROUTER_TOOL::performDragging( int aMode )
m_cancelled = true; m_cancelled = true;
m_toolMgr->RunAction( PCB_ACTIONS::drag45Degree, false ); m_toolMgr->PostAction( PCB_ACTIONS::drag45Degree );
return; return;
} }
@ -2078,7 +2078,7 @@ void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECT
bool ROUTER_TOOL::CanInlineDrag( int aDragMode ) bool ROUTER_TOOL::CanInlineDrag( int aDragMode )
{ {
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor, true, m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor,
NeighboringSegmentFilter ); NeighboringSegmentFilter );
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection(); const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
@ -2108,7 +2108,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
if( selection.Empty() ) if( selection.Empty() )
{ {
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor, true, m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor,
NeighboringSegmentFilter ); NeighboringSegmentFilter );
} }
@ -2137,7 +2137,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
item->SetLocked( false ); item->SetLocked( false );
} }
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
frame()->PushTool( aEvent ); frame()->PushTool( aEvent );
Activate(); Activate();
@ -2444,7 +2444,7 @@ int ROUTER_TOOL::InlineBreakTrack( const TOOL_EVENT& aEvent )
if( item->Type() != PCB_TRACE_T ) if( item->Type() != PCB_TRACE_T )
return 0; return 0;
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
Activate(); Activate();

View File

@ -746,7 +746,7 @@ int BOARD_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
designSettings.SetDiffPairIndex( widthIndex ); designSettings.SetDiffPairIndex( widthIndex );
designSettings.UseCustomDiffPairDimensions( false ); designSettings.UseCustomDiffPairDimensions( false );
m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged, true ); m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged );
} }
else else
{ {
@ -770,7 +770,7 @@ int BOARD_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
designSettings.SetTrackWidthIndex( widthIndex ); designSettings.SetTrackWidthIndex( widthIndex );
designSettings.UseCustomTrackViaSize( false ); designSettings.UseCustomTrackViaSize( false );
m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged, true ); m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged );
} }
return 0; return 0;
@ -826,7 +826,7 @@ int BOARD_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
designSettings.SetDiffPairIndex( widthIndex ); designSettings.SetDiffPairIndex( widthIndex );
designSettings.UseCustomDiffPairDimensions( false ); designSettings.UseCustomDiffPairDimensions( false );
m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged, true ); m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged );
} }
else else
{ {
@ -850,7 +850,7 @@ int BOARD_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
designSettings.SetTrackWidthIndex( widthIndex ); designSettings.SetTrackWidthIndex( widthIndex );
designSettings.UseCustomTrackViaSize( false ); designSettings.UseCustomTrackViaSize( false );
m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged, true ); m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged );
} }
return 0; return 0;
@ -899,7 +899,7 @@ int BOARD_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
designSettings.SetViaSizeIndex( sizeIndex ); designSettings.SetViaSizeIndex( sizeIndex );
designSettings.UseCustomTrackViaSize( false ); designSettings.UseCustomTrackViaSize( false );
m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged, true ); m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged );
} }
return 0; return 0;
@ -956,7 +956,7 @@ int BOARD_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
designSettings.SetViaSizeIndex( sizeIndex ); designSettings.SetViaSizeIndex( sizeIndex );
designSettings.UseCustomTrackViaSize( false ); designSettings.UseCustomTrackViaSize( false );
m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged, true ); m_toolMgr->RunAction( PCB_ACTIONS::trackViaSizeChanged );
} }
return 0; return 0;
@ -977,7 +977,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
BOARD* board = getModel<BOARD>(); BOARD* board = getModel<BOARD>();
COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings(); COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -990,7 +990,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
commit.Revert(); commit.Revert();
if( fromOtherCommand ) if( fromOtherCommand )
@ -1024,8 +1024,8 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
{ {
m_placingFootprint = true; m_placingFootprint = true;
fp->SetPosition( cursorPos ); fp->SetPosition( cursorPos );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, fp ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, fp );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else if( aEvent.HasPosition() ) else if( aEvent.HasPosition() )
{ {
@ -1044,7 +1044,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() ); cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
if( reselect && fp ) if( reselect && fp )
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, fp ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, fp );
if( evt->IsCancelInteractive() ) if( evt->IsCancelInteractive() )
{ {
@ -1128,13 +1128,13 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
fp->GetField( FOOTPRINT_FIELD )->SetText( UnescapeString( fp->GetFPIDAsString() ) ); fp->GetField( FOOTPRINT_FIELD )->SetText( UnescapeString( fp->GetFPIDAsString() ) );
commit.Add( fp ); commit.Add( fp );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, fp ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, fp );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else else
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
commit.Push( _( "Place a footprint" ) ); commit.Push( _( "Place a footprint" ) );
fp = nullptr; // to indicate that there is no footprint that we currently modify fp = nullptr; // to indicate that there is no footprint that we currently modify
m_placingFootprint = false; m_placingFootprint = false;
@ -1203,7 +1203,7 @@ int BOARD_EDITOR_CONTROL::modifyLockSelected( MODIFY_MODE aMode )
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
if( selection.Empty() ) if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor );
// Resolve TOGGLE mode // Resolve TOGGLE mode
if( aMode == TOGGLE ) if( aMode == TOGGLE )
@ -1361,7 +1361,7 @@ int BOARD_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
toMerge.push_back( curr_area ); toMerge.push_back( curr_area );
} }
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
if( !toMerge.empty() ) if( !toMerge.empty() )
{ {
@ -1370,7 +1370,7 @@ int BOARD_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
commit.Push( wxT( "Merge zones" ) ); commit.Push( wxT( "Merge zones" ) );
for( EDA_ITEM* item : merged ) for( EDA_ITEM* item : merged )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, item ); m_toolMgr->RunAction( PCB_ACTIONS::selectItem, item );
} }
} }
@ -1503,7 +1503,7 @@ int BOARD_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
} }
selectionTool->ClearSelection(); selectionTool->ClearSelection();
m_toolMgr->RunAction( PCB_ACTIONS::selectNet, true, netCode ); m_toolMgr->RunAction( PCB_ACTIONS::selectNet, netCode );
canvas()->ForceRefresh(); canvas()->ForceRefresh();
DIALOG_ASSIGN_NETCLASS dlg( m_frame, netName, board()->GetNetClassAssignmentCandidates(), DIALOG_ASSIGN_NETCLASS dlg( m_frame, netName, board()->GetNetClassAssignmentCandidates(),
@ -1561,7 +1561,7 @@ int BOARD_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
editor->Raise(); // Iconize( false ); editor->Raise(); // Iconize( false );
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
return 0; return 0;
} }
@ -1592,7 +1592,7 @@ int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
return false; // drill origin is a one-shot; don't continue with tool return false; // drill origin is a one-shot; don't continue with tool
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }

View File

@ -1516,10 +1516,10 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
m_frame->m_probingSchToPcb = true; // recursion guard m_frame->m_probingSchToPcb = true; // recursion guard
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
if( item ) if( item )
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, item ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, item );
} }
m_frame->m_probingSchToPcb = false; m_frame->m_probingSchToPcb = false;
@ -1756,15 +1756,15 @@ int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
{ {
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>(); PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor, true, m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor,
EDIT_TOOL::PadFilter ); EDIT_TOOL::PadFilter );
PCB_SELECTION& selection = selectionTool->GetSelection(); PCB_SELECTION& selection = selectionTool->GetSelection();
if( selection.Empty() ) if( selection.Empty() )
{ {
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor, true, m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor,
EDIT_TOOL::FootprintFilter ); EDIT_TOOL::FootprintFilter );
selection = selectionTool->GetSelection(); selection = selectionTool->GetSelection();
} }
@ -1817,7 +1817,7 @@ int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
} }
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }

View File

@ -549,7 +549,7 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent,
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
// do not capture or auto-pan until we start placing the table // do not capture or auto-pan until we start placing the table
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::TEXT ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::TEXT );

View File

@ -410,7 +410,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
commit.Add( rect ); commit.Add( rect );
commit.Push( isTextBox ? _( "Draw a text box" ) : _( "Draw a rectangle" ) ); commit.Push( isTextBox ? _( "Draw a text box" ) : _( "Draw a rectangle" ) );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, rect ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, rect );
} }
} }
@ -458,7 +458,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
commit.Add( circle ); commit.Add( circle );
commit.Push( _( "Draw a circle" ) ); commit.Push( _( "Draw a circle" ) );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, circle ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, circle );
} }
circle = new PCB_SHAPE( parent ); circle = new PCB_SHAPE( parent );
@ -505,7 +505,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
commit.Add( arc ); commit.Add( arc );
commit.Push( _( "Draw an arc" ) ); commit.Push( _( "Draw an arc" ) );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, arc ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, arc );
} }
arc = new PCB_SHAPE( parent ); arc = new PCB_SHAPE( parent );
@ -536,7 +536,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>(); PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
// Add all the drawable symbols to preview // Add all the drawable symbols to preview
if( image ) if( image )
@ -559,7 +559,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&] () [&] ()
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->RecacheAllItems(); m_view->RecacheAllItems();
delete image; delete image;
@ -577,7 +577,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
// Prime the pump // Prime the pump
if( image ) if( image )
{ {
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else if( aEvent.HasPosition() ) else if( aEvent.HasPosition() )
{ {
@ -650,7 +650,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
{ {
if( !image ) if( !image )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
wxFileDialog dlg( m_frame, _( "Choose Image" ), wxEmptyString, wxEmptyString, wxFileDialog dlg( m_frame, _( "Choose Image" ), wxEmptyString, wxEmptyString,
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(), _( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
@ -705,10 +705,10 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
commit.Add( image ); commit.Add( image );
commit.Push( _( "Place an image" ) ); commit.Push( _( "Place an image" ) );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, image ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, image );
image = nullptr; image = nullptr;
m_toolMgr->RunAction( ACTIONS::activatePointEditor ); m_toolMgr->PostAction( ACTIONS::activatePointEditor );
m_view->ClearPreview(); m_view->ClearPreview();
@ -785,7 +785,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
auto cleanup = auto cleanup =
[&]() [&]()
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_controls->ForceCursorPosition( false ); m_controls->ForceCursorPosition( false );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
m_controls->SetAutoPan( false ); m_controls->SetAutoPan( false );
@ -803,7 +803,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT ); m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT );
}; };
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -875,7 +875,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
if( !text ) if( !text )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_controls->ForceCursorPosition( true, m_controls->GetCursorPosition() ); m_controls->ForceCursorPosition( true, m_controls->GetCursorPosition() );
@ -934,7 +934,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();
} }
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, text ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, text );
m_view->Update( &selection() ); m_view->Update( &selection() );
// update the cursor so it looks correct before another event // update the cursor so it looks correct before another event
@ -945,12 +945,12 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
if( placing ) if( placing )
{ {
text->ClearFlags(); text->ClearFlags();
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
commit.Add( text ); commit.Add( text );
commit.Push( _( "Place a text" ) ); commit.Push( _( "Place a text" ) );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, text ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, text );
text = nullptr; text = nullptr;
} }
@ -971,7 +971,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
cursorPos = m_controls->GetMousePosition(); cursorPos = m_controls->GetMousePosition();
} }
m_toolMgr->RunAction( PCB_ACTIONS::refreshPreview ); m_toolMgr->PostAction( PCB_ACTIONS::refreshPreview );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
m_controls->CaptureCursor( text != nullptr ); m_controls->CaptureCursor( text != nullptr );
@ -1082,7 +1082,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE ); m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE );
}; };
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -1093,7 +1093,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
// Set initial cursor // Set initial cursor
setCursor(); setCursor();
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
if( aEvent.HasPosition() ) if( aEvent.HasPosition() )
m_toolMgr->PrimeTool( aEvent.Position() ); m_toolMgr->PrimeTool( aEvent.Position() );
@ -1185,7 +1185,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
{ {
case SET_ORIGIN: case SET_ORIGIN:
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
PCB_LAYER_ID layer = m_frame->GetActiveLayer(); PCB_LAYER_ID layer = m_frame->GetActiveLayer();
@ -1289,7 +1289,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
if( t == PCB_DIM_LEADER_T ) if( t == PCB_DIM_LEADER_T )
frame()->OnEditItemRequest( dimension ); frame()->OnEditItemRequest( dimension );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, dimension ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, dimension );
break; break;
} }
@ -1303,7 +1303,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
} }
else if( evt->IsDblClick( BUT_LEFT ) ) else if( evt->IsDblClick( BUT_LEFT ) )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::cursorClick, false ); m_toolMgr->PostAction( PCB_ACTIONS::cursorClick );
} }
} }
else if( evt->IsMotion() ) else if( evt->IsMotion() )
@ -1501,7 +1501,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true ); m_toolMgr->RunAction( ACTIONS::cancelInteractive );
std::vector<BOARD_ITEM*> newItems; // all new items, including group std::vector<BOARD_ITEM*> newItems; // all new items, including group
std::vector<BOARD_ITEM*> selectedItems; // the group, or newItems if no group std::vector<BOARD_ITEM*> selectedItems; // the group, or newItems if no group
@ -1552,10 +1552,10 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
m_view->Add( &preview ); m_view->Add( &preview );
// Clear the current selection then select the drawings so that edit tools work on them // Clear the current selection then select the drawings so that edit tools work on them
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() ); EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &selItems ); m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &selItems );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -1598,7 +1598,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() || evt->IsActivate() ) if( evt->IsCancelInteractive() || evt->IsActivate() )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
if( group ) if( group )
{ {
@ -1672,7 +1672,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ANCHOR ); SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ANCHOR );
PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() );
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -1845,7 +1845,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
// Set initial cursor // Set initial cursor
setCursor(); setCursor();
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
if( aStartingPoint ) if( aStartingPoint )
m_toolMgr->PrimeTool( *aStartingPoint ); m_toolMgr->PrimeTool( *aStartingPoint );
@ -1952,7 +1952,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
if( !started ) if( !started )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
if( aStartingPoint ) if( aStartingPoint )
{ {
@ -2020,7 +2020,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
{ {
commit.Add( graphic ); commit.Add( graphic );
commit.Push( _( "Draw a line segment" ) ); commit.Push( _( "Draw a line segment" ) );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, graphic ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, graphic );
} }
else else
{ {
@ -2250,7 +2250,7 @@ bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
bool started = false; bool started = false;
bool cancelled = false; bool cancelled = false;
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
if( aStartingPoint ) if( aStartingPoint )
m_toolMgr->PrimeTool( *aStartingPoint ); m_toolMgr->PrimeTool( *aStartingPoint );
@ -2310,7 +2310,7 @@ bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
{ {
if( !started ) if( !started )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_controls->SetAutoPan( true ); m_controls->SetAutoPan( true );
m_controls->CaptureCursor( true ); m_controls->CaptureCursor( true );
@ -2489,7 +2489,7 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE** aZone )
if( selection.Empty() ) if( selection.Empty() )
{ {
clearSelection = true; clearSelection = true;
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor );
} }
// we want a single zone // we want a single zone
@ -2500,7 +2500,7 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE** aZone )
if( !*aZone ) if( !*aZone )
{ {
if( clearSelection ) if( clearSelection )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
return false; return false;
} }

View File

@ -82,7 +82,7 @@ void DRC_TOOL::ShowDRCDialog( wxWindow* aParent )
} }
Activate(); Activate();
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
if( !m_drcDialog ) if( !m_drcDialog )
{ {

View File

@ -282,11 +282,11 @@ int EDIT_TOOL::GetAndPlace( const TOOL_EVENT& aEvent )
if( fp ) if( fp )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, fp ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, fp );
selectionTool->GetSelection().SetReferencePoint( fp->GetPosition() ); selectionTool->GetSelection().SetReferencePoint( fp->GetPosition() );
m_toolMgr->RunAction( PCB_ACTIONS::move, false ); m_toolMgr->PostAction( PCB_ACTIONS::move );
} }
return 0; return 0;
@ -314,7 +314,7 @@ bool EDIT_TOOL::invokeInlineRouter( int aDragMode )
if( theRouter->CanInlineDrag( aDragMode ) ) if( theRouter->CanInlineDrag( aDragMode ) )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::routerInlineDrag, true, aDragMode ); m_toolMgr->RunAction( PCB_ACTIONS::routerInlineDrag, aDragMode );
return true; return true;
} }
@ -839,7 +839,7 @@ int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent )
if( selection.IsHover() ) if( selection.IsHover() )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
// Notify other tools of the changes -- This updates the visual ratsnest // Notify other tools of the changes -- This updates the visual ratsnest
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
@ -1341,14 +1341,14 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false ); VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
if( ds && ds->HitTestDrawingSheetItems( getView(), cursorPos ) ) if( ds && ds->HitTestDrawingSheetItems( getView(), cursorPos ) )
m_toolMgr->RunAction( ACTIONS::pageSettings ); m_toolMgr->PostAction( ACTIONS::pageSettings );
else else
m_toolMgr->RunAction( PCB_ACTIONS::footprintProperties, true ); m_toolMgr->RunAction( PCB_ACTIONS::footprintProperties );
} }
if( selection.IsHover() ) if( selection.IsHover() )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
} }
else else
{ {
@ -1475,12 +1475,12 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
m_commit->Push( _( "Rotate" ) ); m_commit->Push( _( "Rotate" ) );
if( is_hover && !m_dragging ) if( is_hover && !m_dragging )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
if( m_dragging ) if( m_dragging )
m_toolMgr->RunAction( PCB_ACTIONS::updateLocalRatsnest, false ); m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest );
} }
// Restore the old reference so any mouse dragging that occurs doesn't make the selection jump // Restore the old reference so any mouse dragging that occurs doesn't make the selection jump
@ -1675,12 +1675,12 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
m_commit->Push( _( "Mirror" ) ); m_commit->Push( _( "Mirror" ) );
if( selection.IsHover() && !m_dragging ) if( selection.IsHover() && !m_dragging )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
if( m_dragging ) if( m_dragging )
m_toolMgr->RunAction( PCB_ACTIONS::updateLocalRatsnest, false ); m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest );
return 0; return 0;
} }
@ -1752,12 +1752,12 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
m_commit->Push( _( "Change Side / Flip" ) ); m_commit->Push( _( "Change Side / Flip" ) );
if( selection.IsHover() && !m_dragging ) if( selection.IsHover() && !m_dragging )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
if( m_dragging ) if( m_dragging )
m_toolMgr->RunAction( PCB_ACTIONS::updateLocalRatsnest, false ); m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest );
// Restore the old reference so any mouse dragging that occurs doesn't make the selection jump // Restore the old reference so any mouse dragging that occurs doesn't make the selection jump
// to this now invalid reference // to this now invalid reference
@ -1773,7 +1773,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut ) void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
{ {
// As we are about to remove items, they have to be removed from the selection first // As we are about to remove items, they have to be removed from the selection first
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
for( EDA_ITEM* item : aItems ) for( EDA_ITEM* item : aItems )
{ {
@ -1856,7 +1856,7 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
canvas()->Refresh(); canvas()->Refresh();
// Restore the selection on the original zone // Restore the selection on the original zone
m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, zone ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, zone );
break; break;
} }
@ -1985,7 +1985,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
// In "alternative" mode, we expand selected track items to their full connection. // In "alternative" mode, we expand selected track items to their full connection.
if( isAlt && ( selectionCopy.HasType( PCB_TRACE_T ) || selectionCopy.HasType( PCB_VIA_T ) ) ) if( isAlt && ( selectionCopy.HasType( PCB_TRACE_T ) || selectionCopy.HasType( PCB_VIA_T ) ) )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectConnection, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectConnection );
} }
// Finally run RequestSelection() one more time to find out what user wants to do about // Finally run RequestSelection() one more time to find out what user wants to do about
@ -2097,12 +2097,12 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
m_commit->Push( _( "Move exact" ) ); m_commit->Push( _( "Move exact" ) );
if( selection.IsHover() ) if( selection.IsHover() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
if( m_dragging ) if( m_dragging )
m_toolMgr->RunAction( PCB_ACTIONS::updateLocalRatsnest, false ); m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest );
} }
return 0; return 0;
@ -2225,11 +2225,11 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
} }
// Clear the old selection first // Clear the old selection first
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
// Select the new items // Select the new items
EDA_ITEMS nItems( new_items.begin(), new_items.end() ); EDA_ITEMS nItems( new_items.begin(), new_items.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &nItems ); m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &nItems );
// record the new items as added // record the new items as added
if( !selection.Empty() ) if( !selection.Empty() )
@ -2239,7 +2239,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
// TODO(ISM): This line can't be used to activate the tool until we allow multiple // TODO(ISM): This line can't be used to activate the tool until we allow multiple
// activations. // activations.
// m_toolMgr->RunAction( PCB_ACTIONS::move, true ); // m_toolMgr->RunAction( PCB_ACTIONS::move );
// Instead we have to create the event and call the tool's function // Instead we have to create the event and call the tool's function
// directly // directly
@ -2250,7 +2250,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
// Deslect the duplicated item if we originally started as a hover selection // Deslect the duplicated item if we originally started as a hover selection
if( is_hover ) if( is_hover )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
} }
return 0; return 0;
@ -2398,7 +2398,7 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS
m_statusPopup->Popup(); m_statusPopup->Popup();
canvas()->SetStatusPopup( m_statusPopup->GetPanel() ); canvas()->SetStatusPopup( m_statusPopup->GetPanel() );
m_toolMgr->RunAction( ACTIONS::pickerSubTool, true ); m_toolMgr->RunAction( ACTIONS::pickerSubTool );
while( !done ) while( !done )
{ {

View File

@ -394,7 +394,7 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
pickedReferencePoint ) ) pickedReferencePoint ) )
{ {
if( is_hover ) if( is_hover )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
editFrame->PopTool( aEvent ); editFrame->PopTool( aEvent );
return 0; return 0;
@ -449,7 +449,7 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
displayConstraintsMessage( hv45Mode ); displayConstraintsMessage( hv45Mode );
// Prime the pump // Prime the pump
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
// Main loop: keep receiving events // Main loop: keep receiving events
do do
@ -666,7 +666,7 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) ); statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
m_toolMgr->RunAction( PCB_ACTIONS::updateLocalRatsnest, false, new VECTOR2I( movement ) ); m_toolMgr->PostAction( PCB_ACTIONS::updateLocalRatsnest, new VECTOR2I( movement ) );
} }
else if( evt->IsCancelInteractive() || evt->IsActivate() ) else if( evt->IsCancelInteractive() || evt->IsActivate() )
{ {
@ -794,7 +794,7 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
// Unselect all items to clear selection flags and then re-select the originally selected // Unselect all items to clear selection flags and then re-select the originally selected
// items (after the potential Revert()). // items (after the potential Revert()).
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
// TODO: there's an encapsulation leak here: this commit often has more than just the move // TODO: there's an encapsulation leak here: this commit often has more than just the move
// in it; for instance it might have a paste, append board, etc. as well. // in it; for instance it might have a paste, append board, etc. as well.
@ -818,12 +818,12 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
m_commit->Push( aCommitMessage ); m_commit->Push( aCommitMessage );
EDA_ITEMS oItems( orig_items.begin(), orig_items.end() ); EDA_ITEMS oItems( orig_items.begin(), orig_items.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &oItems ); m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &oItems );
} }
m_toolMgr->GetTool<DRAWING_TOOL>()->UpdateStatusBar(); m_toolMgr->GetTool<DRAWING_TOOL>()->UpdateStatusBar();
// Remove the dynamic ratsnest from the screen // Remove the dynamic ratsnest from the screen
m_toolMgr->RunAction( PCB_ACTIONS::hideLocalRatsnest, true ); m_toolMgr->RunAction( PCB_ACTIONS::hideLocalRatsnest );
editFrame->PopTool( aEvent ); editFrame->PopTool( aEvent );
editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW ); editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );

View File

@ -524,7 +524,7 @@ int FOOTPRINT_EDITOR_CONTROL::ImportFootprint( const TOOL_EVENT& aEvent )
m_frame->ReCreateHToolbar(); m_frame->ReCreateHToolbar();
} }
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); m_toolMgr->RunAction( ACTIONS::zoomFitScreen );
m_frame->OnModify(); m_frame->OnModify();
return 0; return 0;
} }

View File

@ -145,7 +145,7 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
picker->SetClickHandler( picker->SetClickHandler(
[&]( const VECTOR2D& aPoint ) -> bool [&]( const VECTOR2D& aPoint ) -> bool
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
const PCB_SELECTION& sel = m_selectionTool->RequestSelection( const PCB_SELECTION& sel = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector,
@ -200,7 +200,7 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
statusPopup.Popup(); statusPopup.Popup();
canvas()->SetStatusPopup( statusPopup.GetPanel() ); canvas()->SetStatusPopup( statusPopup.GetPanel() );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
while( !done ) while( !done )
{ {
@ -315,10 +315,10 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent )
std::vector<BOARD_ITEM*> members; std::vector<BOARD_ITEM*> members;
if( selection.Empty() ) if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor );
PCB_SELECTION selCopy = selection; PCB_SELECTION selCopy = selection;
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
for( EDA_ITEM* item : selCopy ) for( EDA_ITEM* item : selCopy )
{ {
@ -358,7 +358,7 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent )
} }
EDA_ITEMS mem( members.begin(), members.end() ); EDA_ITEMS mem( members.begin(), members.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &mem ); m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &mem );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified ); m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify(); m_frame->OnModify();
@ -374,7 +374,7 @@ int GROUP_TOOL::RemoveFromGroup( const TOOL_EVENT& aEvent )
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
if( selection.Empty() ) if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor );
std::map<PCB_GROUP*, std::vector<BOARD_ITEM*>> groupMap; std::map<PCB_GROUP*, std::vector<BOARD_ITEM*>> groupMap;

View File

@ -70,7 +70,7 @@ void PAD_TOOL::Reset( RESET_REASON aReason )
bool highContrast = ( opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL ); bool highContrast = ( opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL );
if( m_wasHighContrast != highContrast ) if( m_wasHighContrast != highContrast )
m_toolMgr->RunAction( ACTIONS::highContrastMode, true ); m_toolMgr->RunAction( ACTIONS::highContrastMode );
frame()->GetInfoBar()->Dismiss(); frame()->GetInfoBar()->Dismiss();
@ -300,7 +300,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
std::deque<int> storedPadNumbers; std::deque<int> storedPadNumbers;
std::map<wxString, std::pair<int, wxString>> oldNumbers; std::map<wxString, std::pair<int, wxString>> oldNumbers;
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
frame()->PushTool( aEvent ); frame()->PushTool( aEvent );
@ -348,7 +348,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() ) if( evt->IsCancelInteractive() )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
commit.Revert(); commit.Revert();
frame()->PopTool( aEvent ); frame()->PopTool( aEvent );
@ -611,7 +611,7 @@ int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent )
} ); } );
if( !m_wasHighContrast ) if( !m_wasHighContrast )
m_toolMgr->RunAction( ACTIONS::highContrastMode, true ); m_toolMgr->RunAction( ACTIONS::highContrastMode );
if( PCB_ACTIONS::explodePad.GetHotKey() == PCB_ACTIONS::recombinePad.GetHotKey() ) if( PCB_ACTIONS::explodePad.GetHotKey() == PCB_ACTIONS::recombinePad.GetHotKey() )
{ {
@ -635,7 +635,7 @@ int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent )
bool highContrast = ( opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL ); bool highContrast = ( opts.m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL );
if( m_wasHighContrast != highContrast ) if( m_wasHighContrast != highContrast )
m_toolMgr->RunAction( ACTIONS::highContrastMode, true ); m_toolMgr->RunAction( ACTIONS::highContrastMode );
settings->m_PadEditModePad = nullptr; settings->m_PadEditModePad = nullptr;
@ -727,7 +727,7 @@ PCB_LAYER_ID PAD_TOOL::explodePad( PAD* aPad )
} }
commit.Push( _("Edit pad shapes") ); commit.Push( _("Edit pad shapes") );
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
return layer; return layer;
} }
@ -739,7 +739,7 @@ std::vector<PCB_SHAPE*> PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun, BOARD
// Don't leave an object in the point editor that might no longer exist after // Don't leave an object in the point editor that might no longer exist after
// recombining the pad. // recombining the pad.
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
for( BOARD_ITEM* item : footprint->GraphicalItems() ) for( BOARD_ITEM* item : footprint->GraphicalItems() )
item->ClearFlags( SKIP_STRUCT ); item->ClearFlags( SKIP_STRUCT );

View File

@ -570,7 +570,7 @@ int PCB_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
return false; // drill origin is a one-shot; don't continue with tool return false; // drill origin is a one-shot; don't continue with tool
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
} }
return 0; return 0;
@ -596,7 +596,7 @@ int PCB_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>(); PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
m_pickerItem = nullptr; m_pickerItem = nullptr;
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
// Deactivate other tools; particularly important if another PICKER is currently running // Deactivate other tools; particularly important if another PICKER is currently running
Activate(); Activate();
@ -683,7 +683,7 @@ int PCB_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
return 0; return 0;
} }
@ -1103,7 +1103,7 @@ int PCB_CONTROL::placeBoardItems( BOARD* aBoard, bool aAnchorAtOrigin, bool aRea
int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew, int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
bool aAnchorAtOrigin, bool aReannotateDuplicates ) bool aAnchorAtOrigin, bool aReannotateDuplicates )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>(); PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>(); EDIT_TOOL* editTool = m_toolMgr->GetTool<EDIT_TOOL>();
@ -1153,7 +1153,7 @@ int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
// Select the items that should be selected // Select the items that should be selected
EDA_ITEMS toSel( itemsToSel.begin(), itemsToSel.end() ); EDA_ITEMS toSel( itemsToSel.begin(), itemsToSel.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &toSel ); m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &toSel );
// Reannotate duplicate footprints (make sense only in board editor ) // Reannotate duplicate footprints (make sense only in board editor )
if( aReannotateDuplicates && m_isBoardEditor ) if( aReannotateDuplicates && m_isBoardEditor )
@ -1185,7 +1185,7 @@ int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
getViewControls()->SetCursorPosition( getViewControls()->GetMousePosition(), false ); getViewControls()->SetCursorPosition( getViewControls()->GetMousePosition(), false );
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent ); m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
m_toolMgr->RunAction( PCB_ACTIONS::move, true ); m_toolMgr->RunAction( PCB_ACTIONS::move );
} }
return 0; return 0;

View File

@ -2323,7 +2323,7 @@ int PCB_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
} }
else else
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
commit.Remove( item ); commit.Remove( item );
} }
} }

View File

@ -298,7 +298,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
// Single click? Select single object // Single click? Select single object
if( m_highlight_modifier && brd_editor ) if( m_highlight_modifier && brd_editor )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::highlightNet, true ); m_toolMgr->RunAction( PCB_ACTIONS::highlightNet );
} }
else else
{ {
@ -338,15 +338,15 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( m_selection.GetSize() == 1 && m_selection[0]->Type() == PCB_GROUP_T ) if( m_selection.GetSize() == 1 && m_selection[0]->Type() == PCB_GROUP_T )
EnterGroup(); EnterGroup();
else else
m_toolMgr->RunAction( PCB_ACTIONS::properties, true ); m_toolMgr->RunAction( PCB_ACTIONS::properties );
} }
else if( evt->IsDblClick( BUT_MIDDLE ) ) else if( evt->IsDblClick( BUT_MIDDLE ) )
{ {
// Middle double click? Do zoom to fit or zoom to objects // Middle double click? Do zoom to fit or zoom to objects
if( evt->Modifier( MD_CTRL ) ) // Is CTRL key down? if( evt->Modifier( MD_CTRL ) ) // Is CTRL key down?
m_toolMgr->RunAction( ACTIONS::zoomFitObjects, true ); m_toolMgr->RunAction( ACTIONS::zoomFitObjects );
else else
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); m_toolMgr->RunAction( ACTIONS::zoomFitScreen );
} }
else if( evt->IsDrag( BUT_LEFT ) ) else if( evt->IsDrag( BUT_LEFT ) )
{ {
@ -424,11 +424,11 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
&& dynamic_cast<PCB_TRACK*>( m_selection.GetItem( 0 ) ); && dynamic_cast<PCB_TRACK*>( m_selection.GetItem( 0 ) );
if( haveTrack && trackDragAction == TRACK_DRAG_ACTION::DRAG ) if( haveTrack && trackDragAction == TRACK_DRAG_ACTION::DRAG )
m_toolMgr->RunAction( PCB_ACTIONS::drag45Degree, true ); m_toolMgr->RunAction( PCB_ACTIONS::drag45Degree );
else if( haveTrack && trackDragAction == TRACK_DRAG_ACTION::DRAG_FREE_ANGLE ) else if( haveTrack && trackDragAction == TRACK_DRAG_ACTION::DRAG_FREE_ANGLE )
m_toolMgr->RunAction( PCB_ACTIONS::dragFreeAngle, true ); m_toolMgr->RunAction( PCB_ACTIONS::dragFreeAngle );
else else
m_toolMgr->RunAction( PCB_ACTIONS::move, true ); m_toolMgr->RunAction( PCB_ACTIONS::move );
} }
else else
{ {
@ -554,7 +554,7 @@ PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCl
if( selectionEmpty ) if( selectionEmpty )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, aClientFilter ); m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, aClientFilter );
m_selection.ClearReferencePoint(); m_selection.ClearReferencePoint();
} }
@ -1155,7 +1155,7 @@ int PCB_SELECTION_TOOL::unrouteSelected( const TOOL_EVENT& aEvent )
// Get the tracks on our list of pads, then delete them // Get the tracks on our list of pads, then delete them
selectAllConnectedTracks( toUnroute, STOP_CONDITION::STOP_AT_PAD ); selectAllConnectedTracks( toUnroute, STOP_CONDITION::STOP_AT_PAD );
m_toolMgr->RunAction( ACTIONS::doDelete, true ); m_toolMgr->RunAction( ACTIONS::doDelete );
// Reselect our footprint/pads as they were in our original selection // Reselect our footprint/pads as they were in our original selection
for( EDA_ITEM* item : selectedItems ) for( EDA_ITEM* item : selectedItems )
@ -1544,7 +1544,7 @@ int PCB_SELECTION_TOOL::grabUnconnected( const TOOL_EVENT& aEvent )
select( nearest ); select( nearest );
} }
m_toolMgr->RunAction( PCB_ACTIONS::moveIndividually, true ); m_toolMgr->RunAction( PCB_ACTIONS::moveIndividually );
return 0; return 0;
} }
@ -2280,7 +2280,7 @@ void PCB_SELECTION_TOOL::ClearSelection( bool aQuietMode )
if( !aQuietMode ) if( !aQuietMode )
{ {
m_toolMgr->ProcessEvent( EVENTS::ClearedEvent ); m_toolMgr->ProcessEvent( EVENTS::ClearedEvent );
m_toolMgr->RunAction( PCB_ACTIONS::hideLocalRatsnest, true ); m_toolMgr->RunAction( PCB_ACTIONS::hideLocalRatsnest );
} }
} }

View File

@ -49,7 +49,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const TOOL_EVENT& aTool,
BOARD_COMMIT commit( frame() ); BOARD_COMMIT commit( frame() );
GetManager()->RunAction( PCB_ACTIONS::selectionClear, true ); GetManager()->RunAction( PCB_ACTIONS::selectionClear );
Activate(); Activate();
// Must be done after Activate() so that it gets set into the correct context // Must be done after Activate() so that it gets set into the correct context
@ -214,7 +214,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const TOOL_EVENT& aTool,
} }
else if( evt->IsAction( &PCB_ACTIONS::trackViaSizeChanged ) ) else if( evt->IsAction( &PCB_ACTIONS::trackViaSizeChanged ) )
{ {
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->PostAction( ACTIONS::refreshPreview );
} }
else if( newItem && evt->Category() == TC_COMMAND ) else if( newItem && evt->Category() == TC_COMMAND )
{ {

View File

@ -153,7 +153,7 @@ int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( const VECTOR2I& aPosAncho
m_commit->Push( _( "Position Relative" ) ); m_commit->Push( _( "Position Relative" ) );
if( m_selection.IsHover() ) if( m_selection.IsHover() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
@ -175,7 +175,7 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent
picker->SetClickHandler( picker->SetClickHandler(
[&]( const VECTOR2D& aPoint ) -> bool [&]( const VECTOR2D& aPoint ) -> bool
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
const PCB_SELECTION& sel = m_selectionTool->RequestSelection( const PCB_SELECTION& sel = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* sTool ) PCB_SELECTION_TOOL* sTool )
@ -219,7 +219,7 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent
statusPopup.Popup(); statusPopup.Popup();
canvas()->SetStatusPopup( statusPopup.GetPanel() ); canvas()->SetStatusPopup( statusPopup.GetPanel() );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
while( !done ) while( !done )
{ {

View File

@ -172,7 +172,7 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout )
// Clear the selection before removing the old zone // Clear the selection before removing the old zone
auto toolMgr = m_tool.GetManager(); auto toolMgr = m_tool.GetManager();
toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); toolMgr->RunAction( PCB_ACTIONS::selectionClear );
SHAPE_POLY_SET originalOutline( *aZone.Outline() ); SHAPE_POLY_SET originalOutline( *aZone.Outline() );
originalOutline.BooleanSubtract( *aCutout.Outline(), SHAPE_POLY_SET::PM_FAST ); originalOutline.BooleanSubtract( *aCutout.Outline(), SHAPE_POLY_SET::PM_FAST );
@ -213,7 +213,7 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout )
else else
{ {
m_params.m_sourceZone = newZones[0]; m_params.m_sourceZone = newZones[0];
toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, newZones[0] ); toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, newZones[0] );
} }
} }
@ -238,7 +238,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
commit.Add( aZone.get() ); commit.Add( aZone.get() );
commit.Push( _( "Add a zone" ) ); commit.Push( _( "Add a zone" ) );
m_tool.GetManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, m_tool.GetManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem,
aZone.release() ); aZone.release() );
break; break;
} }
@ -263,7 +263,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
poly->SetPolyShape( *aZone->Outline() ); poly->SetPolyShape( *aZone->Outline() );
commit.Add( poly ); commit.Add( poly );
m_tool.GetManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, poly ); m_tool.GetManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, poly );
commit.Push( _( "Add a graphical polygon" ) ); commit.Push( _( "Add a graphical polygon" ) );
@ -286,7 +286,7 @@ bool ZONE_CREATE_HELPER::OnFirstPoint( POLYGON_GEOM_MANAGER& aMgr )
if( m_zone ) if( m_zone )
{ {
m_tool.GetManager()->RunAction( PCB_ACTIONS::selectionClear, true ); m_tool.GetManager()->RunAction( PCB_ACTIONS::selectionClear );
// set up properties from zone // set up properties from zone
const auto& settings = *m_parentView.GetPainter()->GetSettings(); const auto& settings = *m_parentView.GetPainter()->GetSettings();

Some files were not shown because too many files have changed in this diff Show More