Add point-editor activation for immediate-mode drawing.

This commit is contained in:
Jeff Young 2019-05-24 12:39:30 +01:00
parent 09424db68f
commit 85f984ccd9
6 changed files with 29 additions and 11 deletions

View File

@ -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" ),

View File

@ -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 );
}

View File

@ -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;

View File

@ -328,7 +328,10 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
m_frame->OnModify();
if( isImmediate )
{
m_toolMgr->RunAction( ACTIONS::activatePointEditor );
break;
}
}
}

View File

@ -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 );
}

View File

@ -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 );
}