From 8d017c92617555a264fbb44fc0354d049b0e5d07 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 24 Apr 2018 11:42:38 -0700 Subject: [PATCH] Re-enabling global spread and place This had been removed along with autorouter but its functionality is still desired. If/when the autorouter is resurrected, these IDs will need to be deconflicted. Fixes: lp:1766550 * https://bugs.launchpad.net/kicad/+bug/1766550 --- pcbnew/edit.cpp | 23 +++++++++++++++++++++++ pcbnew/pcb_edit_frame.cpp | 2 ++ 2 files changed, 25 insertions(+) diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 4b81f604ec..1e07c80bff 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1279,6 +1279,29 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_canvas->Refresh(); break; + case ID_POPUP_PCB_SPREAD_ALL_MODULES: + if( !IsOK( this, + _("Not locked footprints inside the board will be moved. OK?") ) ) + break; + // Fall through + case ID_POPUP_PCB_SPREAD_NEW_MODULES: + if( GetBoard()->m_Modules == NULL ) + { + DisplayError( this, _( "No footprint found!" ) ); + return; + } + else + { + MODULE* footprint = GetBoard()->m_Modules; + std::vector footprintList; + for( ; footprint != NULL; footprint = footprint->Next() ) + footprintList.push_back( footprint ); + + SpreadFootprints( &footprintList, id == ID_POPUP_PCB_SPREAD_NEW_MODULES, + true, GetCrossHairPosition() ); + } + break; + default: wxString msg; msg.Printf( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index db6122a0a1..e38fe58c94 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -274,6 +274,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, PCB_EDIT_FRAME::Process_Special_Functions ) + EVT_MENU( ID_POPUP_PCB_SPREAD_ALL_MODULES, PCB_EDIT_FRAME::Process_Special_Functions ) + EVT_MENU( ID_POPUP_PCB_SPREAD_NEW_MODULES, PCB_EDIT_FRAME::Process_Special_Functions ) // User interface update event handlers. EVT_UPDATE_UI( ID_SAVE_BOARD, PCB_EDIT_FRAME::OnUpdateSave )