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