Commit 655721d9 authored by Maciej Suminski's avatar Maciej Suminski

Added missing changes required for updating footprints with the module editor.

parent 957f959e
......@@ -229,8 +229,6 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
// Check if user wants to edit pad or module properties
if( item->Type() == PCB_MODULE_T )
{
item->ClearFlags(); // Necessary for having an undo entry
for( D_PAD* pad = static_cast<MODULE*>( item )->Pads(); pad; pad = pad->Next() )
{
if( pad->ViewBBox().Contains( getViewControls()->GetCursorPosition() ) )
......@@ -244,6 +242,11 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
std::vector<PICKED_ITEMS_LIST*>& undoList = editFrame->GetScreen()->m_UndoList.m_CommandsList;
// Some of properties dialogs alter pointers, so we should deselect them
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
STATUS_FLAGS flags = item->GetFlags();
item->ClearFlags();
// It is necessary to determine if anything has changed
PICKED_ITEMS_LIST* lastChange = undoList.empty() ? NULL : undoList.back();
......@@ -254,17 +257,15 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
if( lastChange != currentChange ) // Something has changed
{
// Some of properties dialogs alter pointers, so we should deselect them
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear );
processChanges( currentChange );
// Seems unnecessary, as the items are removed/added to the board
// updateRatsnest( true );
// getModel<BOARD>( PCB_T )->GetRatsnest()->Recalculate();
updateRatsnest( true );
getModel<BOARD>( PCB_T )->GetRatsnest()->Recalculate();
m_toolMgr->RunAction( COMMON_ACTIONS::pointEditorUpdate );
}
item->SetFlags( flags );
}
if( unselect )
......@@ -554,6 +555,7 @@ void EDIT_TOOL::processChanges( const PICKED_ITEMS_LIST* aList )
getView(), _1 ) );
getView()->Add( updItem );
updItem->ViewUpdate();
break;
default:
......
......@@ -30,6 +30,7 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <class_draw_panel_gal.h>
#include <confirm.h>
#include <kicad_string.h>
#include <wxPcbStruct.h>
......@@ -44,6 +45,8 @@
#include <dialog_exchange_modules_base.h>
#include <wildcards_and_files_ext.h>
#include <boost/bind.hpp>
static bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName );
class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE
......@@ -470,9 +473,21 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
ITEM_PICKER picker_new( aNewModule, UR_NEW );
aUndoPickList->PushItem( picker_old );
aUndoPickList->PushItem( picker_new );
if( IsGalCanvasActive() )
{
KIGFX::VIEW* view = GetGalCanvas()->GetView();
aOldModule->RunOnChildren( boost::bind( &KIGFX::VIEW::Remove, view, _1 ) );
view->Remove( aOldModule );
aNewModule->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
view->Add( aNewModule );
}
}
else
{
GetGalCanvas()->GetView()->Remove( aOldModule );
aOldModule->DeleteStructure();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment