From 815602d1af0f3d4381b0795cbe9bec55d38afc51 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 26 Jul 2019 09:28:59 -0600 Subject: [PATCH] Fix missing AF_ACTIVATE flags on some tools. Fixes: lp:1813659 * https://bugs.launchpad.net/kicad/+bug/1813659 --- eeschema/libedit/toolbars_libedit.cpp | 4 ++-- eeschema/menubar.cpp | 2 +- eeschema/toolbars_sch_editor.cpp | 8 ++++---- eeschema/tools/ee_actions.cpp | 4 ++-- eeschema/tools/ee_actions.h | 4 ++-- eeschema/tools/lib_edit_tool.cpp | 2 +- eeschema/tools/sch_edit_tool.cpp | 2 +- eeschema/tools/sch_editor_control.cpp | 2 +- pagelayout_editor/toolbars_pl_editor.cpp | 4 ++-- pagelayout_editor/tools/pl_actions.cpp | 2 +- pagelayout_editor/tools/pl_actions.h | 2 +- pagelayout_editor/tools/pl_edit_tool.cpp | 2 +- pcbnew/tools/pcb_actions.cpp | 8 ++++---- pcbnew/tools/pcb_editor_control.cpp | 4 +++- 14 files changed, 26 insertions(+), 24 deletions(-) diff --git a/eeschema/libedit/toolbars_libedit.cpp b/eeschema/libedit/toolbars_libedit.cpp index 76864ba204..777ef3c9be 100644 --- a/eeschema/libedit/toolbars_libedit.cpp +++ b/eeschema/libedit/toolbars_libedit.cpp @@ -69,7 +69,7 @@ void LIB_EDIT_FRAME::ReCreateVToolbar() KiScaledBitmap( export_xpm, this ), _( "Export current drawing" ), wxITEM_CHECK ); - m_drawToolBar->Add( EE_ACTIONS::deleteItemCursor, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( EE_ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Realize(); } @@ -194,6 +194,6 @@ void LIB_EDIT_FRAME::SyncToolbars() TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawSymbolCircle ); TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawSymbolArc ); TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawSymbolLines ); - TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::deleteItemCursor ); + TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::deleteTool ); m_drawToolBar->Refresh(); } diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 9bb849274f..e1a557573c 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -149,7 +149,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() editMenu->AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty ); editMenu->AddSeparator(); - editMenu->AddItem( EE_ACTIONS::deleteItemCursor, EE_CONDITIONS::ShowAlways ); + editMenu->AddItem( EE_ACTIONS::deleteTool, EE_CONDITIONS::ShowAlways ); editMenu->AddSeparator(); editMenu->AddItem( ACTIONS::find, EE_CONDITIONS::ShowAlways ); diff --git a/eeschema/toolbars_sch_editor.cpp b/eeschema/toolbars_sch_editor.cpp index 9e05249450..10e092a2f7 100644 --- a/eeschema/toolbars_sch_editor.cpp +++ b/eeschema/toolbars_sch_editor.cpp @@ -114,7 +114,7 @@ void SCH_EDIT_FRAME::ReCreateVToolbar() // Set up toolbar m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( EE_ACTIONS::highlightNetCursor, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( EE_ACTIONS::highlightNetTool, ACTION_TOOLBAR::TOGGLE ); KiScaledSeparator( m_drawToolBar, this ); m_drawToolBar->Add( EE_ACTIONS::placeSymbol, ACTION_TOOLBAR::TOGGLE ); @@ -136,7 +136,7 @@ void SCH_EDIT_FRAME::ReCreateVToolbar() m_drawToolBar->Add( EE_ACTIONS::drawLines, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( EE_ACTIONS::placeSchematicText, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( EE_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( EE_ACTIONS::deleteItemCursor, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( EE_ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Realize(); } @@ -186,7 +186,7 @@ void SCH_EDIT_FRAME::SyncToolbars() m_optionsToolBar->Refresh(); TOGGLE_TOOL( m_drawToolBar, ACTIONS::selectionTool ); - TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::highlightNetCursor ); + TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::highlightNetTool ); TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeSymbol ); TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placePower ); TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawWire ); @@ -204,6 +204,6 @@ void SCH_EDIT_FRAME::SyncToolbars() TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawLines ); TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeSchematicText ); TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeImage ); - TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::deleteItemCursor ); + TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::deleteTool ); m_drawToolBar->Refresh(); } diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 7455862dd0..4b807842e8 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -472,7 +472,7 @@ TOOL_ACTION EE_ACTIONS::pinTable( "eeschema.InteractiveEdit.pinTable", _( "Pin Table..." ), _( "Displays pin table for bulk editing of pins" ), pin_table_xpm ); -TOOL_ACTION EE_ACTIONS::deleteItemCursor( "eeschema.InteractiveEdit.deleteTool", +TOOL_ACTION EE_ACTIONS::deleteTool( "eeschema.InteractiveEdit.deleteTool", AS_GLOBAL, 0, "", _( "Delete Tool" ), _( "Delete clicked items" ), delete_xpm, AF_ACTIVATE ); @@ -513,7 +513,7 @@ TOOL_ACTION EE_ACTIONS::clearHighlight( "eeschema.EditorControl.clearHighlight", TOOL_ACTION EE_ACTIONS::updateNetHighlighting( "eeschema.EditorControl.updateNetHighlighting", AS_GLOBAL ); -TOOL_ACTION EE_ACTIONS::highlightNetCursor( "eeschema.EditorControl.highlightNetTool", +TOOL_ACTION EE_ACTIONS::highlightNetTool( "eeschema.EditorControl.highlightNetTool", AS_GLOBAL, 0, "", _( "Highlight Nets" ), _( "Highlight wires and pins of a net" ), net_highlight_schematic_xpm, AF_ACTIVATE ); diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index 8892099def..0a4ebf9058 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -93,7 +93,7 @@ public: static TOOL_ACTION placeSchematicText; static TOOL_ACTION drawLines; static TOOL_ACTION placeImage; - static TOOL_ACTION deleteItemCursor; + static TOOL_ACTION deleteTool; static TOOL_ACTION finishLineWireOrBus; static TOOL_ACTION finishWire; static TOOL_ACTION finishBus; @@ -202,7 +202,7 @@ public: static TOOL_ACTION highlightNet; static TOOL_ACTION clearHighlight; static TOOL_ACTION updateNetHighlighting; - static TOOL_ACTION highlightNetCursor; + static TOOL_ACTION highlightNetTool; ///> @copydoc COMMON_ACTIONS::TranslateLegacyId() virtual OPT TranslateLegacyId( int aId ) override diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp index eb84aec51d..a8c685f586 100644 --- a/eeschema/tools/lib_edit_tool.cpp +++ b/eeschema/tools/lib_edit_tool.cpp @@ -743,7 +743,7 @@ void LIB_EDIT_TOOL::setTransitions() Go( &LIB_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorX.MakeEvent() ); Go( &LIB_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorY.MakeEvent() ); Go( &LIB_EDIT_TOOL::DoDelete, EE_ACTIONS::doDelete.MakeEvent() ); - Go( &LIB_EDIT_TOOL::DeleteItemCursor, EE_ACTIONS::deleteItemCursor.MakeEvent() ); + Go( &LIB_EDIT_TOOL::DeleteItemCursor, EE_ACTIONS::deleteTool.MakeEvent() ); Go( &LIB_EDIT_TOOL::Properties, EE_ACTIONS::properties.MakeEvent() ); Go( &LIB_EDIT_TOOL::Properties, EE_ACTIONS::symbolProperties.MakeEvent() ); diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 9b94edcd37..bef73c2378 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -1409,7 +1409,7 @@ void SCH_EDIT_TOOL::setTransitions() Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorX.MakeEvent() ); Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorY.MakeEvent() ); Go( &SCH_EDIT_TOOL::DoDelete, EE_ACTIONS::doDelete.MakeEvent() ); - Go( &SCH_EDIT_TOOL::DeleteItemCursor, EE_ACTIONS::deleteItemCursor.MakeEvent() ); + Go( &SCH_EDIT_TOOL::DeleteItemCursor, EE_ACTIONS::deleteTool.MakeEvent() ); Go( &SCH_EDIT_TOOL::Properties, EE_ACTIONS::properties.MakeEvent() ); Go( &SCH_EDIT_TOOL::EditField, EE_ACTIONS::editReference.MakeEvent() ); diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index fe449920a5..5de82ad4eb 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -1154,7 +1154,7 @@ void SCH_EDITOR_CONTROL::setTransitions() Go( &SCH_EDITOR_CONTROL::HighlightNet, EE_ACTIONS::highlightNet.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ClearHighlight, EE_ACTIONS::clearHighlight.MakeEvent() ); - Go( &SCH_EDITOR_CONTROL::HighlightNetCursor, EE_ACTIONS::highlightNetCursor.MakeEvent() ); + Go( &SCH_EDITOR_CONTROL::HighlightNetCursor, EE_ACTIONS::highlightNetTool.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EVENTS::SelectedItemsModified ); Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EE_ACTIONS::updateNetHighlighting.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ClearHighlight, ACTIONS::cancelInteractive.MakeEvent() ); diff --git a/pagelayout_editor/toolbars_pl_editor.cpp b/pagelayout_editor/toolbars_pl_editor.cpp index ab4cd6d9a3..d35b7a8cbd 100644 --- a/pagelayout_editor/toolbars_pl_editor.cpp +++ b/pagelayout_editor/toolbars_pl_editor.cpp @@ -135,7 +135,7 @@ void PL_EDITOR_FRAME::ReCreateVToolbar() m_drawToolBar->Add( PL_ACTIONS::appendImportedWorksheet, ACTION_TOOLBAR::TOGGLE ); KiScaledSeparator( m_drawToolBar, this ); - m_drawToolBar->Add( PL_ACTIONS::deleteItemCursor, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PL_ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Realize(); } @@ -161,7 +161,7 @@ void PL_EDITOR_FRAME::SyncToolbars() TOGGLE_TOOL( m_drawToolBar, PL_ACTIONS::drawRectangle ); TOGGLE_TOOL( m_drawToolBar, PL_ACTIONS::placeText ); TOGGLE_TOOL( m_drawToolBar, PL_ACTIONS::placeImage ); - TOGGLE_TOOL( m_drawToolBar, PL_ACTIONS::deleteItemCursor ); + TOGGLE_TOOL( m_drawToolBar, PL_ACTIONS::deleteTool ); m_drawToolBar->Toggle( PL_ACTIONS::appendImportedWorksheet, false ); // Not really a tool m_drawToolBar->Refresh(); diff --git a/pagelayout_editor/tools/pl_actions.cpp b/pagelayout_editor/tools/pl_actions.cpp index 9344d45ac6..d32ecd5323 100644 --- a/pagelayout_editor/tools/pl_actions.cpp +++ b/pagelayout_editor/tools/pl_actions.cpp @@ -72,7 +72,7 @@ TOOL_ACTION PL_ACTIONS::appendImportedWorksheet( "plEditor.InteractiveEdit.appen _( "Append an existing page layout design file to current file" ), import_xpm, AF_ACTIVATE ); -TOOL_ACTION PL_ACTIONS::deleteItemCursor( "plEditor.InteractiveEdit.deleteTool", +TOOL_ACTION PL_ACTIONS::deleteTool( "plEditor.InteractiveEdit.deleteTool", AS_GLOBAL, 0, "", _( "Delete Items" ), _( "Delete clicked items" ), delete_xpm, AF_ACTIVATE ); diff --git a/pagelayout_editor/tools/pl_actions.h b/pagelayout_editor/tools/pl_actions.h index 2dd3463974..a986d7c3c6 100644 --- a/pagelayout_editor/tools/pl_actions.h +++ b/pagelayout_editor/tools/pl_actions.h @@ -70,7 +70,7 @@ public: static TOOL_ACTION move; // Miscellaneous - static TOOL_ACTION deleteItemCursor; + static TOOL_ACTION deleteTool; static TOOL_ACTION refreshPreview; static TOOL_ACTION toggleBackground; static TOOL_ACTION showInspector; diff --git a/pagelayout_editor/tools/pl_edit_tool.cpp b/pagelayout_editor/tools/pl_edit_tool.cpp index 44d478adba..6d2ab91b1a 100644 --- a/pagelayout_editor/tools/pl_edit_tool.cpp +++ b/pagelayout_editor/tools/pl_edit_tool.cpp @@ -500,7 +500,7 @@ void PL_EDIT_TOOL::setTransitions() Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() ); Go( &PL_EDIT_TOOL::ImportWorksheetContent, PL_ACTIONS::appendImportedWorksheet.MakeEvent() ); - Go( &PL_EDIT_TOOL::DeleteItemCursor, PL_ACTIONS::deleteItemCursor.MakeEvent() ); + Go( &PL_EDIT_TOOL::DeleteItemCursor, PL_ACTIONS::deleteTool.MakeEvent() ); Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() ); Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() ); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index b4d70b5af0..12ea3112e5 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -548,7 +548,7 @@ TOOL_ACTION PCB_ACTIONS::placeModule( "pcbnew.EditorControl.placeModule", TOOL_ACTION PCB_ACTIONS::drillOrigin( "pcbnew.EditorControl.drillOrigin", AS_GLOBAL, 0, "", _( "Drill and Place Offset" ), _( "Place origin point for drill and place files" ), - pcb_offset_xpm ); + pcb_offset_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::toggleLock( "pcbnew.EditorControl.toggleLock", AS_GLOBAL, @@ -585,7 +585,7 @@ TOOL_ACTION PCB_ACTIONS::clearHighlight( "pcbnew.EditorControl.clearHighlight", TOOL_ACTION PCB_ACTIONS::highlightNetTool( "pcbnew.EditorControl.highlightNetTool", AS_GLOBAL, 0, "", _( "Highlight Nets" ), _( "Highlight all copper items of a net" ), - net_highlight_xpm ); + net_highlight_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::highlightNetSelection( "pcbnew.EditorControl.highlightNetSelection", AS_GLOBAL, @@ -609,7 +609,7 @@ TOOL_ACTION PCB_ACTIONS::showEeschema( "pcbnew.EditorControl.showEeschema", TOOL_ACTION PCB_ACTIONS::localRatsnestTool( "pcbnew.Control.localRatsnestTool", AS_GLOBAL, 0, "", _( "Highlight Ratsnest" ), _( "Show ratsnest of selected item(s)" ), - tool_ratsnest_xpm ); + tool_ratsnest_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::hideDynamicRatsnest( "pcbnew.Control.hideDynamicRatsnest", AS_GLOBAL ); @@ -907,7 +907,7 @@ TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged", TOOL_ACTION PCB_ACTIONS::deleteTool( "pcbnew.Control.deleteTool", AS_GLOBAL, 0, "", _( "Delete Items Tool" ), _( "Click on items to delete them" ), - delete_xpm ); + delete_xpm, AF_ACTIVATE ); //Show board statistics tool TOOL_ACTION PCB_ACTIONS::boardStatistics( "pcbnew.InspectionTool.ShowStatisticsDialog", AS_GLOBAL, diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index e906711ef2..8d58ea2354 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -668,7 +668,8 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent ) if( reselect && module ) m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, module ); - auto cleanup = [&] () { + auto cleanup = [&] () + { m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); commit.Revert(); module = NULL; @@ -927,6 +928,7 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent ) } } + preview.Clear(); delete target; view->Remove( &preview ); controls->SetSnapping( false );