From 1f6a5c92d74235f9ccc373138de2dfac9d7e44ea Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 9 Jun 2019 23:32:08 +0100 Subject: [PATCH] Make sure placement menu has a pointer back to its tool. Fixes: lp:1831730 * https://bugs.launchpad.net/kicad/+bug/1831730 --- pcbnew/tools/placement_tool.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp index 88d3ec8bc0..9fc5953438 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -102,6 +102,7 @@ bool ALIGN_DISTRIBUTE_TOOL::Init() // Create a context menu and make it available through selection tool m_placementMenu = new ACTION_MENU; + m_placementMenu->SetTool( this ); m_placementMenu->SetIcon( align_items_xpm ); m_placementMenu->SetTitle( _( "Align/Distribute" ) ); @@ -112,6 +113,7 @@ bool ALIGN_DISTRIBUTE_TOOL::Init() m_placementMenu->Add( PCB_ACTIONS::alignRight ); m_placementMenu->Add( PCB_ACTIONS::alignCenterX ); m_placementMenu->Add( PCB_ACTIONS::alignCenterY ); + m_placementMenu->AppendSeparator(); m_placementMenu->Add( PCB_ACTIONS::distributeHorizontally ); m_placementMenu->Add( PCB_ACTIONS::distributeVertically ); @@ -639,13 +641,13 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically( ALIGNMENT_RECTS& item void ALIGN_DISTRIBUTE_TOOL::setTransitions() { - Go( &ALIGN_DISTRIBUTE_TOOL::AlignTop, PCB_ACTIONS::alignTop.MakeEvent() ); - Go( &ALIGN_DISTRIBUTE_TOOL::AlignBottom, PCB_ACTIONS::alignBottom.MakeEvent() ); - Go( &ALIGN_DISTRIBUTE_TOOL::AlignLeft, PCB_ACTIONS::alignLeft.MakeEvent() ); - Go( &ALIGN_DISTRIBUTE_TOOL::AlignRight, PCB_ACTIONS::alignRight.MakeEvent() ); - Go( &ALIGN_DISTRIBUTE_TOOL::AlignCenterX, PCB_ACTIONS::alignCenterX.MakeEvent() ); - Go( &ALIGN_DISTRIBUTE_TOOL::AlignCenterY, PCB_ACTIONS::alignCenterY.MakeEvent() ); + Go( &ALIGN_DISTRIBUTE_TOOL::AlignTop, PCB_ACTIONS::alignTop.MakeEvent() ); + Go( &ALIGN_DISTRIBUTE_TOOL::AlignBottom, PCB_ACTIONS::alignBottom.MakeEvent() ); + Go( &ALIGN_DISTRIBUTE_TOOL::AlignLeft, PCB_ACTIONS::alignLeft.MakeEvent() ); + Go( &ALIGN_DISTRIBUTE_TOOL::AlignRight, PCB_ACTIONS::alignRight.MakeEvent() ); + Go( &ALIGN_DISTRIBUTE_TOOL::AlignCenterX, PCB_ACTIONS::alignCenterX.MakeEvent() ); + Go( &ALIGN_DISTRIBUTE_TOOL::AlignCenterY, PCB_ACTIONS::alignCenterY.MakeEvent() ); - Go( &ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally, PCB_ACTIONS::distributeHorizontally.MakeEvent() ); - Go( &ALIGN_DISTRIBUTE_TOOL::DistributeVertically, PCB_ACTIONS::distributeVertically.MakeEvent() ); + Go( &ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally, PCB_ACTIONS::distributeHorizontally.MakeEvent() ); + Go( &ALIGN_DISTRIBUTE_TOOL::DistributeVertically, PCB_ACTIONS::distributeVertically.MakeEvent() ); }