diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index 0dd239a7dd..13269a8116 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -38,6 +38,9 @@ TOOL_ACTION ACTIONS::paste( "common.Interactive.paste", _( "Paste" ), _( "Paste clipboard into schematic" ), paste_xpm ); +TOOL_ACTION ACTIONS::activatePointEditor( "common.Control.activatePointEditor", + AS_GLOBAL, 0, "", "" ); // This is an internal event + TOOL_ACTION ACTIONS::find( "common.Interactive.find", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FIND ), _( "Find" ), _( "Find text" ), diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index 563cd83f50..6426cd8608 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -257,6 +257,10 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent ) if( selection.Size() != 1 || !selection.Front()->IsType( pointTypes ) ) return 0; + // Wait till drawing tool is done + if( selection.Front()->IsNew() ) + return 0; + Activate(); KIGFX::VIEW_CONTROLS* controls = getViewControls(); @@ -780,10 +784,11 @@ void EE_POINT_EDITOR::rollbackFromUndo() void EE_POINT_EDITOR::setTransitions() { + Go( &EE_POINT_EDITOR::Main, EVENTS::SelectedEvent ); + Go( &EE_POINT_EDITOR::Main, ACTIONS::activatePointEditor.MakeEvent() ); Go( &EE_POINT_EDITOR::addCorner, EE_ACTIONS::pointEditorAddCorner.MakeEvent() ); Go( &EE_POINT_EDITOR::removeCorner, EE_ACTIONS::pointEditorRemoveCorner.MakeEvent() ); Go( &EE_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified ); - Go( &EE_POINT_EDITOR::Main, EVENTS::SelectedEvent ); } diff --git a/include/tool/actions.h b/include/tool/actions.h index 17dbb28d4d..f75988d67b 100644 --- a/include/tool/actions.h +++ b/include/tool/actions.h @@ -52,6 +52,7 @@ public: static TOOL_ACTION cut; static TOOL_ACTION copy; static TOOL_ACTION paste; + static TOOL_ACTION activatePointEditor; // Find and Replace static TOOL_ACTION find; diff --git a/pagelayout_editor/tools/pl_drawing_tools.cpp b/pagelayout_editor/tools/pl_drawing_tools.cpp index c129e6ae14..294859e4f7 100644 --- a/pagelayout_editor/tools/pl_drawing_tools.cpp +++ b/pagelayout_editor/tools/pl_drawing_tools.cpp @@ -328,7 +328,10 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) m_frame->OnModify(); if( isImmediate ) + { + m_toolMgr->RunAction( ACTIONS::activatePointEditor ); break; + } } } diff --git a/pagelayout_editor/tools/pl_point_editor.cpp b/pagelayout_editor/tools/pl_point_editor.cpp index 7cf68f8c63..6818b92da2 100644 --- a/pagelayout_editor/tools/pl_point_editor.cpp +++ b/pagelayout_editor/tools/pl_point_editor.cpp @@ -154,6 +154,10 @@ int PL_POINT_EDITOR::Main( const TOOL_EVENT& aEvent ) if( selection.Size() != 1 || !selection.Front()->IsType( pointTypes ) ) return 0; + // Wait till drawing tool is done + if( selection.Front()->IsNew() ) + return 0; + Activate(); KIGFX::VIEW_CONTROLS* controls = getViewControls(); @@ -422,6 +426,7 @@ int PL_POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent ) void PL_POINT_EDITOR::setTransitions() { Go( &PL_POINT_EDITOR::Main, EVENTS::SelectedEvent ); + Go( &PL_POINT_EDITOR::Main, ACTIONS::activatePointEditor.MakeEvent() ); Go( &PL_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified ); } diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 267fdc21f6..fcf2012afb 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -899,16 +899,6 @@ EDIT_POINT POINT_EDITOR::get45DegConstrainer() const } -void POINT_EDITOR::setTransitions() -{ - Go( &POINT_EDITOR::addCorner, PCB_ACTIONS::pointEditorAddCorner.MakeEvent() ); - Go( &POINT_EDITOR::removeCorner, PCB_ACTIONS::pointEditorRemoveCorner.MakeEvent() ); - Go( &POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified ); - Go( &POINT_EDITOR::OnSelectionChange, EVENTS::SelectedEvent ); - Go( &POINT_EDITOR::OnSelectionChange, EVENTS::UnselectedEvent ); -} - - bool POINT_EDITOR::canAddCorner( const EDA_ITEM& aItem ) { const auto type = aItem.Type(); @@ -1207,3 +1197,14 @@ int POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent ) updatePoints(); return 0; } + + +void POINT_EDITOR::setTransitions() +{ + Go( &POINT_EDITOR::OnSelectionChange, ACTIONS::activatePointEditor.MakeEvent() ); + Go( &POINT_EDITOR::addCorner, PCB_ACTIONS::pointEditorAddCorner.MakeEvent() ); + Go( &POINT_EDITOR::removeCorner, PCB_ACTIONS::pointEditorRemoveCorner.MakeEvent() ); + Go( &POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified ); + Go( &POINT_EDITOR::OnSelectionChange, EVENTS::SelectedEvent ); + Go( &POINT_EDITOR::OnSelectionChange, EVENTS::UnselectedEvent ); +}