Process properties command locally within drawing tools.
Fixes https://gitlab.com/kicad/code/kicad/issues/5612 Fixes https://gitlab.com/kicad/code/kicad/issues/5615
This commit is contained in:
parent
4d24c9d610
commit
8dd725469f
|
@ -701,8 +701,7 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
|
|||
"TOOL_MANAGER::dispatchInternal - %s stopped passing event: %s",
|
||||
st->theTool->GetName(), aEvent.Format() );
|
||||
|
||||
handled = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -416,8 +416,6 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
|||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
bool reselect = false;
|
||||
|
||||
// Prime the pump
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->RunAction( ACTIONS::cursorClick );
|
||||
|
@ -428,10 +426,8 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
|||
m_frame->GetCanvas()->SetCurrentCursor( text ? wxCURSOR_ARROW : wxCURSOR_PENCIL );
|
||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||
|
||||
if( reselect && text )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, text );
|
||||
|
||||
auto cleanup = [&] () {
|
||||
auto cleanup = [&]()
|
||||
{
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
m_controls->ForceCursorPosition( false );
|
||||
m_controls->ShowCursor( true );
|
||||
|
@ -575,13 +571,15 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
|||
selection().SetReferencePoint( cursorPos );
|
||||
m_view->Update( &selection() );
|
||||
}
|
||||
|
||||
else if( text && evt->IsAction( &PCB_ACTIONS::properties ) )
|
||||
else if( evt->IsAction( &PCB_ACTIONS::properties ) )
|
||||
{
|
||||
// Calling 'Properties' action clears the selection, so we need to restore it
|
||||
reselect = true;
|
||||
if( text )
|
||||
{
|
||||
frame()->OnEditItemRequest( text );
|
||||
m_view->Update( &selection() );
|
||||
frame()->SetMsgPanel( text );
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
evt->SetPassEvent();
|
||||
}
|
||||
|
@ -653,7 +651,8 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
evt->IsPrime() ? evt->Position() : m_controls->GetMousePosition(), nullptr );
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
auto cleanup = [&] () {
|
||||
auto cleanup = [&]()
|
||||
{
|
||||
m_controls->SetAutoPan( false );
|
||||
m_controls->CaptureCursor( false );
|
||||
|
||||
|
@ -880,6 +879,15 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
// Show a preview of the item
|
||||
m_view->Update( &preview );
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::properties ) )
|
||||
{
|
||||
if( step != SET_ORIGIN )
|
||||
{
|
||||
frame()->OnEditItemRequest( dimension );
|
||||
dimension->Update();
|
||||
frame()->SetMsgPanel( dimension );
|
||||
}
|
||||
}
|
||||
else
|
||||
evt->SetPassEvent();
|
||||
}
|
||||
|
@ -1242,6 +1250,15 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, int aShape, DRAWSEGMEN
|
|||
m_view->Update( &preview );
|
||||
frame()->SetMsgPanel( graphic );
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::properties ) )
|
||||
{
|
||||
if( started )
|
||||
{
|
||||
frame()->OnEditItemRequest( graphic );
|
||||
m_view->Update( &preview );
|
||||
frame()->SetMsgPanel( graphic );
|
||||
}
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
m_menu.ShowContextMenu( selection() );
|
||||
|
@ -1516,6 +1533,15 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, DRAWSEGMENT** aGraphic, bo
|
|||
m_view->Update( &preview );
|
||||
frame()->SetMsgPanel( graphic );
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::properties ) )
|
||||
{
|
||||
if( firstPoint )
|
||||
{
|
||||
frame()->OnEditItemRequest( graphic );
|
||||
m_view->Update( &preview );
|
||||
frame()->SetMsgPanel( graphic );
|
||||
}
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
m_menu.ShowContextMenu( selection() );
|
||||
|
@ -1791,6 +1817,15 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
|||
status.Hide();
|
||||
}
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::properties ) )
|
||||
{
|
||||
if( started )
|
||||
{
|
||||
frame()->OnEditItemRequest( zoneTool.GetZone() );
|
||||
zoneTool.OnGeometryChange( polyGeomMgr );
|
||||
frame()->SetMsgPanel( zoneTool.GetZone() );
|
||||
}
|
||||
}
|
||||
else
|
||||
evt->SetPassEvent();
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ public:
|
|||
|
||||
virtual ~ZONE_CREATE_HELPER();
|
||||
|
||||
ZONE_CONTAINER* GetZone() const { return m_zone.get(); }
|
||||
|
||||
/*
|
||||
* Interface for receiving POLYGON_GEOM_MANAGER update
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue