diff --git a/common/dialogs/dialog_group_properties.cpp b/common/dialogs/dialog_group_properties.cpp index 9a20075fbf..5d9e5dc396 100644 --- a/common/dialogs/dialog_group_properties.cpp +++ b/common/dialogs/dialog_group_properties.cpp @@ -113,7 +113,7 @@ bool DIALOG_GROUP_PROPERTIES::TransferDataFromWindow() static_cast( m_group )->SetLocked( m_locked->GetValue() ); } - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_group->RemoveAll(); for( size_t ii = 0; ii < m_membersList->GetCount(); ++ii ) @@ -122,7 +122,7 @@ bool DIALOG_GROUP_PROPERTIES::TransferDataFromWindow() m_group->AddItem( item ); } - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, m_group->AsEdaItem() ); + m_toolMgr->RunAction( ACTIONS::selectItem, m_group->AsEdaItem() ); commit.Push( _( "Edit Group Properties" ) ); return true; diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index c7188030d7..6c26973c64 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -151,6 +151,48 @@ TOOL_ACTION ACTIONS::quit( TOOL_ACTION_ARGS() .Tooltip( _( "Close the current editor" ) ) .Icon( BITMAPS::exit ) ); + +// Selection actions +TOOL_ACTION ACTIONS::selectionActivate( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection" ) + .Scope( AS_GLOBAL ) + // No description, not shown anywhere + .Flags( AF_ACTIVATE ) ); + +TOOL_ACTION ACTIONS::selectionCursor( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection.cursor" ) + .Scope( AS_GLOBAL ) + .Parameter( nullptr ) ); + +TOOL_ACTION ACTIONS::selectItem( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection.selectItem" ) + .Scope( AS_GLOBAL ) ); + +TOOL_ACTION ACTIONS::selectItems( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection.selectItems" ) + .Scope( AS_GLOBAL ) ); + +TOOL_ACTION ACTIONS::unselectItem( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection.unselectItem" ) + .Scope( AS_GLOBAL ) ); + +TOOL_ACTION ACTIONS::unselectItems( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection.unselectItems" ) + .Scope( AS_GLOBAL ) ); + +TOOL_ACTION ACTIONS::reselectItem( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection.reselectItem" ) + .Scope( AS_GLOBAL ) ); + +TOOL_ACTION ACTIONS::selectionClear( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection.clear" ) + .Scope( AS_GLOBAL ) ); + +TOOL_ACTION ACTIONS::selectionMenu( TOOL_ACTION_ARGS() + .Name( "common.InteractiveSelection.selectionMenu" ) + .Scope( AS_GLOBAL ) ); + + // Group actions TOOL_ACTION ACTIONS::group( TOOL_ACTION_ARGS() .Name( "common.Interactive.group" ) diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index ee090c83da..f6b135735c 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -121,7 +121,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa RecreateToolbars(); // Run the control tool, it is supposed to be always active - m_toolManager->InvokeTool( "cvpcb.FootprintViewerInteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); m_auimgr.SetManagedWindow( this ); diff --git a/cvpcb/tools/cvpcb_actions.cpp b/cvpcb/tools/cvpcb_actions.cpp index 4e133f9e83..0ef6c20680 100644 --- a/cvpcb/tools/cvpcb_actions.cpp +++ b/cvpcb/tools/cvpcb_actions.cpp @@ -34,13 +34,6 @@ #define _(s) s -// Selection tool action for the footprint viewer window -// No description, it is not supposed to be shown anywhere -TOOL_ACTION CVPCB_ACTIONS::selectionActivate( TOOL_ACTION_ARGS() - .Name( "cvpcb.FootprintViewerInteractiveSelection" ) - .Scope( AS_GLOBAL ) - .Flags( AF_ACTIVATE ) ); - // No description, it is not supposed to be shown anywhere TOOL_ACTION CVPCB_ACTIONS::controlActivate( TOOL_ACTION_ARGS() .Name( "cvpcb.Control" ) diff --git a/cvpcb/tools/cvpcb_actions.h b/cvpcb/tools/cvpcb_actions.h index 40438c96ff..cb62e59186 100644 --- a/cvpcb/tools/cvpcb_actions.h +++ b/cvpcb/tools/cvpcb_actions.h @@ -38,7 +38,6 @@ class CVPCB_ACTIONS : public ACTIONS { public: /// Activation actions - static TOOL_ACTION selectionActivate; static TOOL_ACTION controlActivate; /// Window control actions diff --git a/cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp b/cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp index 80c9ab548e..3c716662ac 100644 --- a/cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp +++ b/cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp @@ -27,7 +27,7 @@ using namespace std::placeholders; CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL() : - TOOL_INTERACTIVE( "cvpcb.FootprintViewerInteractiveSelection" ), + TOOL_INTERACTIVE( "common.InteractiveSelection" ), m_frame( nullptr ) { } @@ -98,6 +98,5 @@ int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent void CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions() { Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() ); - Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main, - CVPCB_ACTIONS::selectionActivate.MakeEvent() ); + Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main, ACTIONS::selectionActivate.MakeEvent() ); } diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index 4c39a6860c..7507dddd57 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -292,7 +292,7 @@ void DIALOG_ERC::OnDeleteOneClick( wxCommandEvent& aEvent ) if( m_notebook->GetSelection() == 0 ) { // Clear the selection. It may be the selected ERC marker. - m_parent->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection ); + m_parent->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_markerTreeModel->DeleteCurrentItem( true ); @@ -830,7 +830,7 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent ) // Clear the selection before deleting markers. It may be some selected ERC markers. // Deleting a selected marker without deselecting it first generates a crash - m_parent->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection ); + m_parent->GetToolManager()->RunAction( ACTIONS::selectionClear ); SCH_SCREENS ScreenList( m_parent->Schematic().Root() ); ScreenList.DeleteMarkers( MARKER_BASE::MARKER_ERC, rcItem->GetErrorCode() ); @@ -1010,7 +1010,7 @@ void DIALOG_ERC::deleteAllMarkers( bool aIncludeExclusions ) // Freeze to avoid repainting the dialog, which can cause a RePaint() // of the screen as well Freeze(); - m_parent->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection ); + m_parent->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_markerTreeModel->DeleteItems( false, aIncludeExclusions, false ); diff --git a/eeschema/picksymbol.cpp b/eeschema/picksymbol.cpp index 20910dfcdd..be805c6897 100644 --- a/eeschema/picksymbol.cpp +++ b/eeschema/picksymbol.cpp @@ -212,7 +212,7 @@ void SCH_EDIT_FRAME::FlipBodyStyle( SCH_SYMBOL* aSymbol ) // If selected make sure all the now-included pins are selected if( aSymbol->IsSelected() ) - m_toolManager->RunAction( SCH_ACTIONS::addItemToSel, aSymbol ); + m_toolManager->RunAction( ACTIONS::selectItem, aSymbol ); commit.Push( _( "Change Body Style" ) ); } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 93bbebc500..7e62556f71 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -553,7 +553,7 @@ void SCH_EDIT_FRAME::setupTools() m_toolManager->InitTools(); // Run the selection tool, it is supposed to be always active - m_toolManager->PostAction( SCH_ACTIONS::selectionActivate ); + m_toolManager->PostAction( ACTIONS::selectionActivate ); GetCanvas()->SetEventDispatcher( m_toolDispatcher ); } @@ -2233,7 +2233,7 @@ void SCH_EDIT_FRAME::UpdateNetHighlightStatus() void SCH_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen ) { if( m_toolManager ) - m_toolManager->RunAction( SCH_ACTIONS::clearSelection ); + m_toolManager->RunAction( ACTIONS::selectionClear ); SCH_BASE_FRAME::SetScreen( aScreen ); GetCanvas()->DisplaySheet( static_cast( aScreen ) ); @@ -2420,12 +2420,12 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet() wxCHECK( m_toolManager, /* void */ ); m_toolManager->RunAction( ACTIONS::cancelInteractive ); - m_toolManager->RunAction( SCH_ACTIONS::clearSelection ); + m_toolManager->RunAction( ACTIONS::selectionClear ); SCH_SCREEN* screen = GetCurrentSheet().LastScreen(); wxCHECK( screen, /* void */ ); - m_toolManager->RunAction( SCH_ACTIONS::clearSelection ); + m_toolManager->RunAction( ACTIONS::selectionClear ); SCH_BASE_FRAME::SetScreen( screen ); diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index c5ccd07499..b0d3e1440f 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -399,7 +399,7 @@ void SYMBOL_EDIT_FRAME::setupTools() m_toolManager->InitTools(); // Run the selection tool, it is supposed to be always active - m_toolManager->InvokeTool( "eeschema.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); GetCanvas()->SetEventDispatcher( m_toolDispatcher ); } @@ -857,7 +857,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom ) { wxCHECK( m_toolManager, /* void */ ); - m_toolManager->RunAction( SCH_ACTIONS::clearSelection ); + m_toolManager->RunAction( ACTIONS::selectionClear ); GetCanvas()->GetView()->Clear(); delete m_symbol; @@ -1052,7 +1052,7 @@ void SYMBOL_EDIT_FRAME::SetUnit( int aUnit ) return; m_toolManager->RunAction( ACTIONS::cancelInteractive ); - m_toolManager->RunAction( SCH_ACTIONS::clearSelection ); + m_toolManager->RunAction( ACTIONS::selectionClear ); m_unit = aUnit; diff --git a/eeschema/symbol_viewer_frame.cpp b/eeschema/symbol_viewer_frame.cpp index 1bd3d0a50b..57a01f1f8d 100644 --- a/eeschema/symbol_viewer_frame.cpp +++ b/eeschema/symbol_viewer_frame.cpp @@ -339,7 +339,7 @@ void SYMBOL_VIEWER_FRAME::setupTools() // Run the selection tool, it is supposed to be always active // It also manages the mouse right click to show the context menu - m_toolManager->InvokeTool( "eeschema.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); GetCanvas()->SetEventDispatcher( m_toolDispatcher ); } diff --git a/eeschema/tools/rule_area_create_helper.cpp b/eeschema/tools/rule_area_create_helper.cpp index 407349bf94..8cc7897164 100644 --- a/eeschema/tools/rule_area_create_helper.cpp +++ b/eeschema/tools/rule_area_create_helper.cpp @@ -68,7 +68,7 @@ void RULE_AREA_CREATE_HELPER::commitRuleArea( std::unique_ptr aRu commit.Add( ruleArea, m_frame->GetScreen() ); commit.Push( _( "Draw Rule Area" ) ); - m_toolManager->RunAction( SCH_ACTIONS::addItemToSel, ruleArea ); + m_toolManager->RunAction( ACTIONS::selectItem, ruleArea ); m_parentView.ClearPreview(); } @@ -80,7 +80,7 @@ bool RULE_AREA_CREATE_HELPER::OnFirstPoint( POLYGON_GEOM_MANAGER& aMgr ) if( m_rule_area ) { - m_toolManager->RunAction( SCH_ACTIONS::clearSelection ); + m_toolManager->RunAction( ACTIONS::selectionClear ); SCH_RENDER_SETTINGS renderSettings; COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings(); diff --git a/eeschema/tools/sch_actions.cpp b/eeschema/tools/sch_actions.cpp index b0c9bedec6..717551b992 100644 --- a/eeschema/tools/sch_actions.cpp +++ b/eeschema/tools/sch_actions.cpp @@ -94,11 +94,6 @@ TOOL_ACTION SCH_ACTIONS::pointEditorRemoveCorner( TOOL_ACTION_ARGS() // SCH_SELECTION_TOOL // -TOOL_ACTION SCH_ACTIONS::selectionActivate( TOOL_ACTION_ARGS() - .Name( "eeschema.InteractiveSelection" ) - .Scope( AS_GLOBAL ) - .Flags( AF_ACTIVATE ) ); - TOOL_ACTION SCH_ACTIONS::selectNode( TOOL_ACTION_ARGS() .Name( "eeschema.InteractiveSelection.SelectNode" ) .Scope( AS_GLOBAL ) @@ -116,30 +111,6 @@ TOOL_ACTION SCH_ACTIONS::selectConnection( TOOL_ACTION_ARGS() .Tooltip( _( "Select a complete connection" ) ) .Icon( BITMAPS::net_highlight_schematic ) ); -TOOL_ACTION SCH_ACTIONS::selectionMenu( TOOL_ACTION_ARGS() - .Name( "eeschema.InteractiveSelection.SelectionMenu" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION SCH_ACTIONS::addItemToSel( TOOL_ACTION_ARGS() - .Name( "eeschema.InteractiveSelection.AddItemToSel" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION SCH_ACTIONS::addItemsToSel( TOOL_ACTION_ARGS() - .Name( "eeschema.InteractiveSelection.AddItemsToSel" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION SCH_ACTIONS::removeItemFromSel( TOOL_ACTION_ARGS() - .Name( "eeschema.InteractiveSelection.RemoveItemFromSel" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION SCH_ACTIONS::removeItemsFromSel( TOOL_ACTION_ARGS() - .Name( "eeschema.InteractiveSelection.RemoveItemsFromSel" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION SCH_ACTIONS::clearSelection( TOOL_ACTION_ARGS() - .Name( "eeschema.InteractiveSelection.ClearSelection" ) - .Scope( AS_GLOBAL ) ); - TOOL_ACTION SCH_ACTIONS::syncSelection( TOOL_ACTION_ARGS() .Name( "eeschema.InteractiveSelection.SyncSelection" ) .Scope( AS_GLOBAL ) ); diff --git a/eeschema/tools/sch_actions.h b/eeschema/tools/sch_actions.h index 670577cf8f..325d9eecdb 100644 --- a/eeschema/tools/sch_actions.h +++ b/eeschema/tools/sch_actions.h @@ -43,9 +43,6 @@ public: static TOOL_ACTION saveCurrSheetCopyAs; // Selection Tool - /// Activation of the selection tool - static TOOL_ACTION selectionActivate; - /// Select the junction, wire or bus segment under the cursor. static TOOL_ACTION selectNode; @@ -53,17 +50,6 @@ public: /// Otherwise, select connection under cursor. static TOOL_ACTION selectConnection; - /// Clears the current selection - static TOOL_ACTION clearSelection; - - /// Selects an item (specified as the event parameter). - static TOOL_ACTION addItemToSel; - static TOOL_ACTION removeItemFromSel; - - /// Selects a list of items (specified as the event parameter) - static TOOL_ACTION addItemsToSel; - static TOOL_ACTION removeItemsFromSel; - /// Runs a selection menu to select from a list of items static TOOL_ACTION selectionMenu; diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 7aa06817b4..df4938822c 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -187,7 +187,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) auto addSymbol = [this]( SCH_SYMBOL* aSymbol ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_selectionTool->AddItemToSel( aSymbol ); aSymbol->SetFlags( IS_NEW | IS_MOVING ); @@ -210,7 +210,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) auto cleanup = [&]() { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); delete symbol; symbol = nullptr; @@ -337,7 +337,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) { if( !symbol ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); SYMBOL_LIB_TABLE* libs = PROJECT_SCH::SchSymbolLibTable( &m_frame->Prj() ); SYMBOL_LIB* cache = PROJECT_SCH::SchLibs( &m_frame->Prj() )->GetCacheLibrary(); @@ -840,7 +840,7 @@ int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent ) while( placeSheetContents() && cfg->m_DesignBlockChooserPanel.repeated_placement ) ; - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); delete designBlock; designBlock = nullptr; @@ -941,7 +941,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) KIGFX::VIEW_CONTROLS* controls = getViewControls(); VECTOR2I cursorPos; - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); // Add all the drawable symbols to preview if( image ) @@ -965,7 +965,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); m_view->RecacheAllItems(); delete image; @@ -1060,7 +1060,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) { if( !image ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); wxFileDialog dlg( m_frame, _( "Choose Image" ), m_mruPath, wxEmptyString, _( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(), @@ -1242,10 +1242,10 @@ int SCH_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent ) m_view->Add( &preview ); // Clear the current selection then select the drawings so that edit tools work on them - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() ); - m_toolMgr->RunAction( SCH_ACTIONS::addItemsToSel, &selItems ); + m_toolMgr->RunAction( ACTIONS::selectItems, &selItems ); m_frame->PushTool( aEvent ); @@ -1289,7 +1289,7 @@ int SCH_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent ) if( evt->IsCancelInteractive() || evt->IsActivate() ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); for( SCH_ITEM* item : newItems ) delete item; @@ -1396,7 +1396,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent ) return 0; } - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); cursorPos = aEvent.HasPosition() ? aEvent.Position() : controls->GetMousePosition(); @@ -1821,7 +1821,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) if( isSheetPin ) sheet = dynamic_cast( m_selectionTool->GetSelection().Front() ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -1860,7 +1860,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) auto cleanup = [&]() { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); delete item; item = nullptr; @@ -1973,7 +1973,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) // First click creates... if( !item ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( isText ) { @@ -2137,7 +2137,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) } m_frame->PopTool( aEvent ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_dialogSyncSheetPin->Show( true ); break; } @@ -2278,7 +2278,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) // gets whacked. m_toolMgr->DeactivateTool(); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -2291,7 +2291,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); delete item; item = nullptr; @@ -2363,7 +2363,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) } else if( evt->IsClick( BUT_LEFT ) && !item ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( isTextBox ) { @@ -2532,7 +2532,7 @@ int SCH_DRAWING_TOOLS::DrawRuleArea( const TOOL_EVENT& aEvent ) // gets whacked. m_toolMgr->DeactivateTool(); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -2548,7 +2548,7 @@ int SCH_DRAWING_TOOLS::DrawRuleArea( const TOOL_EVENT& aEvent ) started = false; getViewControls()->SetAutoPan( false ); getViewControls()->CaptureCursor( false ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); }; Activate(); @@ -2703,7 +2703,7 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent ) // gets whacked. m_toolMgr->DeactivateTool(); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -2716,7 +2716,7 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); delete table; table = nullptr; @@ -2790,7 +2790,7 @@ int SCH_DRAWING_TOOLS::DrawTable( const TOOL_EVENT& aEvent ) } else if( evt->IsClick( BUT_LEFT ) && !table ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); table = new SCH_TABLE( 0 ); table->SetColCount( 1 ); @@ -2954,7 +2954,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) EE_GRID_HELPER grid( m_toolMgr ); VECTOR2I cursorPos; - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -2967,7 +2967,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); delete sheet; sheet = nullptr; @@ -3064,7 +3064,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) } } - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), cursorPos ); sheet->SetScreen( nullptr ); @@ -3361,12 +3361,12 @@ int SCH_DRAWING_TOOLS::AutoPlaceAllSheetPins( const TOOL_EVENT& aEvent ) m_statusPopup->Move( KIPLATFORM::UI::GetMousePosition() + wxPoint( 20, 20 ) ); m_statusPopup->PopupFor( 2000 ); m_frame->PopTool( aEvent ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); return 0; } - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); SCH_COMMIT commit( m_toolMgr ); BOX2I boundingBox = sheet->GetBoundingBox(); diff --git a/eeschema/tools/sch_edit_table_tool.cpp b/eeschema/tools/sch_edit_table_tool.cpp index 1eec90b42e..1af15c0900 100644 --- a/eeschema/tools/sch_edit_table_tool.cpp +++ b/eeschema/tools/sch_edit_table_tool.cpp @@ -75,7 +75,7 @@ int SCH_EDIT_TABLE_TOOL::EditTable( const TOOL_EVENT& aEvent ) } if( clearSelection ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } diff --git a/eeschema/tools/sch_edit_table_tool.h b/eeschema/tools/sch_edit_table_tool.h index 81244c7759..2f2425f9e4 100644 --- a/eeschema/tools/sch_edit_table_tool.h +++ b/eeschema/tools/sch_edit_table_tool.h @@ -65,7 +65,7 @@ private: BASE_SCREEN* getScreen() override { return m_frame->GetScreen(); } const SELECTION& getTableCellSelection() override; - void clearSelection() override { m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); }; + void clearSelection() override { m_toolMgr->RunAction( ACTIONS::selectionClear ); }; SCH_TABLECELL* copyCell( SCH_TABLECELL* aSource ) override; }; diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 6660022086..0a05879570 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -1041,7 +1041,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) SCH_SELECTION selectionCopy = selection; if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); SCH_LINE_WIRE_BUS_TOOL* lwbTool = m_toolMgr->GetTool(); lwbTool->TrimOverLappingWires( commit, &selectionCopy ); @@ -1236,7 +1236,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) SCH_SELECTION selectionCopy = selection; if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( connections ) { @@ -1475,7 +1475,7 @@ int SCH_EDIT_TOOL::Swap( const TOOL_EVENT& aEvent ) else { if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( connections ) m_frame->TestDanglingEnds(); @@ -1494,7 +1494,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) if( sourceItems.empty() ) return 0; - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); SCH_COMMIT commit( m_toolMgr ); SCH_SELECTION newItems; @@ -1554,7 +1554,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) } } - m_toolMgr->RunAction( SCH_ACTIONS::addItemToSel, newItem ); + m_toolMgr->RunAction( ACTIONS::selectItem, newItem ); newItem->SetFlags( IS_NEW ); m_frame->AddToScreen( newItem, m_frame->GetScreen() ); commit.Added( newItem, m_frame->GetScreen() ); @@ -1576,7 +1576,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) } // Annotation clears the selection so re-add the item - m_toolMgr->RunAction( SCH_ACTIONS::addItemToSel, newItem ); + m_toolMgr->RunAction( ACTIONS::selectItem, newItem ); restore_state = !m_toolMgr->RunSynchronousAction( SCH_ACTIONS::move, &commit ); } @@ -1647,7 +1647,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent ) return 0; // Don't leave a freed pointer in the selection - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); for( EDA_ITEM* item : items ) item->ClearFlags( STRUCT_DELETED ); @@ -1733,7 +1733,7 @@ int SCH_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent ) { PICKER_TOOL* picker = m_toolMgr->GetTool(); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_pickerItem = nullptr; // Deactivate other tools; particularly important if another PICKER is currently running @@ -1788,7 +1788,7 @@ int SCH_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent ) m_toolMgr->GetTool()->UnbrightenItem( m_pickerItem ); // Wake the selection tool after exiting to ensure the cursor gets updated - m_toolMgr->PostAction( SCH_ACTIONS::selectionActivate ); + m_toolMgr->PostAction( ACTIONS::selectionActivate ); } ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent ); @@ -1920,7 +1920,7 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent ) } if( clearSelection ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -1968,7 +1968,7 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent ) commit.Push( _( "Autoplace Fields" ) ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); } return 0; @@ -1997,7 +1997,7 @@ int SCH_EDIT_TOOL::ChangeSymbols( const TOOL_EVENT& aEvent ) dlg.ShowQuasiModal(); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -2038,7 +2038,7 @@ int SCH_EDIT_TOOL::ChangeBodyStyle( const TOOL_EVENT& aEvent ) commit.Push( _( "Change Body Style" ) ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -2409,7 +2409,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) updateItem( curr_item, true ); if( clearSelection ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -2755,7 +2755,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent ) } if( selected ) - m_toolMgr->RunAction( SCH_ACTIONS::removeItemFromSel, item ); + m_toolMgr->RunAction( ACTIONS::unselectItem, item ); if( !item->IsNew() ) { @@ -2767,7 +2767,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent ) } if( selected ) - m_toolMgr->RunAction( SCH_ACTIONS::addItemToSel, newtext ); + m_toolMgr->RunAction( ACTIONS::selectItem, newtext ); // Otherwise, pointer is owned by the undo stack if( item->IsNew() ) @@ -2779,7 +2779,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent ) commit.Push( _( "Change To" ) ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -2864,7 +2864,7 @@ int SCH_EDIT_TOOL::JustifyText( const TOOL_EVENT& aEvent ) SCH_SELECTION selectionCopy = selection; if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( !localCommit.Empty() ) { @@ -2942,7 +2942,7 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent ) } if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -2969,7 +2969,7 @@ int SCH_EDIT_TOOL::CleanupSheetPins( const TOOL_EVENT& aEvent ) commit.Push( _( "Cleanup Sheet Pins" ) ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -3043,7 +3043,7 @@ int SCH_EDIT_TOOL::EditPageNumber( const TOOL_EVENT& aEvent ) commit.Push( wxS( "Change Sheet Page Number" ) ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -3128,7 +3128,7 @@ int SCH_EDIT_TOOL::Increment( const TOOL_EVENT& aEvent ) commit->Push( _( "Increment" ) ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -3218,7 +3218,7 @@ int SCH_EDIT_TOOL::SetAttribute( const TOOL_EVENT& aEvent ) commit.Push( _( "Toggle Attribute" ) ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 234b48bba2..456ff70354 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -699,7 +699,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent ) // ( avoid crash in some cases when the SimProbe tool is deselected ) SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); selectionTool->ClearSelection(); - m_toolMgr->PostAction( SCH_ACTIONS::selectionActivate ); + m_toolMgr->PostAction( ACTIONS::selectionActivate ); } ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent ); @@ -792,7 +792,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent ) // ( avoid crash in some cases when the SimTune tool is deselected ) SCH_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); selectionTool->ClearSelection(); - m_toolMgr->PostAction( SCH_ACTIONS::selectionActivate ); + m_toolMgr->PostAction( ACTIONS::selectionActivate ); } ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent ); @@ -1369,7 +1369,7 @@ bool SCH_EDITOR_CONTROL::doCopy( bool aUseDuplicateClipboard ) KICAD_FORMAT::Prettify( prettyData, true ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( aUseDuplicateClipboard ) { @@ -1447,7 +1447,7 @@ int SCH_EDITOR_CONTROL::CopyAsText( const TOOL_EVENT& aEvent ) wxString itemsAsText = GetSelectedItemsAsText( selection ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return SaveClipboard( itemsAsText.ToStdString() ); } @@ -2171,8 +2171,8 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent ) allScreens.PruneOrphanedSheetInstances( m_frame->Prj().GetProjectName(), sheets ); // Now clear the previous selection, select the pasted items, and fire up the "move" tool. - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); - m_toolMgr->RunAction( SCH_ACTIONS::addItemsToSel, &loadedItems ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectItems, &loadedItems ); SCH_SELECTION& selection = selTool->GetSelection(); @@ -2307,7 +2307,7 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent ) symbol = (SCH_SYMBOL*) selection.Front(); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( !symbol ) { diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index 0c2bfbc8e7..82f8c753ca 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -292,7 +292,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent ) const DRAW_SEGMENT_EVENT_PARAMS* params = aEvent.Parameter(); m_frame->PushTool( aEvent ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( aEvent.HasPosition() ) { @@ -411,7 +411,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aN // it might not be, but it won't be a broken connection (and the user asked for it!) pos = bus->GetSeg().NearestPoint( pos ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos ); m_busUnfold.entry->SetParent( screen ); @@ -626,7 +626,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType, auto cleanup = [&] () { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); for( SCH_LINE* wire : m_wires ) delete wire; @@ -1169,7 +1169,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments() // 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 // freed selected items. - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); SCH_SCREEN* screen = m_frame->GetScreen(); SCH_COMMIT commit( m_toolMgr ); diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 9cb727996e..5bd8fc9ecb 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -1014,7 +1014,7 @@ bool SCH_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COMMIT* aComm item->ClearEditFlags(); if( unselect ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); else m_selectionTool->RebuildSelection(); // Schematic cleanup might have merged lines, etc. diff --git a/eeschema/tools/sch_navigate_tool.cpp b/eeschema/tools/sch_navigate_tool.cpp index e50c3cef49..687d380e81 100644 --- a/eeschema/tools/sch_navigate_tool.cpp +++ b/eeschema/tools/sch_navigate_tool.cpp @@ -125,7 +125,7 @@ int SCH_NAVIGATE_TOOL::Forward( const TOOL_EVENT& aEvent ) m_navIndex++; m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive ); - m_frame->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_frame->SetCurrentSheet( *m_navIndex ); m_frame->DisplayCurrentSheet(); @@ -146,7 +146,7 @@ int SCH_NAVIGATE_TOOL::Back( const TOOL_EVENT& aEvent ) m_navIndex--; m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive ); - m_frame->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_frame->SetCurrentSheet( *m_navIndex ); m_frame->DisplayCurrentSheet(); @@ -299,7 +299,7 @@ void SCH_NAVIGATE_TOOL::pushToHistory( SCH_SHEET_PATH aPath ) void SCH_NAVIGATE_TOOL::changeSheet( SCH_SHEET_PATH aPath ) { m_frame->GetToolManager()->RunAction( ACTIONS::cancelInteractive ); - m_frame->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); // Store the current zoom level into the current screen before switching m_frame->GetScreen()->m_LastZoomLevel = m_frame->GetCanvas()->GetView()->GetScale(); diff --git a/eeschema/tools/sch_selection_tool.cpp b/eeschema/tools/sch_selection_tool.cpp index 7e7fe28982..d96c6ce8c9 100644 --- a/eeschema/tools/sch_selection_tool.cpp +++ b/eeschema/tools/sch_selection_tool.cpp @@ -152,7 +152,7 @@ SELECTION_CONDITION SCH_CONDITIONS::AllPinsOrSheetPins = []( const SELECTION& aS SCH_SELECTION_TOOL::SCH_SELECTION_TOOL() : - SELECTION_TOOL( "eeschema.InteractiveSelection" ), + SELECTION_TOOL( "common.InteractiveSelection" ), m_frame( nullptr ), m_nonModifiedCursor( KICURSOR::ARROW ), m_isSymbolEditor( false ), @@ -1301,7 +1301,7 @@ bool SCH_SELECTION_TOOL::selectPoint( SCH_COLLECTOR& aCollector, const VECTOR2I& // 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 // handle it directly. - if( !m_toolMgr->RunAction( SCH_ACTIONS::selectionMenu, &aCollector ) ) + if( !m_toolMgr->RunAction( ACTIONS::selectionMenu, &aCollector ) ) { if( !doSelectionMenu( &aCollector ) ) aCollector.m_MenuCancelled = true; @@ -2918,23 +2918,23 @@ void SCH_SELECTION_TOOL::setTransitions() { Go( &SCH_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::Main, SCH_ACTIONS::selectionActivate.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::Main, ACTIONS::selectionActivate.MakeEvent() ); Go( &SCH_SELECTION_TOOL::SelectNode, SCH_ACTIONS::selectNode.MakeEvent() ); Go( &SCH_SELECTION_TOOL::SelectConnection, SCH_ACTIONS::selectConnection.MakeEvent() ); Go( &SCH_SELECTION_TOOL::SelectColumns, ACTIONS::selectColumns.MakeEvent() ); Go( &SCH_SELECTION_TOOL::SelectRows, ACTIONS::selectRows.MakeEvent() ); Go( &SCH_SELECTION_TOOL::SelectTable, ACTIONS::selectTable.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::ClearSelection, SCH_ACTIONS::clearSelection.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::ClearSelection, ACTIONS::selectionClear.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::AddItemToSel, SCH_ACTIONS::addItemToSel.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::AddItemsToSel, SCH_ACTIONS::addItemsToSel.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::RemoveItemFromSel, SCH_ACTIONS::removeItemFromSel.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::RemoveItemsFromSel, SCH_ACTIONS::removeItemsFromSel.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::SelectionMenu, SCH_ACTIONS::selectionMenu.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::AddItemToSel, ACTIONS::selectItem.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::AddItemsToSel, ACTIONS::selectItems.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::RemoveItemFromSel, ACTIONS::unselectItem.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::RemoveItemsFromSel, ACTIONS::unselectItems.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::SelectionMenu, ACTIONS::selectionMenu.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::SelectAll, SCH_ACTIONS::selectAll.MakeEvent() ); - Go( &SCH_SELECTION_TOOL::UnselectAll, SCH_ACTIONS::unselectAll.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::SelectAll, ACTIONS::selectAll.MakeEvent() ); + Go( &SCH_SELECTION_TOOL::UnselectAll, ACTIONS::unselectAll.MakeEvent() ); Go( &SCH_SELECTION_TOOL::SelectNext, SCH_ACTIONS::nextNetItem.MakeEvent() ); Go( &SCH_SELECTION_TOOL::SelectPrevious, SCH_ACTIONS::previousNetItem.MakeEvent() ); diff --git a/eeschema/tools/symbol_editor_control.cpp b/eeschema/tools/symbol_editor_control.cpp index 480ba14e06..0f81f65b03 100644 --- a/eeschema/tools/symbol_editor_control.cpp +++ b/eeschema/tools/symbol_editor_control.cpp @@ -573,7 +573,7 @@ int SYMBOL_EDITOR_CONTROL::OnDeMorgan( const TOOL_EVENT& aEvent ) if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { m_toolMgr->RunAction( ACTIONS::cancelInteractive ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); SYMBOL_EDIT_FRAME* symbolEditor = static_cast( m_frame ); symbolEditor->SetBodyStyle( bodyStyle ); diff --git a/eeschema/tools/symbol_editor_drawing_tools.cpp b/eeschema/tools/symbol_editor_drawing_tools.cpp index c8aeb89b1a..6e0bc29e33 100644 --- a/eeschema/tools/symbol_editor_drawing_tools.cpp +++ b/eeschema/tools/symbol_editor_drawing_tools.cpp @@ -101,7 +101,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) bool isText = aEvent.IsAction( &SCH_ACTIONS::placeSymbolText ); COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings(); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -119,7 +119,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); delete item; item = nullptr; @@ -211,7 +211,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) // First click creates... if( !item ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); switch( type ) { @@ -385,7 +385,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt // gets whacked. m_toolMgr->DeactivateTool(); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -398,7 +398,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt auto cleanup = [&] () { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); delete item; item = nullptr; @@ -467,7 +467,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt if( !symbol ) continue; - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); int lineWidth = schIUScale.MilsToIU( cfg->m_Defaults.line_width ); @@ -732,10 +732,10 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent ) m_view->Add( &preview ); // Clear the current selection then select the drawings so that edit tools work on them - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() ); - m_toolMgr->RunAction( SCH_ACTIONS::addItemsToSel, &selItems ); + m_toolMgr->RunAction( ACTIONS::selectItems, &selItems ); m_frame->PushTool( aEvent ); @@ -779,7 +779,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::ImportGraphics( const TOOL_EVENT& aEvent ) if( evt->IsCancelInteractive() || evt->IsActivate() ) { - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); for( SCH_ITEM* item : newItems ) delete item; @@ -860,10 +860,10 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem( const TOOL_EVENT& aEvent ) if( pin ) g_lastPin = pin->m_Uuid; - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( pin ) - m_toolMgr->RunAction( SCH_ACTIONS::addItemToSel, pin ); + m_toolMgr->RunAction( ACTIONS::selectItem, pin ); } return 0; diff --git a/eeschema/tools/symbol_editor_edit_tool.cpp b/eeschema/tools/symbol_editor_edit_tool.cpp index 08b6795802..b0167546b8 100644 --- a/eeschema/tools/symbol_editor_edit_tool.cpp +++ b/eeschema/tools/symbol_editor_edit_tool.cpp @@ -204,7 +204,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) else { if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( !localCommit.Empty() ) localCommit.Push( _( "Rotate" ) ); @@ -282,7 +282,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) else { if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->OnModify(); } @@ -364,7 +364,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Swap( const TOOL_EVENT& aEvent ) else { if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->OnModify(); } @@ -393,7 +393,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent ) return 0; // Don't leave a freed pointer in the selection - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); commit.Modify( symbol, m_frame->GetScreen() ); @@ -490,7 +490,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent ) { PICKER_TOOL* picker = m_toolMgr->GetTool(); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_pickerItem = nullptr; // Deactivate other tools; particularly important if another PICKER is currently running @@ -552,7 +552,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent ) m_toolMgr->GetTool()->UnbrightenItem( m_pickerItem ); // Wake the selection tool after exiting to ensure the cursor gets updated - m_toolMgr->PostAction( SCH_ACTIONS::selectionActivate ); + m_toolMgr->PostAction( ACTIONS::selectionActivate ); } ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent ); @@ -622,7 +622,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) } if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } @@ -721,7 +721,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties() bool partLocked = symbol->UnitsLocked(); m_toolMgr->RunAction( ACTIONS::cancelInteractive ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); DIALOG_LIB_SYMBOL_PROPERTIES dlg( m_frame, symbol ); @@ -772,7 +772,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent ) commit.Modify( symbol ); - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); DIALOG_LIB_EDIT_PIN_TABLE dlg( m_frame, symbol ); @@ -943,7 +943,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::CopyAsText( const TOOL_EVENT& aEvent ) wxString itemsAsText = GetSelectedItemsAsText( selection ); if( selection.IsHover() ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return SaveClipboard( itemsAsText.ToStdString() ); } @@ -1094,8 +1094,8 @@ int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) getView()->Add( newItem ); } - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); - m_toolMgr->RunAction( SCH_ACTIONS::addItemsToSel, &newItems ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectItems, &newItems ); selection.SetReferencePoint( getViewControls()->GetCursorPosition( true ) ); diff --git a/eeschema/tools/symbol_editor_move_tool.cpp b/eeschema/tools/symbol_editor_move_tool.cpp index aaabf3f65c..1f81f7da22 100644 --- a/eeschema/tools/symbol_editor_move_tool.cpp +++ b/eeschema/tools/symbol_editor_move_tool.cpp @@ -368,7 +368,7 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM item->ClearEditFlags(); if( unselect ) - m_toolMgr->RunAction( SCH_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_moveInProgress = false; m_frame->PopTool( aEvent ); diff --git a/eeschema/widgets/search_handlers.cpp b/eeschema/widgets/search_handlers.cpp index e2c59cff73..096ea15eb7 100644 --- a/eeschema/widgets/search_handlers.cpp +++ b/eeschema/widgets/search_handlers.cpp @@ -104,7 +104,7 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) EDA_ITEMS selectedItems; std::vector selectedHits; - m_frame->GetToolManager()->RunAction( SCH_ACTIONS::clearSelection ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); for( long row : aItemRows ) { @@ -134,7 +134,7 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) m_frame->GetToolManager()->RunAction( SCH_ACTIONS::changeSheet, sheet ); if( selectedItems.size() ) - m_frame->GetToolManager()->RunAction( SCH_ACTIONS::addItemsToSel, &selectedItems ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectItems, &selectedItems ); switch( settings.selection_zoom ) { diff --git a/gerbview/dialogs/dialog_print_gerbview.cpp b/gerbview/dialogs/dialog_print_gerbview.cpp index e9659f5903..2c95b950c7 100644 --- a/gerbview/dialogs/dialog_print_gerbview.cpp +++ b/gerbview/dialogs/dialog_print_gerbview.cpp @@ -307,7 +307,7 @@ void DIALOG_PRINT_GERBVIEW::saveSettings() int GERBVIEW_CONTROL::Print( const TOOL_EVENT& aEvent ) { // Selection affects the original item visibility - m_toolMgr->RunAction( GERBVIEW_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); BOARD_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() ); settings.m_colorSettings = m_frame->GetColorSettings(); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 145c52b31c..c3d39c57ca 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -1110,7 +1110,7 @@ void GERBVIEW_FRAME::setupTools() m_toolManager->InitTools(); // Run the selection tool, it is supposed to be always active - m_toolManager->InvokeTool( "gerbview.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); } diff --git a/gerbview/tools/gerbview_actions.cpp b/gerbview/tools/gerbview_actions.cpp index 217d2ae51c..7893edc5a6 100644 --- a/gerbview/tools/gerbview_actions.cpp +++ b/gerbview/tools/gerbview_actions.cpp @@ -253,26 +253,6 @@ TOOL_ACTION GERBVIEW_ACTIONS::flipGerberView( TOOL_ACTION_ARGS() .Icon( BITMAPS::flip_board ) ); -// GERBVIEW_SELECTION_TOOL -// -TOOL_ACTION GERBVIEW_ACTIONS::selectionActivate( TOOL_ACTION_ARGS() - .Name( "gerbview.InteractiveSelection" ) - .Scope( AS_GLOBAL ) - .Flags( AF_ACTIVATE ) ); - -TOOL_ACTION GERBVIEW_ACTIONS::selectItem( TOOL_ACTION_ARGS() - .Name( "gerbview.InteractiveSelection.SelectItem" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION GERBVIEW_ACTIONS::unselectItem( TOOL_ACTION_ARGS() - .Name( "gerbview.InteractiveSelection.UnselectItem" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION GERBVIEW_ACTIONS::selectionClear( TOOL_ACTION_ARGS() - .Name( "gerbview.InteractiveSelection.Clear" ) - .Scope( AS_GLOBAL ) ); - - // Drag and drop // TOOL_ACTION GERBVIEW_ACTIONS::loadZipFile( TOOL_ACTION_ARGS() diff --git a/gerbview/tools/gerbview_actions.h b/gerbview/tools/gerbview_actions.h index 57b3e12cfb..4cb3bb415e 100644 --- a/gerbview/tools/gerbview_actions.h +++ b/gerbview/tools/gerbview_actions.h @@ -34,22 +34,6 @@ class TOOL_MANAGER; class GERBVIEW_ACTIONS : public ACTIONS { public: - // Selection Tool - /// Activation of the selection tool - static TOOL_ACTION selectionActivate; - - /// Select a single item under the cursor position - static TOOL_ACTION selectionCursor; - - /// Clear the current selection - static TOOL_ACTION selectionClear; - - /// Selects an item (specified as the event parameter). - static TOOL_ACTION selectItem; - - /// Unselects an item (specified as the event parameter). - static TOOL_ACTION unselectItem; - /// Activation of the edit tool static TOOL_ACTION properties; static TOOL_ACTION showDCodes; diff --git a/gerbview/tools/gerbview_selection_tool.cpp b/gerbview/tools/gerbview_selection_tool.cpp index a426f22921..30ac8adf07 100644 --- a/gerbview/tools/gerbview_selection_tool.cpp +++ b/gerbview/tools/gerbview_selection_tool.cpp @@ -111,7 +111,7 @@ private: GERBVIEW_SELECTION_TOOL::GERBVIEW_SELECTION_TOOL() : - SELECTION_TOOL( "gerbview.InteractiveSelection" ), + SELECTION_TOOL( "common.InteractiveSelection" ), m_frame( nullptr ) { } @@ -269,10 +269,10 @@ bool GERBVIEW_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere ) void GERBVIEW_SELECTION_TOOL::setTransitions() { Go( &GERBVIEW_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() ); - Go( &GERBVIEW_SELECTION_TOOL::Main, GERBVIEW_ACTIONS::selectionActivate.MakeEvent() ); - Go( &GERBVIEW_SELECTION_TOOL::ClearSelection, GERBVIEW_ACTIONS::selectionClear.MakeEvent() ); - Go( &GERBVIEW_SELECTION_TOOL::SelectItem, GERBVIEW_ACTIONS::selectItem.MakeEvent() ); - Go( &GERBVIEW_SELECTION_TOOL::UnselectItem, GERBVIEW_ACTIONS::unselectItem.MakeEvent() ); + Go( &GERBVIEW_SELECTION_TOOL::Main, ACTIONS::selectionActivate.MakeEvent() ); + Go( &GERBVIEW_SELECTION_TOOL::ClearSelection, ACTIONS::selectionClear.MakeEvent() ); + Go( &GERBVIEW_SELECTION_TOOL::SelectItem, ACTIONS::selectItem.MakeEvent() ); + Go( &GERBVIEW_SELECTION_TOOL::UnselectItem, ACTIONS::unselectItem.MakeEvent() ); } diff --git a/include/tool/actions.h b/include/tool/actions.h index 302da4c92a..d2cb466fbd 100644 --- a/include/tool/actions.h +++ b/include/tool/actions.h @@ -31,6 +31,13 @@ #define LEGACY_HK_NAME( x ) x +class PCB_SELECTION_TOOL; +class GENERAL_COLLECTOR; + +using CLIENT_SELECTION_FILTER = + std::function; + + /** * Gather all the actions that are shared by tools. * @@ -202,6 +209,28 @@ public: static TOOL_ACTION togglePolarCoords; static TOOL_ACTION resetLocalCoords; + // Selection + /// Activation of the selection tool + static TOOL_ACTION selectionActivate; + + /// Select a single item under the cursor position + static TOOL_ACTION selectionCursor; + + /// Clear the current selection + static TOOL_ACTION selectionClear; + + /// Select an item (specified as the event parameter). + static TOOL_ACTION selectItem; + static TOOL_ACTION unselectItem; + static TOOL_ACTION reselectItem; + + /// Select a list of items (specified as the event parameter) + static TOOL_ACTION selectItems; + static TOOL_ACTION unselectItems; + + /// Run a selection menu to select from a list of items + static TOOL_ACTION selectionMenu; + // Grouping static TOOL_ACTION group; static TOOL_ACTION ungroup; diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index c1241cd0a3..1e8cec3aea 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -281,7 +281,7 @@ void PL_EDITOR_FRAME::setupTools() m_toolManager->InitTools(); // Run the selection tool, it is supposed to be always active - m_toolManager->InvokeTool( "plEditor.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); } diff --git a/pagelayout_editor/tools/pl_actions.cpp b/pagelayout_editor/tools/pl_actions.cpp index b5dd61aed7..65d65a3081 100644 --- a/pagelayout_editor/tools/pl_actions.cpp +++ b/pagelayout_editor/tools/pl_actions.cpp @@ -127,37 +127,3 @@ TOOL_ACTION PL_ACTIONS::layoutEditMode( TOOL_ACTION_ARGS() .Tooltip( _( "Text placeholders are shown as ${keyword} tokens" ) ) .ToolbarState( TOOLBAR_STATE::TOGGLE ) .Icon( BITMAPS::pagelayout_special_view_mode ) ); - - -// PL_SELECTION_TOOL -// -TOOL_ACTION PL_ACTIONS::selectionActivate( TOOL_ACTION_ARGS() - .Name( "plEditor.InteractiveSelection" ) - .Scope( AS_GLOBAL ) - .Flags( AF_ACTIVATE ) ); - -TOOL_ACTION PL_ACTIONS::selectionMenu( TOOL_ACTION_ARGS() - .Name( "plEditor.InteractiveSelection.SelectionMenu" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PL_ACTIONS::addItemToSel( TOOL_ACTION_ARGS() - .Name( "plEditor.InteractiveSelection.AddItemToSel" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PL_ACTIONS::addItemsToSel( TOOL_ACTION_ARGS() - .Name( "plEditor.InteractiveSelection.AddItemsToSel" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PL_ACTIONS::removeItemFromSel( TOOL_ACTION_ARGS() - .Name( "plEditor.InteractiveSelection.RemoveItemFromSel" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PL_ACTIONS::removeItemsFromSel( TOOL_ACTION_ARGS() - .Name( "plEditor.InteractiveSelection.RemoveItemsFromSel" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PL_ACTIONS::clearSelection( TOOL_ACTION_ARGS() - .Name( "plEditor.InteractiveSelection.ClearSelection" ) - .Scope( AS_GLOBAL ) ); - - diff --git a/pagelayout_editor/tools/pl_actions.h b/pagelayout_editor/tools/pl_actions.h index 5b03aba616..ee0b2847ea 100644 --- a/pagelayout_editor/tools/pl_actions.h +++ b/pagelayout_editor/tools/pl_actions.h @@ -35,24 +35,6 @@ class PL_ACTIONS : public ACTIONS { public: - // Selection Tool - /// Activation of the selection tool - static TOOL_ACTION selectionActivate; - - /// Clear the current selection - static TOOL_ACTION clearSelection; - - /// Select an item (specified as the event parameter). - static TOOL_ACTION addItemToSel; - static TOOL_ACTION removeItemFromSel; - - /// Select a list of items (specified as the event parameter) - static TOOL_ACTION addItemsToSel; - static TOOL_ACTION removeItemsFromSel; - - /// Run a selection menu to select from a list of items - static TOOL_ACTION selectionMenu; - // Tools static TOOL_ACTION pickerTool; static TOOL_ACTION placeText; diff --git a/pagelayout_editor/tools/pl_drawing_tools.cpp b/pagelayout_editor/tools/pl_drawing_tools.cpp index 7aa14caf6a..059ef237d5 100644 --- a/pagelayout_editor/tools/pl_drawing_tools.cpp +++ b/pagelayout_editor/tools/pl_drawing_tools.cpp @@ -76,7 +76,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent ) DS_DRAW_ITEM_BASE* item = nullptr; bool isText = aEvent.IsAction( &PL_ACTIONS::placeText ); - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -102,7 +102,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); item = nullptr; // There's nothing to roll-back, but we still need to pop the undo stack @@ -165,7 +165,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent ) { m_frame->SaveCopyInUndoList(); - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); item = dataItem->GetDrawItems()[0]; item->SetFlags( IS_NEW | IS_MOVING ); @@ -192,7 +192,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent ) // Now we re-select and inform other tools, so that the Properties panel // is updated. - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_selectionTool->AddItemToSel( item, false ); item = nullptr; @@ -240,7 +240,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) // gets whacked. m_toolMgr->DeactivateTool(); - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -268,7 +268,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) if( evt->IsCancelInteractive() || ( item && evt->IsAction( &ACTIONS::undo ) ) ) { - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( item ) { @@ -303,7 +303,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) if( !item ) // start drawing { m_frame->SaveCopyInUndoList(); - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); DS_DATA_ITEM* dataItem = m_frame->AddDrawingSheetItem( type ); dataItem->MoveToIU( cursorPos ); @@ -319,7 +319,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) { // Now we re-select and inform other tools, so that the Properties panel // is updated. - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_selectionTool->AddItemToSel( item, false ); item->ClearEditFlags(); diff --git a/pagelayout_editor/tools/pl_edit_tool.cpp b/pagelayout_editor/tools/pl_edit_tool.cpp index fbdc0544cf..9e5d08b2ec 100644 --- a/pagelayout_editor/tools/pl_edit_tool.cpp +++ b/pagelayout_editor/tools/pl_edit_tool.cpp @@ -314,7 +314,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent ) m_frame->OnModify(); if( unselect ) - m_toolMgr->RunAction( PL_ACTIONS::clearSelection ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); else m_toolMgr->PostEvent( EVENTS::SelectedEvent ); @@ -477,7 +477,7 @@ int PL_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent ) m_toolMgr->GetTool()->UnbrightenItem( m_pickerItem ); // Wake the selection tool after exiting to ensure the cursor gets updated - m_toolMgr->PostAction( PL_ACTIONS::selectionActivate ); + m_toolMgr->PostAction( ACTIONS::selectionActivate ); } ); m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent ); diff --git a/pagelayout_editor/tools/pl_selection_tool.cpp b/pagelayout_editor/tools/pl_selection_tool.cpp index 3316f5ae7a..f582256c8d 100644 --- a/pagelayout_editor/tools/pl_selection_tool.cpp +++ b/pagelayout_editor/tools/pl_selection_tool.cpp @@ -45,7 +45,7 @@ PL_SELECTION_TOOL::PL_SELECTION_TOOL() : - SELECTION_TOOL( "plEditor.InteractiveSelection" ), + SELECTION_TOOL( "common.InteractiveSelection" ), m_frame( nullptr ) { } @@ -549,14 +549,14 @@ void PL_SELECTION_TOOL::setTransitions() { Go( &PL_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() ); - Go( &PL_SELECTION_TOOL::Main, PL_ACTIONS::selectionActivate.MakeEvent() ); - Go( &PL_SELECTION_TOOL::ClearSelection, PL_ACTIONS::clearSelection.MakeEvent() ); + Go( &PL_SELECTION_TOOL::Main, ACTIONS::selectionActivate.MakeEvent() ); + Go( &PL_SELECTION_TOOL::ClearSelection, ACTIONS::selectionClear.MakeEvent() ); - Go( &PL_SELECTION_TOOL::AddItemToSel, PL_ACTIONS::addItemToSel.MakeEvent() ); - Go( &PL_SELECTION_TOOL::AddItemsToSel, PL_ACTIONS::addItemsToSel.MakeEvent() ); - Go( &PL_SELECTION_TOOL::RemoveItemFromSel, PL_ACTIONS::removeItemFromSel.MakeEvent() ); - Go( &PL_SELECTION_TOOL::RemoveItemsFromSel, PL_ACTIONS::removeItemsFromSel.MakeEvent() ); - Go( &PL_SELECTION_TOOL::SelectionMenu, PL_ACTIONS::selectionMenu.MakeEvent() ); + Go( &PL_SELECTION_TOOL::AddItemToSel, ACTIONS::selectItem.MakeEvent() ); + Go( &PL_SELECTION_TOOL::AddItemsToSel, ACTIONS::selectItems.MakeEvent() ); + Go( &PL_SELECTION_TOOL::RemoveItemFromSel, ACTIONS::unselectItem.MakeEvent() ); + Go( &PL_SELECTION_TOOL::RemoveItemsFromSel, ACTIONS::unselectItems.MakeEvent() ); + Go( &PL_SELECTION_TOOL::SelectionMenu, ACTIONS::selectionMenu.MakeEvent() ); Go( &PL_SELECTION_TOOL::disambiguateCursor, EVENTS::DisambiguatePoint ); } diff --git a/pcbnew/api/api_handler_pcb.cpp b/pcbnew/api/api_handler_pcb.cpp index 319e2cc7b1..e469596ab1 100644 --- a/pcbnew/api/api_handler_pcb.cpp +++ b/pcbnew/api/api_handler_pcb.cpp @@ -733,7 +733,7 @@ HANDLER_RESULT API_HANDLER_PCB::handleClearSelection( } TOOL_MANAGER* mgr = frame()->GetToolManager(); - mgr->RunAction( PCB_ACTIONS::selectionClear ); + mgr->RunAction( ACTIONS::selectionClear ); frame()->Refresh(); return Empty(); @@ -1138,8 +1138,8 @@ HANDLER_RESULT API_HANDLER_PCB::handleInteractiveMoveItems( PCB_SELECTION_TOOL* selectionTool = mgr->GetTool(); selectionTool->GetSelection().SetReferencePoint( toSelect[0]->GetPosition() ); - mgr->RunAction( PCB_ACTIONS::selectionClear ); - mgr->RunAction( PCB_ACTIONS::selectItems, &toSelect ); + mgr->RunAction( ACTIONS::selectionClear ); + mgr->RunAction( ACTIONS::selectItems, &toSelect ); COMMIT* commit = getCurrentCommit( aCtx.ClientName ); mgr->PostAPIAction( PCB_ACTIONS::move, commit ); diff --git a/pcbnew/dialogs/dialog_cleanup_graphics.cpp b/pcbnew/dialogs/dialog_cleanup_graphics.cpp index 8306975b59..bf8765a3c6 100644 --- a/pcbnew/dialogs/dialog_cleanup_graphics.cpp +++ b/pcbnew/dialogs/dialog_cleanup_graphics.cpp @@ -108,7 +108,7 @@ void DIALOG_CLEANUP_GRAPHICS::doCleanup( bool aDryRun ) if( !aDryRun ) { // Clear current selection list to avoid selection of deleted items - m_parentFrame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_parentFrame->GetToolManager()->RunAction( ACTIONS::selectionClear ); // ... and to keep the treeModel from trying to refresh a deleted item m_changesTreeModel->Update( nullptr, RPT_SEVERITY_ACTION ); diff --git a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp index 68ed797a13..06095900bb 100644 --- a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp @@ -252,7 +252,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun ) if( !aDryRun ) { // Clear current selection list to avoid selection of deleted items - m_parentFrame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_parentFrame->GetToolManager()->RunAction( ACTIONS::selectionClear ); // ... and to keep the treeModel from trying to refresh a deleted item m_changesTreeModel->Update( nullptr, RPT_SEVERITY_ACTION ); diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 9f104478ff..53b460c42f 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -1209,7 +1209,7 @@ void DIALOG_DRC::deleteAllMarkers( bool aIncludeExclusions ) { // Clear current selection list to avoid selection of deleted items Freeze(); - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_markersTreeModel->DeleteItems( false, aIncludeExclusions, false ); m_unconnectedTreeModel->DeleteItems( false, aIncludeExclusions, false ); @@ -1225,7 +1225,7 @@ void DIALOG_DRC::OnDeleteOneClick( wxCommandEvent& aEvent ) if( m_Notebook->GetSelection() == 0 ) { // Clear the selection. It may be the selected DRC marker. - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_markersTreeModel->DeleteCurrentItem( true ); diff --git a/pcbnew/dialogs/dialog_find.cpp b/pcbnew/dialogs/dialog_find.cpp index 2915383e15..ff1aa094d7 100644 --- a/pcbnew/dialogs/dialog_find.cpp +++ b/pcbnew/dialogs/dialog_find.cpp @@ -266,7 +266,7 @@ void DIALOG_FIND::search( bool aDirection ) // Search parameters m_frame->GetFindReplaceData().findString = searchString; - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_frame->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); BOARD* board = m_frame->GetBoard(); @@ -420,7 +420,7 @@ void DIALOG_FIND::search( bool aDirection ) } else { - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, *m_it ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectItem, *m_it ); msg.Printf( _( "'%s' found" ), searchString ); m_frame->SetStatusText( msg ); diff --git a/pcbnew/dialogs/dialog_footprint_checker.cpp b/pcbnew/dialogs/dialog_footprint_checker.cpp index cca6e6fe00..5b2fb44d96 100644 --- a/pcbnew/dialogs/dialog_footprint_checker.cpp +++ b/pcbnew/dialogs/dialog_footprint_checker.cpp @@ -392,7 +392,7 @@ void DIALOG_FOOTPRINT_CHECKER::refreshEditor() void DIALOG_FOOTPRINT_CHECKER::OnDeleteOneClick( wxCommandEvent& aEvent ) { // Clear the selection. It may be the selected DRC marker. - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_markersTreeModel->DeleteCurrentItem( true ); @@ -416,7 +416,7 @@ void DIALOG_FOOTPRINT_CHECKER::OnDeleteAllClick( wxCommandEvent& event ) void DIALOG_FOOTPRINT_CHECKER::deleteAllMarkers() { // Clear current selection list to avoid selection of deleted items - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); m_markersTreeModel->DeleteItems( false, true, false ); m_frame->GetBoard()->DeleteMARKERs( true, true ); diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp index 662d0eb80c..7a3bdf5eb0 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp @@ -609,7 +609,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow() m_footprint->SetKeywords( m_KeywordCtrl->GetValue() ); // Update fields - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); while( !m_footprint->GetFields().empty() ) { diff --git a/pcbnew/dialogs/dialog_generators.cpp b/pcbnew/dialogs/dialog_generators.cpp index e83db541fb..6dc0bda76e 100644 --- a/pcbnew/dialogs/dialog_generators.cpp +++ b/pcbnew/dialogs/dialog_generators.cpp @@ -419,8 +419,8 @@ void DIALOG_GENERATORS::OnItemSelected( wxDataViewEvent& aEvent ) edaItems.push_back( brdItem ); } - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, &edaItems ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectItems, &edaItems ); m_frame->FocusOnItems( boardItems ); } @@ -455,8 +455,8 @@ void DIALOG_GENERATORS::OnRebuildTypeClick( wxCommandEvent& event ) items.push_back( item ); } - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, &items ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectItems, &items ); m_frame->GetToolManager()->RunAction( PCB_ACTIONS::regenerateSelected ); RebuildModels(); } diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 3949a886d9..04d71373c1 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -118,7 +118,7 @@ void DIALOG_GLOBAL_DELETION::DoGlobalDeletions() bool delete_all = m_delAll->GetValue(); // Clear selection before removing any items - m_Parent->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_Parent->GetToolManager()->RunAction( ACTIONS::selectionClear ); BOARD* board = m_Parent->GetBoard(); BOARD_COMMIT commit( m_Parent ); diff --git a/pcbnew/dialogs/dialog_print_pcbnew.cpp b/pcbnew/dialogs/dialog_print_pcbnew.cpp index 25a034165d..7ae2134479 100644 --- a/pcbnew/dialogs/dialog_print_pcbnew.cpp +++ b/pcbnew/dialogs/dialog_print_pcbnew.cpp @@ -479,7 +479,7 @@ void DIALOG_PRINT_PCBNEW::saveSettings() int PCB_CONTROL::Print( const TOOL_EVENT& aEvent ) { // Selection affects the origin item visibility - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); PCBNEW_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() ); DIALOG_PRINT_PCBNEW dlg( (PCB_BASE_EDIT_FRAME*) m_frame, &settings ); diff --git a/pcbnew/dialogs/dialog_update_pcb.cpp b/pcbnew/dialogs/dialog_update_pcb.cpp index 0bad55fdf1..09eff560df 100644 --- a/pcbnew/dialogs/dialog_update_pcb.cpp +++ b/pcbnew/dialogs/dialog_update_pcb.cpp @@ -111,7 +111,7 @@ void DIALOG_UPDATE_PCB::PerformUpdate( bool aDryRun ) if( !aDryRun ) { m_frame->GetToolManager()->DeactivateTool(); - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); } BOARD_NETLIST_UPDATER updater( m_frame, m_frame->GetBoard() ); diff --git a/pcbnew/dialogs/panel_setup_layers.cpp b/pcbnew/dialogs/panel_setup_layers.cpp index 916afd5f9f..0a9c71ef1f 100644 --- a/pcbnew/dialogs/panel_setup_layers.cpp +++ b/pcbnew/dialogs/panel_setup_layers.cpp @@ -848,7 +848,7 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow() if( !removedLayers.empty() ) { - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); PCB_LAYER_COLLECTOR collector; diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index b8bcf3969b..c4c49ae67b 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -1212,7 +1212,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools() m_toolManager->GetTool()->SetFootprintFrame( true ); m_toolManager->InitTools(); - m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); // Load or reload wizard plugins in case they changed since the last time the frame opened // Because the board editor has also a plugin python menu, diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index ffca28b8d2..3f46e75911 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -908,7 +908,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) return false; } - m_toolManager->RunAction( PCB_ACTIONS::selectionClear ); + m_toolManager->RunAction( ACTIONS::selectionClear ); BOARD_COMMIT commit( pcbframe ); // Create a copy for the board, first using Clone() to keep existing Uuids, and then either diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index b687bf0807..5522c4b3ae 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -216,7 +216,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent m_toolManager->GetTool()->SetFootprintFrame( true ); m_toolManager->InitTools(); - m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); setupUIConditions(); @@ -749,7 +749,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB() if( blocking_dialog ) blocking_dialog->Close( true ); - toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + toolMgr->RunAction( ACTIONS::selectionClear ); BOARD_COMMIT commit( pcbframe ); // Create the "new" footprint diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 26cd5d0f4e..0b12edf6e4 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -149,7 +149,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent m_toolManager->InitTools(); // Run the control tool, it is supposed to be always active - m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); // Create the toolbars m_toolbarSettings = Pgm().GetSettingsManager().GetToolbarSettings( "fpwizard-toolbars" ); diff --git a/pcbnew/generators/pcb_tuning_pattern.cpp b/pcbnew/generators/pcb_tuning_pattern.cpp index 1ceb4216a5..462ab3b049 100644 --- a/pcbnew/generators/pcb_tuning_pattern.cpp +++ b/pcbnew/generators/pcb_tuning_pattern.cpp @@ -2246,7 +2246,7 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent ) REENTRANCY_GUARD guard( &m_inDrawingTool ); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); Activate(); diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index e7916496dc..00736b9f78 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -309,7 +309,7 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR else { // at this point, we can save the footprint - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, inductorFP.get() ); + m_toolMgr->RunAction( ACTIONS::selectItem, inductorFP.get() ); BOARD_COMMIT commit( this ); commit.Add( inductorFP.release() ); diff --git a/pcbnew/netlist_reader/netlist.cpp b/pcbnew/netlist_reader/netlist.cpp index 34ec4d803e..32cbc9b0b7 100644 --- a/pcbnew/netlist_reader/netlist.cpp +++ b/pcbnew/netlist_reader/netlist.cpp @@ -141,7 +141,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR // Spread new footprints. std::vector newFootprints = aUpdater.GetAddedFootprints(); - GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + GetToolManager()->RunAction( ACTIONS::selectionClear ); SpreadFootprints( &newFootprints, { 0, 0 }, true ); @@ -150,7 +150,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR { EDA_ITEMS items; std::copy( newFootprints.begin(), newFootprints.end(), std::back_inserter( items ) ); - GetToolManager()->RunAction( PCB_ACTIONS::selectItems, &items ); + GetToolManager()->RunAction( ACTIONS::selectItems, &items ); *aRunDragCommand = true; } diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 797e7c7cfe..60ae8ad790 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -1270,7 +1270,7 @@ void PCB_BASE_FRAME::OnFpChangeDebounceTimer( wxTimerEvent& aEvent ) } if( !sel.empty() ) - m_toolManager->RunAction( PCB_ACTIONS::selectItems, &sel ); + m_toolManager->RunAction( ACTIONS::selectItems, &sel ); } } catch( const IO_ERROR& ioe ) diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 1b84253eaf..1b32d59c79 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -791,7 +791,7 @@ void PCB_EDIT_FRAME::setupTools() } // Run the selection tool, it is supposed to be always active - m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); } diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index e9c41c61c8..51ae629b2a 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -1578,7 +1578,7 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent ) if( selection.Size() == 0 ) return 0; - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); frame->PushTool( aEvent ); @@ -1712,7 +1712,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent ) } // Deselect all items - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); frame->PushTool( aEvent ); @@ -2072,7 +2072,7 @@ void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECT bool ROUTER_TOOL::CanInlineDrag( int aDragMode ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, + m_toolMgr->RunAction( ACTIONS::selectionCursor, NeighboringSegmentFilter ); const PCB_SELECTION& selection = m_toolMgr->GetTool()->GetSelection(); @@ -2098,7 +2098,7 @@ void ROUTER_TOOL::restoreSelection( const PCB_SELECTION& aOriginalSelection ) { EDA_ITEMS selItems; std::copy( aOriginalSelection.Items().begin(), aOriginalSelection.Items().end(), std::back_inserter( selItems ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItems, &selItems ); + m_toolMgr->RunAction( ACTIONS::selectItems, &selItems ); } @@ -2109,7 +2109,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) if( selection.Empty() ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, + m_toolMgr->RunAction( ACTIONS::selectionCursor, NeighboringSegmentFilter ); } @@ -2159,7 +2159,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) item->SetLocked( false ); } - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); frame()->PushTool( aEvent ); Activate(); @@ -2543,7 +2543,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) for( auto lseg : leaderSegments ) newItems.push_back( lseg->Parent() ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItems, &newItems ); + m_toolMgr->RunAction( ACTIONS::selectItems, &newItems ); } m_gridHelper->SetAuxAxes( false ); @@ -2572,7 +2572,7 @@ int ROUTER_TOOL::InlineBreakTrack( const TOOL_EVENT& aEvent ) if( item->Type() != PCB_TRACE_T && item->Type() != PCB_ARC_T ) return 0; - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); Activate(); diff --git a/pcbnew/tools/array_tool.cpp b/pcbnew/tools/array_tool.cpp index e49f9f3ea2..25166a72b7 100644 --- a/pcbnew/tools/array_tool.cpp +++ b/pcbnew/tools/array_tool.cpp @@ -366,8 +366,8 @@ void ARRAY_TOOL::onDialogClosed( wxCloseEvent& aEvent ) all_added_items.push_back( selection[i] ); } - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItems, &all_added_items ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectItems, &all_added_items ); commit.Push( _( "Create Array" ) ); diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp index 0bc2801966..72a62e5fb6 100644 --- a/pcbnew/tools/board_editor_control.cpp +++ b/pcbnew/tools/board_editor_control.cpp @@ -1045,7 +1045,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent ) BOARD* board = getModel(); COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings(); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -1058,7 +1058,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); commit.Revert(); if( fromOtherCommand ) @@ -1092,7 +1092,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent ) { m_placingFootprint = true; fp->SetPosition( cursorPos ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, fp ); + m_toolMgr->RunAction( ACTIONS::selectItem, fp ); m_toolMgr->PostAction( ACTIONS::refreshPreview ); } else if( aEvent.HasPosition() ) @@ -1112,7 +1112,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent ) cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() ); if( reselect && fp ) - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, fp ); + m_toolMgr->RunAction( ACTIONS::selectItem, fp ); if( evt->IsCancelInteractive() || ( fp && evt->IsAction( &ACTIONS::undo ) ) ) { @@ -1193,13 +1193,13 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent ) fp->SetPosition( cursorPos ); commit.Add( fp ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, fp ); + m_toolMgr->RunAction( ACTIONS::selectItem, fp ); m_toolMgr->PostAction( ACTIONS::refreshPreview ); } else { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); commit.Push( _( "Place Footprint" ) ); fp = nullptr; // to indicate that there is no footprint that we currently modify m_placingFootprint = false; @@ -1269,7 +1269,7 @@ int BOARD_EDITOR_CONTROL::modifyLockSelected( MODIFY_MODE aMode ) BOARD_COMMIT commit( m_frame ); if( selection.Empty() ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor ); + m_toolMgr->RunAction( ACTIONS::selectionCursor ); // Resolve TOGGLE mode if( aMode == TOGGLE ) @@ -1444,7 +1444,7 @@ int BOARD_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent ) toMerge.push_back( curr_area ); } - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( !toMerge.empty() ) { @@ -1453,7 +1453,7 @@ int BOARD_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent ) commit.Push( _( "Merge Zones" ) ); for( EDA_ITEM* item : merged ) - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, item ); + m_toolMgr->RunAction( ACTIONS::selectItem, item ); } } @@ -1650,7 +1650,7 @@ int BOARD_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent ) } if( selection.IsHover() ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index 46db3a0bb7..e355567098 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -1683,10 +1683,10 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent ) m_frame->m_probingSchToPcb = true; // recursion guard { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( item ) - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, item ); + m_toolMgr->RunAction( ACTIONS::selectItem, item ); } m_frame->m_probingSchToPcb = false; @@ -1923,15 +1923,15 @@ int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent ) { PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, + m_toolMgr->RunAction( ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionCursor, EDIT_TOOL::PadFilter ); PCB_SELECTION& selection = selectionTool->GetSelection(); if( selection.Empty() ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, + m_toolMgr->RunAction( ACTIONS::selectionCursor, EDIT_TOOL::FootprintFilter ); selection = selectionTool->GetSelection(); } diff --git a/pcbnew/tools/drawing_stackup_table_tool.cpp b/pcbnew/tools/drawing_stackup_table_tool.cpp index c2c6f1ded8..aa746d704b 100644 --- a/pcbnew/tools/drawing_stackup_table_tool.cpp +++ b/pcbnew/tools/drawing_stackup_table_tool.cpp @@ -551,7 +551,7 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent, BOARD_COMMIT commit( m_frame ); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); // do not capture or auto-pan until we start placing the table SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::TEXT ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index abce400057..8d7e199036 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -444,7 +444,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent ) commit.Add( rect ); commit.Push( isTextBox ? _( "Draw Text Box" ) : _( "Draw Rectangle" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, rect ); + m_toolMgr->RunAction( ACTIONS::selectItem, rect ); } } @@ -492,7 +492,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent ) commit.Add( circle ); commit.Push( _( "Draw Circle" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, circle ); + m_toolMgr->RunAction( ACTIONS::selectItem, circle ); } circle = new PCB_SHAPE( parent ); @@ -539,7 +539,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent ) commit.Add( arc ); commit.Push( _( "Draw Arc" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, arc ); + m_toolMgr->RunAction( ACTIONS::selectItem, arc ); } arc = new PCB_SHAPE( parent ); @@ -629,7 +629,7 @@ int DRAWING_TOOL::PlaceReferenceImage( const TOOL_EVENT& aEvent ) PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); BOARD_COMMIT commit( m_frame ); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); // Add all the drawable symbols to preview if( image ) @@ -653,7 +653,7 @@ int DRAWING_TOOL::PlaceReferenceImage( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_view->ClearPreview(); m_view->RecacheAllItems(); delete image; @@ -745,7 +745,7 @@ int DRAWING_TOOL::PlaceReferenceImage( const TOOL_EVENT& aEvent ) { if( !image ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); wxFileDialog dlg( m_frame, _( "Choose Image" ), wxEmptyString, wxEmptyString, _( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(), @@ -800,7 +800,7 @@ int DRAWING_TOOL::PlaceReferenceImage( const TOOL_EVENT& aEvent ) commit.Add( image ); commit.Push( _( "Place Image" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, image ); + m_toolMgr->RunAction( ACTIONS::selectItem, image ); image = nullptr; m_toolMgr->PostAction( ACTIONS::activatePointEditor ); @@ -887,7 +887,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) auto cleanup = [&]() { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_controls->ForceCursorPosition( false ); m_controls->ShowCursor( true ); m_controls->SetAutoPan( false ); @@ -896,7 +896,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) text = nullptr; }; - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -976,7 +976,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) if( !text ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_controls->ForceCursorPosition( true, m_controls->GetCursorPosition() ); @@ -1032,7 +1032,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) m_frame->GetCanvas()->Refresh(); } - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, text ); + m_toolMgr->RunAction( ACTIONS::selectItem, text ); m_view->Update( &selection() ); // update the cursor so it looks correct before another event @@ -1043,12 +1043,12 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) if( placing ) { text->ClearFlags(); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); commit.Add( text ); commit.Push( _( "Draw Text" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, text ); + m_toolMgr->RunAction( ACTIONS::selectItem, text ); text = nullptr; } @@ -1139,7 +1139,7 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent ) auto cleanup = [&] () { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_controls->ForceCursorPosition( false ); m_controls->ShowCursor( true ); m_controls->SetAutoPan( false ); @@ -1148,7 +1148,7 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent ) table = nullptr; }; - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -1215,7 +1215,7 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent ) { if( !table ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); PCB_LAYER_ID layer = m_frame->GetActiveLayer(); @@ -1234,7 +1234,7 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent ) m_frame->GetCanvas()->Refresh(); } - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, table ); + m_toolMgr->RunAction( ACTIONS::selectItem, table ); m_view->Update( &selection() ); // update the cursor so it looks correct before another event @@ -1242,7 +1242,7 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent ) } else { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); table->Normalize(); @@ -1254,7 +1254,7 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent ) commit.Add( table, m_frame->GetScreen() ); commit.Push( _( "Draw Table" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, table ); + m_toolMgr->RunAction( ACTIONS::selectItem, table ); m_toolMgr->PostAction( ACTIONS::activatePointEditor ); } else @@ -1392,7 +1392,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MEASURE ); }; - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -1500,7 +1500,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) { case SET_ORIGIN: { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); PCB_LAYER_ID layer = m_frame->GetActiveLayer(); @@ -1605,7 +1605,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) if( t == PCB_DIM_LEADER_T ) frame()->OnEditItemRequest( dimension ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, dimension ); + m_toolMgr->RunAction( ACTIONS::selectItem, dimension ); break; } @@ -1897,10 +1897,10 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent ) } // Clear the current selection then select the drawings so that edit tools work on them - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItems, &selItems ); + m_toolMgr->RunAction( ACTIONS::selectItems, &selItems ); if( !dlg.IsPlacementInteractive() ) { @@ -1967,7 +1967,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent ) if( evt->IsCancelInteractive() || evt->IsActivate() ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( group ) { @@ -2045,7 +2045,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent ) SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ANCHOR ); PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_frame->PushTool( aEvent ); @@ -2337,7 +2337,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic, if( !started ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( aStartingPoint ) { @@ -2391,7 +2391,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic, commit.Add( graphic ); commit.Push( _( "Draw Line" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, graphic ); + m_toolMgr->RunAction( ACTIONS::selectItem, graphic ); graphic = nullptr; } @@ -2677,7 +2677,7 @@ bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic, { if( !started ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_controls->SetAutoPan( true ); m_controls->CaptureCursor( true ); @@ -3010,7 +3010,7 @@ std::unique_ptr DRAWING_TOOL::drawOneBezier( const TOOL_EVENT& aToo { if( !started() ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_controls->SetAutoPan( true ); m_controls->CaptureCursor( true ); @@ -3210,7 +3210,7 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE** aZone ) if( selection.Empty() ) { clearSelection = true; - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor ); + m_toolMgr->RunAction( ACTIONS::selectionCursor ); } // we want a single zone @@ -3221,7 +3221,7 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE** aZone ) if( !*aZone ) { if( clearSelection ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return false; } diff --git a/pcbnew/tools/drc_tool.cpp b/pcbnew/tools/drc_tool.cpp index e6d96d6f45..8c5d33f79b 100644 --- a/pcbnew/tools/drc_tool.cpp +++ b/pcbnew/tools/drc_tool.cpp @@ -83,7 +83,7 @@ void DRC_TOOL::ShowDRCDialog( wxWindow* aParent ) } Activate(); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( !m_drcDialog ) { @@ -295,4 +295,4 @@ void DRC_TOOL::setTransitions() Go( &DRC_TOOL::ExcludeMarker, ACTIONS::excludeMarker.MakeEvent() ); Go( &DRC_TOOL::CrossProbe, EVENTS::PointSelectedEvent ); Go( &DRC_TOOL::CrossProbe, EVENTS::SelectedEvent ); -} \ No newline at end of file +} diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 3cb085a27d..24bd724513 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -472,8 +472,8 @@ int EDIT_TOOL::GetAndPlace( const TOOL_EVENT& aEvent ) if( fp ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, fp ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectItem, fp ); selectionTool->GetSelection().SetReferencePoint( fp->GetPosition() ); m_toolMgr->PostAction( PCB_ACTIONS::move ); @@ -1052,7 +1052,7 @@ int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent ) if( selection.IsHover() ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); // Notify other tools of the changes -- This updates the visual ratsnest m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); @@ -1922,7 +1922,7 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) if( selection.IsHover() ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); } else { @@ -2069,7 +2069,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) localCommit.Push( _( "Rotate" ) ); if( is_hover && !m_dragging ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); @@ -2237,7 +2237,7 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) localCommit.Push( _( "Mirror" ) ); if( selection.IsHover() && !m_dragging ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); @@ -2315,7 +2315,7 @@ int EDIT_TOOL::JustifyText( const TOOL_EVENT& aEvent ) } if( selection.IsHover() && !m_dragging ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); @@ -2402,7 +2402,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent ) localCommit.Push( _( "Change Side / Flip" ) ); if( selection.IsHover() && !m_dragging ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); @@ -2476,7 +2476,7 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut ) BOARD_COMMIT commit( this ); // As we are about to remove items, they have to be removed from the selection first - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); // Only delete items that are the root of a selected set (e.g. only delete grouped / generated // items from the parent item, not individually) - issue #17527 @@ -2610,7 +2610,7 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut ) canvas()->Refresh(); // Restore the selection on the original zone - m_toolMgr->RunAction( PCB_ACTIONS::selectItem, zone ); + m_toolMgr->RunAction( ACTIONS::selectItem, zone ); break; } @@ -2832,7 +2832,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent ) commit.Push( _( "Move Exactly" ) ); if( selection.IsHover() ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); @@ -2993,11 +2993,11 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) } // Clear the old selection first - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); // Select the new items EDA_ITEMS nItems( new_items.begin(), new_items.end() ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItems, &nItems ); + m_toolMgr->RunAction( ACTIONS::selectItems, &nItems ); // record the new items as added if( !selection.Empty() ) @@ -3013,7 +3013,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) // Deselect the duplicated item if we originally started as a hover selection if( is_hover ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); } return 0; diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index 998636d7b9..ca8596a251 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -392,7 +392,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit pickedReferencePoint ) ) { if( selection.IsHover() ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); editFrame->PopTool( aEvent ); return false; @@ -805,7 +805,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit // Unselect all items to clear selection flags and then re-select the originally selected // items. - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); if( restore_state ) { @@ -824,7 +824,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit } EDA_ITEMS oItems( orig_items.begin(), orig_items.end() ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItems, &oItems ); + m_toolMgr->RunAction( ACTIONS::selectItems, &oItems ); } // Remove the dynamic ratsnest from the screen diff --git a/pcbnew/tools/group_tool.cpp b/pcbnew/tools/group_tool.cpp index 7cfc3faaa2..b6a139ddaf 100644 --- a/pcbnew/tools/group_tool.cpp +++ b/pcbnew/tools/group_tool.cpp @@ -146,7 +146,7 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent ) picker->SetClickHandler( [&]( const VECTOR2D& aPoint ) -> bool { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); const PCB_SELECTION& sel = m_selectionTool->RequestSelection( []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, @@ -294,10 +294,10 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent ) EDA_ITEMS toSelect; if( selection.Empty() ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor ); + m_toolMgr->RunAction( ACTIONS::selectionCursor ); PCB_SELECTION selCopy = selection; - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); for( EDA_ITEM* item : selCopy ) { @@ -318,7 +318,7 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent ) commit.Push( _( "Ungroup Items" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItems, &toSelect ); + m_toolMgr->RunAction( ACTIONS::selectItems, &toSelect ); m_toolMgr->PostEvent( EVENTS::SelectedItemsModified ); m_frame->OnModify(); @@ -334,7 +334,7 @@ int GROUP_TOOL::RemoveFromGroup( const TOOL_EVENT& aEvent ) BOARD_COMMIT commit( m_frame ); if( selection.Empty() ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor ); + m_toolMgr->RunAction( ACTIONS::selectionCursor ); for( EDA_ITEM* item : selection ) { diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index ca13b52f2a..54f1f62434 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -328,7 +328,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent ) std::deque storedPadNumbers; std::map> oldNumbers; - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); frame()->PushTool( aEvent ); @@ -424,7 +424,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent ) if( evt->IsCancelInteractive() ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); commit.Revert(); frame()->PopTool( aEvent ); @@ -757,7 +757,7 @@ int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent ) explodePad( pad, &layer, commit ); commit.Push( _( "Edit Pad" ) ); - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); frame()->SetActiveLayer( layer ); settings->m_PadEditModePad = pad; @@ -920,7 +920,7 @@ std::vector PAD_TOOL::RecombinePad( PAD* aPad, bool aIsDryRun ) int maxError = board()->GetDesignSettings().m_MaxError; // Don't leave an object in the point editor that might no longer exist after recombining. - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return aPad->Recombine( aIsDryRun, maxError ); } diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 2f7211db68..1ba4d88a7d 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -2150,47 +2150,6 @@ TOOL_ACTION PCB_ACTIONS::selectPointInteractively( TOOL_ACTION_ARGS() .Parameter( {} )); -// PCB_SELECTION_TOOL -// -TOOL_ACTION PCB_ACTIONS::selectionActivate( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection" ) - .Scope( AS_GLOBAL ) - // No description, not shown anywhere - .Flags( AF_ACTIVATE ) ); - -TOOL_ACTION PCB_ACTIONS::selectionCursor( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection.Cursor" ) - .Scope( AS_GLOBAL ) - .Parameter( nullptr ) ); - -TOOL_ACTION PCB_ACTIONS::selectItem( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection.SelectItem" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PCB_ACTIONS::selectItems( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection.SelectItems" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PCB_ACTIONS::unselectItem( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection.UnselectItem" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PCB_ACTIONS::unselectItems( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection.UnselectItems" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PCB_ACTIONS::reselectItem( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection.ReselectItem" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PCB_ACTIONS::selectionClear( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection.Clear" ) - .Scope( AS_GLOBAL ) ); - -TOOL_ACTION PCB_ACTIONS::selectionMenu( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveSelection.SelectionMenu" ) - .Scope( AS_GLOBAL ) ); - TOOL_ACTION PCB_ACTIONS::selectConnection( TOOL_ACTION_ARGS() .Name( "pcbnew.InteractiveSelection.SelectConnection" ) .Scope( AS_GLOBAL ) diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 5a278f4910..ef95c94d8a 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -59,24 +59,6 @@ public: static TOOL_ACTION* LayerIDToAction( PCB_LAYER_ID aLayerID ); // Selection Tool - /// Activation of the selection tool - static TOOL_ACTION selectionActivate; - - /// Select a single item under the cursor position - static TOOL_ACTION selectionCursor; - - /// Clear the current selection - static TOOL_ACTION selectionClear; - - /// Select an item (specified as the event parameter). - static TOOL_ACTION selectItem; - static TOOL_ACTION unselectItem; - static TOOL_ACTION reselectItem; - - /// Select a list of items (specified as the event parameter) - static TOOL_ACTION selectItems; - static TOOL_ACTION unselectItems; - /// Sets selection to specified items, zooms to fit, if enabled static TOOL_ACTION syncSelection; diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 4d3e6901d6..c5f16e2105 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -799,7 +799,7 @@ int PCB_CONTROL::InteractiveDelete( const TOOL_EVENT& aEvent ) PCB_PICKER_TOOL* picker = m_toolMgr->GetTool(); m_pickerItem = nullptr; - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); // Deactivate other tools; particularly important if another PICKER is currently running Activate(); @@ -1426,7 +1426,7 @@ bool PCB_CONTROL::placeBoardItems( BOARD_COMMIT* aCommit, BOARD* aBoard, bool aA bool PCB_CONTROL::placeBoardItems( BOARD_COMMIT* aCommit, std::vector& aItems, bool aIsNew, bool aAnchorAtOrigin, bool aReannotateDuplicates ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); @@ -1484,7 +1484,7 @@ bool PCB_CONTROL::placeBoardItems( BOARD_COMMIT* aCommit, std::vectorRunAction( PCB_ACTIONS::selectItems, &toSel ); + m_toolMgr->RunAction( ACTIONS::selectItems, &toSel ); // Reannotate duplicate footprints (make sense only in board editor ) if( aReannotateDuplicates && m_isBoardEditor ) diff --git a/pcbnew/tools/pcb_edit_table_tool.cpp b/pcbnew/tools/pcb_edit_table_tool.cpp index a21376e4a4..6a282058e3 100644 --- a/pcbnew/tools/pcb_edit_table_tool.cpp +++ b/pcbnew/tools/pcb_edit_table_tool.cpp @@ -76,7 +76,7 @@ const SELECTION& PCB_EDIT_TABLE_TOOL::getTableCellSelection() void PCB_EDIT_TABLE_TOOL::clearSelection() { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); }; @@ -112,7 +112,7 @@ int PCB_EDIT_TABLE_TOOL::EditTable( const TOOL_EVENT& aEvent ) } if( clearSelection ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); return 0; } diff --git a/pcbnew/tools/pcb_picker_tool.cpp b/pcbnew/tools/pcb_picker_tool.cpp index 892b687632..886696db9a 100644 --- a/pcbnew/tools/pcb_picker_tool.cpp +++ b/pcbnew/tools/pcb_picker_tool.cpp @@ -319,7 +319,7 @@ int PCB_PICKER_TOOL::SelectItemInteractively( const TOOL_EVENT& aEvent ) SetClickHandler( [&]( const VECTOR2D& aPoint ) -> bool { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); const PCB_SELECTION& sel = selectionTool->RequestSelection( []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool ) diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index 014356dc3d..e638e9f018 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -2373,7 +2373,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) inDrag = false; frame()->UndoRedoBlock( false ); - m_toolMgr->PostAction( PCB_ACTIONS::reselectItem, + m_toolMgr->PostAction( ACTIONS::reselectItem, item ); // FIXME: Needed for generators } else if( evt->IsCancelInteractive() || evt->IsActivate() ) @@ -2916,7 +2916,7 @@ int PCB_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent ) } else { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); commit.Remove( item ); } } diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index f9403953b7..12e6f6bcfb 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -127,7 +127,7 @@ public: PCB_SELECTION_TOOL::PCB_SELECTION_TOOL() : - SELECTION_TOOL( "pcbnew.InteractiveSelection" ), + SELECTION_TOOL( "common.InteractiveSelection" ), m_frame( nullptr ), m_isFootprintEditor( false ), m_nonModifiedCursor( KICURSOR::ARROW ), @@ -661,7 +661,7 @@ PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCl if( selectionEmpty ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, aClientFilter ); + m_toolMgr->RunAction( ACTIONS::selectionCursor, aClientFilter ); m_selection.ClearReferencePoint(); } @@ -4113,16 +4113,16 @@ void PCB_SELECTION_TOOL::setTransitions() { Go( &PCB_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::Main, PCB_ACTIONS::selectionActivate.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::CursorSelection, PCB_ACTIONS::selectionCursor.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::ClearSelection, PCB_ACTIONS::selectionClear.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::Main, ACTIONS::selectionActivate.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::CursorSelection, ACTIONS::selectionCursor.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::ClearSelection, ACTIONS::selectionClear.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::AddItemToSel, PCB_ACTIONS::selectItem.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::AddItemsToSel, PCB_ACTIONS::selectItems.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::RemoveItemFromSel, PCB_ACTIONS::unselectItem.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::RemoveItemsFromSel, PCB_ACTIONS::unselectItems.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::ReselectItem, PCB_ACTIONS::reselectItem.MakeEvent() ); - Go( &PCB_SELECTION_TOOL::SelectionMenu, PCB_ACTIONS::selectionMenu.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::AddItemToSel, ACTIONS::selectItem.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::AddItemsToSel, ACTIONS::selectItems.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::RemoveItemFromSel, ACTIONS::unselectItem.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::RemoveItemsFromSel, ACTIONS::unselectItems.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::ReselectItem, ACTIONS::reselectItem.MakeEvent() ); + Go( &PCB_SELECTION_TOOL::SelectionMenu, ACTIONS::selectionMenu.MakeEvent() ); Go( &PCB_SELECTION_TOOL::filterSelection, PCB_ACTIONS::filterSelection.MakeEvent() ); Go( &PCB_SELECTION_TOOL::expandConnection, PCB_ACTIONS::selectConnection.MakeEvent() ); diff --git a/pcbnew/tools/pcb_selection_tool.h b/pcbnew/tools/pcb_selection_tool.h index 5e7cf4bc9d..4de7052771 100644 --- a/pcbnew/tools/pcb_selection_tool.h +++ b/pcbnew/tools/pcb_selection_tool.h @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -51,10 +52,6 @@ namespace KIGFX } -using CLIENT_SELECTION_FILTER = - std::function; - - /** * The selection tool: currently supports: * - pick single objects (click LMB) diff --git a/pcbnew/tools/pcb_tool_base.cpp b/pcbnew/tools/pcb_tool_base.cpp index 2abe5dfa74..91424e7d1f 100644 --- a/pcbnew/tools/pcb_tool_base.cpp +++ b/pcbnew/tools/pcb_tool_base.cpp @@ -51,7 +51,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const TOOL_EVENT& aTool, BOARD_COMMIT commit( frame() ); - GetManager()->RunAction( PCB_ACTIONS::selectionClear ); + GetManager()->RunAction( ACTIONS::selectionClear ); Activate(); // Must be done after Activate() so that it gets set into the correct context diff --git a/pcbnew/tools/position_relative_tool.cpp b/pcbnew/tools/position_relative_tool.cpp index 85bf6a7344..90a774e505 100644 --- a/pcbnew/tools/position_relative_tool.cpp +++ b/pcbnew/tools/position_relative_tool.cpp @@ -435,7 +435,7 @@ int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( const VECTOR2I& aPosAncho m_commit->Push( _( "Position Relative" ) ); if( m_selection.IsHover() ) - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + m_toolMgr->RunAction( ACTIONS::selectionClear ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index dfbb96740b..481459a4e8 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -169,7 +169,7 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout ) // Clear the selection before removing the old zone auto toolMgr = m_tool.GetManager(); - toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + toolMgr->RunAction( ACTIONS::selectionClear ); SHAPE_POLY_SET originalOutline( *aZone.Outline() ); originalOutline.BooleanSubtract( *aCutout.Outline() ); @@ -206,7 +206,7 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout ) else { m_params.m_sourceZone = newZones[0]; - toolMgr->RunAction( PCB_ACTIONS::selectItem, newZones[0] ); + toolMgr->RunAction( ACTIONS::selectItem, newZones[0] ); } } @@ -230,7 +230,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr aZone ) commit.Add( aZone.get() ); commit.Push( _( "Draw Zone" ) ); - m_tool.GetManager()->RunAction( PCB_ACTIONS::selectItem, aZone.release() ); + m_tool.GetManager()->RunAction( ACTIONS::selectItem, aZone.release() ); break; } @@ -252,7 +252,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr aZone ) commit.Add( poly ); commit.Push( _( "Draw Polygon" ) ); - m_tool.GetManager()->RunAction( PCB_ACTIONS::selectItem, poly ); + m_tool.GetManager()->RunAction( ACTIONS::selectItem, poly ); break; } } @@ -271,7 +271,7 @@ bool ZONE_CREATE_HELPER::OnFirstPoint( POLYGON_GEOM_MANAGER& aMgr ) if( m_zone ) { - m_tool.GetManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_tool.GetManager()->RunAction( ACTIONS::selectionClear ); // set up properties from zone const auto& settings = *m_parentView.GetPainter()->GetSettings(); diff --git a/pcbnew/widgets/search_handlers.cpp b/pcbnew/widgets/search_handlers.cpp index d8f00c5a16..f02db01431 100644 --- a/pcbnew/widgets/search_handlers.cpp +++ b/pcbnew/widgets/search_handlers.cpp @@ -89,11 +89,11 @@ void PCB_SEARCH_HANDLER::SelectItems( std::vector& aItemRows ) selectedItems.push_back( m_hitlist[row] ); } - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectionClear ); if( selectedItems.size() ) { - m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, &selectedItems ); + m_frame->GetToolManager()->RunAction( ACTIONS::selectItems, &selectedItems ); switch( settings.selection_zoom ) { diff --git a/qa/data/config/9.99/kicad_common.json b/qa/data/config/9.99/kicad_common.json index 8b18ebc5ed..955153ea26 100644 --- a/qa/data/config/9.99/kicad_common.json +++ b/qa/data/config/9.99/kicad_common.json @@ -90,6 +90,6 @@ "pdf_viewer_name": "", "text_editor": "/usr/bin/open -e", "use_system_pdf_viewer": true, - "working_dir": "/home/wayne/src/kicad/qa/tests" + "working_dir": "/home/mike/Projects/src/kicad/qa/tests" } } diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index 84c4677e69..6ef2638391 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -188,7 +188,7 @@ public: PCB_SELECTION_TOOL::PCB_SELECTION_TOOL() : - SELECTION_TOOL( "pcbnew.InteractiveSelection" ), + SELECTION_TOOL( "common.InteractiveSelection" ), m_frame( NULL ), m_enteredGroup( NULL ), m_nonModifiedCursor( KICURSOR::ARROW ), diff --git a/qa/qa_utils/pcb_test_frame.cpp b/qa/qa_utils/pcb_test_frame.cpp index a6fc836fef..c4820e6f88 100644 --- a/qa/qa_utils/pcb_test_frame.cpp +++ b/qa/qa_utils/pcb_test_frame.cpp @@ -118,7 +118,7 @@ void PCB_TEST_FRAME_BASE::SetBoard( std::shared_ptr b ) m_galPanel->SetEventDispatcher( m_toolDispatcher ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); - m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); + m_toolManager->InvokeTool( "common.InteractiveSelection" ); #endif } @@ -208,7 +208,7 @@ void PCB_TEST_FRAME_BASE::LoadSettings() void PCB_TEST_FRAME_BASE::SetSelectionHook( std::function aHook ) { - auto tool = m_toolManager->FindTool("pcbnew.InteractiveSelection"); + auto tool = m_toolManager->FindTool( "common.InteractiveSelection" ); if (!tool) return; diff --git a/qa/qa_utils/pcb_test_selection_tool.cpp b/qa/qa_utils/pcb_test_selection_tool.cpp index 095edb6646..d582158811 100644 --- a/qa/qa_utils/pcb_test_selection_tool.cpp +++ b/qa/qa_utils/pcb_test_selection_tool.cpp @@ -5,8 +5,7 @@ #include #include -PCB_TEST_SELECTION_TOOL::PCB_TEST_SELECTION_TOOL() - : SELECTION_TOOL( "pcbnew.InteractiveSelection" ) +PCB_TEST_SELECTION_TOOL::PCB_TEST_SELECTION_TOOL() : SELECTION_TOOL( "common.InteractiveSelection" ) { } @@ -109,7 +108,7 @@ bool PCB_TEST_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere ) void PCB_TEST_SELECTION_TOOL::setTransitions() { - Go( &PCB_TEST_SELECTION_TOOL::Main, PCB_ACTIONS::selectionActivate.MakeEvent() ); + Go( &PCB_TEST_SELECTION_TOOL::Main, ACTIONS::selectionActivate.MakeEvent() ); }