From 4da839f30f44a682b40d20ab6bde01814eb3ea86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Wed, 18 Feb 2015 01:01:02 +0100 Subject: [PATCH] groundwork for invoking module editor on selected footprint in GAL mode --- pcbnew/loadcmp.cpp | 11 +++++++++-- pcbnew/modedit.cpp | 4 ++++ pcbnew/xchgmod.cpp | 6 ++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 63034f561c..39c6449428 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -28,6 +28,8 @@ * @brief Footprints selection and loading functions. */ +#include + #include #include #include @@ -61,6 +63,10 @@ static void DisplayCmpDoc( wxString& aName, void* aData ); static FOOTPRINT_LIST MList; +static void clearModuleItemFlags ( BOARD_ITEM *aItem ) +{ + aItem->ClearFlags(); +} bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) { @@ -92,9 +98,10 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) aModule = newModule; - GetBoard()->Add( newModule ); - newModule->ClearFlags(); + newModule->RunOnChildren( boost::bind( &clearModuleItemFlags, _1 ) ); + + GetBoard()->Add( newModule ); // Clear references to any net info, because the footprint editor // does know any thing about nets handled by the current edited board. diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 61951c2795..615a6d9343 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -428,6 +429,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; } + m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true ); + // Create the "new" module MODULE* newmodule = new MODULE( *module_in_edit ); newmodule->SetParent( mainpcb ); @@ -480,6 +483,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) RN_DATA* ratsnest = pcbframe->GetBoard()->GetRatsnest(); ratsnest->Update( newmodule ); ratsnest->Recalculate(); + GetGalCanvas()->ForceRefresh(); } } break; diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index dcaea360dd..19c896be4b 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -45,6 +45,8 @@ #include #include +#include +#include static bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName ); @@ -481,6 +483,10 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule, aNewModule->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) ); view->Add( aNewModule ); + + m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true ); + GetGalCanvas()->ForceRefresh(); + } } else