groundwork for invoking module editor on selected footprint in GAL mode

This commit is contained in:
Tomasz Włostowski 2015-02-18 01:01:02 +01:00
parent da9fc84421
commit 4da839f30f
3 changed files with 19 additions and 2 deletions

View File

@ -28,6 +28,8 @@
* @brief Footprints selection and loading functions. * @brief Footprints selection and loading functions.
*/ */
#include <boost/bind.hpp>
#include <fctsys.h> #include <fctsys.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <pcb_draw_panel_gal.h> #include <pcb_draw_panel_gal.h>
@ -61,6 +63,10 @@ static void DisplayCmpDoc( wxString& aName, void* aData );
static FOOTPRINT_LIST MList; static FOOTPRINT_LIST MList;
static void clearModuleItemFlags ( BOARD_ITEM *aItem )
{
aItem->ClearFlags();
}
bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) 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; aModule = newModule;
GetBoard()->Add( newModule );
newModule->ClearFlags(); newModule->ClearFlags();
newModule->RunOnChildren( boost::bind( &clearModuleItemFlags, _1 ) );
GetBoard()->Add( newModule );
// Clear references to any net info, because the footprint editor // Clear references to any net info, because the footprint editor
// does know any thing about nets handled by the current edited board. // does know any thing about nets handled by the current edited board.

View File

@ -53,6 +53,7 @@
#include <modview_frame.h> #include <modview_frame.h>
#include <collectors.h> #include <collectors.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/common_actions.h>
#include <dialog_edit_module_for_Modedit.h> #include <dialog_edit_module_for_Modedit.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
@ -428,6 +429,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true );
// Create the "new" module // Create the "new" module
MODULE* newmodule = new MODULE( *module_in_edit ); MODULE* newmodule = new MODULE( *module_in_edit );
newmodule->SetParent( mainpcb ); newmodule->SetParent( mainpcb );
@ -480,6 +483,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
RN_DATA* ratsnest = pcbframe->GetBoard()->GetRatsnest(); RN_DATA* ratsnest = pcbframe->GetBoard()->GetRatsnest();
ratsnest->Update( newmodule ); ratsnest->Update( newmodule );
ratsnest->Recalculate(); ratsnest->Recalculate();
GetGalCanvas()->ForceRefresh();
} }
} }
break; break;

View File

@ -45,6 +45,8 @@
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <tool/tool_manager.h>
#include <tools/common_actions.h>
static bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName ); 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 ) ); aNewModule->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
view->Add( aNewModule ); view->Add( aNewModule );
m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true );
GetGalCanvas()->ForceRefresh();
} }
} }
else else