Simplify Exchange Footprints dialog and add Update mode.

This commit also adds a no-selection-mode, which allows the user
to specify what gets update (through the various match modes).
The no-selection-mode is accessed via the Edit menu, although
it could also be applied to the context menu.

Fixes: lp:1466857
* https://bugs.launchpad.net/kicad/+bug/1466857
This commit is contained in:
Jeff Young 2018-01-12 19:36:15 +00:00 committed by Wayne Stambaugh
parent a99d0c44e1
commit 4c29ab6c09
20 changed files with 7785 additions and 6622 deletions

View File

@ -242,6 +242,12 @@ void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event )
} }
void DIALOG_MODULE_BOARD_EDITOR::UpdateModule( wxCommandEvent& event )
{
EndModal( PRM_EDITOR_WANT_UPDATE_FP );
}
void DIALOG_MODULE_BOARD_EDITOR::ExchangeModule( wxCommandEvent& event ) void DIALOG_MODULE_BOARD_EDITOR::ExchangeModule( wxCommandEvent& event )
{ {
EndModal( PRM_EDITOR_WANT_EXCHANGE_FP ); EndModal( PRM_EDITOR_WANT_EXCHANGE_FP );

View File

@ -55,6 +55,7 @@ public:
enum FP_PRM_EDITOR_RETVALUE enum FP_PRM_EDITOR_RETVALUE
{ {
PRM_EDITOR_ABORT, PRM_EDITOR_ABORT,
PRM_EDITOR_WANT_UPDATE_FP,
PRM_EDITOR_WANT_EXCHANGE_FP, PRM_EDITOR_WANT_EXCHANGE_FP,
PRM_EDITOR_EDIT_OK, PRM_EDITOR_EDIT_OK,
PRM_EDITOR_WANT_MODEDIT PRM_EDITOR_WANT_MODEDIT
@ -86,6 +87,7 @@ private:
BrowseAndAdd3DShapeFile(); BrowseAndAdd3DShapeFile();
} }
void GotoModuleEditor( wxCommandEvent& event ) override; void GotoModuleEditor( wxCommandEvent& event ) override;
void UpdateModule( wxCommandEvent& event ) override;
void ExchangeModule( wxCommandEvent& event ) override; void ExchangeModule( wxCommandEvent& event ) override;
void ModuleOrientEvent( wxCommandEvent& event ) override; void ModuleOrientEvent( wxCommandEvent& event ) override;
void Cfg3DPath( wxCommandEvent& event ) override; void Cfg3DPath( wxCommandEvent& event ) override;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 12 2018) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -125,11 +125,20 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
m_PropRightSizer = new wxBoxSizer( wxVERTICAL ); m_PropRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonExchange = new wxButton( m_PanelProperties, ID_MODULE_PROPERTIES_EXCHANGE, _("Change Footprint(s)"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonUpdate = new wxButton( m_PanelProperties, ID_MODULE_PROPERTIES_UPDATE, _("Update Footprint from Library"), wxDefaultPosition, wxDefaultSize, 0 );
m_PropRightSizer->Add( m_buttonExchange, 0, wxALL|wxEXPAND, 5 ); m_PropRightSizer->Add( m_buttonUpdate, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxHORIZONTAL );
m_buttonExchange = new wxButton( m_PanelProperties, ID_MODULE_PROPERTIES_EXCHANGE, _("Change Footprint"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( m_buttonExchange, 1, wxALL|wxEXPAND, 5 );
m_buttonModuleEditor = new wxButton( m_PanelProperties, ID_GOTO_MODULE_EDITOR, _("Footprint Editor"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonModuleEditor = new wxButton( m_PanelProperties, ID_GOTO_MODULE_EDITOR, _("Footprint Editor"), wxDefaultPosition, wxDefaultSize, 0 );
m_PropRightSizer->Add( m_buttonModuleEditor, 0, wxALL|wxEXPAND, 5 ); bSizer17->Add( m_buttonModuleEditor, 1, wxALL|wxEXPAND, 5 );
m_PropRightSizer->Add( bSizer17, 1, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizerAttrib; wxBoxSizer* bSizerAttrib;
bSizerAttrib = new wxBoxSizer( wxHORIZONTAL ); bSizerAttrib = new wxBoxSizer( wxHORIZONTAL );
@ -179,7 +188,7 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
sbSizerAP->Add( bSizerMoveOpt, 1, wxEXPAND, 5 ); sbSizerAP->Add( bSizerMoveOpt, 1, wxEXPAND, 5 );
m_PropRightSizer->Add( sbSizerAP, 0, wxEXPAND|wxALL, 5 ); m_PropRightSizer->Add( sbSizerAP, 0, wxEXPAND|wxALL, 0 );
wxStaticBoxSizer* sbSizerLocalProperties; wxStaticBoxSizer* sbSizerLocalProperties;
sbSizerLocalProperties = new wxStaticBoxSizer( new wxStaticBox( m_PanelProperties, wxID_ANY, _("Local Settings") ), wxVERTICAL ); sbSizerLocalProperties = new wxStaticBoxSizer( new wxStaticBox( m_PanelProperties, wxID_ANY, _("Local Settings") ), wxVERTICAL );
@ -370,6 +379,7 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
m_button4->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditReference ), NULL, this ); m_button4->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditReference ), NULL, this );
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditValue ), NULL, this ); m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditValue ), NULL, this );
m_OrientCtrl->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this ); m_OrientCtrl->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::UpdateModule ), NULL, this );
m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this ); m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this );
m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this ); m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this );
m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );
@ -387,6 +397,7 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::~DIALOG_MODULE_BOARD_EDITOR_BASE()
m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditReference ), NULL, this ); m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditReference ), NULL, this );
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditValue ), NULL, this ); m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnEditValue ), NULL, this );
m_OrientCtrl->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this ); m_OrientCtrl->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::UpdateModule ), NULL, this );
m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this ); m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this );
m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this ); m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this );
m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this );

View File

@ -1958,11 +1958,11 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag"></property> <property name="flag"></property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_PropRightSizer</property> <property name="name">m_PropRightSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
@ -1971,6 +1971,103 @@
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_MODULE_PROPERTIES_UPDATE</property>
<property name="label">Update Footprint from Library</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonUpdate</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">UpdateModule</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">0</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer17</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="0"> <object class="wxButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -2000,7 +2097,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">ID_MODULE_PROPERTIES_EXCHANGE</property> <property name="id">ID_MODULE_PROPERTIES_EXCHANGE</property>
<property name="label">Change Footprint(s)</property> <property name="label">Change Footprint</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
@ -2058,7 +2155,7 @@
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxButton" expanded="0"> <object class="wxButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -2143,11 +2240,13 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> </object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizerAttrib</property> <property name="name">bSizerAttrib</property>
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
@ -2334,11 +2433,11 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">0</property>
<property name="flag">wxEXPAND|wxALL</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Auto Place</property> <property name="label">Auto Place</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -2347,11 +2446,11 @@
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizerRotOpt</property> <property name="name">bSizerRotOpt</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
@ -2549,11 +2648,11 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizerMoveOpt</property> <property name="name">bSizerMoveOpt</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
@ -2753,11 +2852,11 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Local Settings</property> <property name="label">Local Settings</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -2766,20 +2865,20 @@
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer11</property> <property name="name">bSizer11</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer10</property> <property name="name">bSizer10</property>
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 12 2018) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -40,10 +40,11 @@ class TEXT_CTRL_EVAL;
#define ID_NOTEBOOK 1000 #define ID_NOTEBOOK 1000
#define ID_LISTBOX_ORIENT_SELECT 1001 #define ID_LISTBOX_ORIENT_SELECT 1001
#define ID_MODULE_PROPERTIES_EXCHANGE 1002 #define ID_MODULE_PROPERTIES_UPDATE 1002
#define ID_GOTO_MODULE_EDITOR 1003 #define ID_MODULE_PROPERTIES_EXCHANGE 1003
#define ID_ADD_3D_SHAPE 1004 #define ID_GOTO_MODULE_EDITOR 1004
#define ID_REMOVE_3D_SHAPE 1005 #define ID_ADD_3D_SHAPE 1005
#define ID_REMOVE_3D_SHAPE 1006
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_MODULE_BOARD_EDITOR_BASE /// Class DIALOG_MODULE_BOARD_EDITOR_BASE
@ -76,6 +77,7 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM
wxStaticText* m_YPosUnit; wxStaticText* m_YPosUnit;
wxStaticText* m_TextSheetPath; wxStaticText* m_TextSheetPath;
wxTextCtrl* m_textCtrlSheetPath; wxTextCtrl* m_textCtrlSheetPath;
wxButton* m_buttonUpdate;
wxButton* m_buttonExchange; wxButton* m_buttonExchange;
wxButton* m_buttonModuleEditor; wxButton* m_buttonModuleEditor;
wxRadioBox* m_AttributsCtrl; wxRadioBox* m_AttributsCtrl;
@ -119,6 +121,7 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM
virtual void OnEditReference( wxCommandEvent& event ) { event.Skip(); } virtual void OnEditReference( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditValue( wxCommandEvent& event ) { event.Skip(); } virtual void OnEditValue( wxCommandEvent& event ) { event.Skip(); }
virtual void ModuleOrientEvent( wxCommandEvent& event ) { event.Skip(); } virtual void ModuleOrientEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void UpdateModule( wxCommandEvent& event ) { event.Skip(); }
virtual void ExchangeModule( wxCommandEvent& event ) { event.Skip(); } virtual void ExchangeModule( wxCommandEvent& event ) { event.Skip(); }
virtual void GotoModuleEditor( wxCommandEvent& event ) { event.Skip(); } virtual void GotoModuleEditor( wxCommandEvent& event ) { event.Skip(); }
virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); } virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); }

View File

@ -32,6 +32,7 @@
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <macros.h> #include <macros.h>
#include <board_commit.h> #include <board_commit.h>
#include <bitmaps.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
@ -47,15 +48,21 @@
static bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName ); static bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName );
int DIALOG_EXCHANGE_MODULE::m_selectionMode = 0; int DIALOG_EXCHANGE_MODULE::m_matchModeForUpdate = wxID_MATCH_FP_ALL;
int DIALOG_EXCHANGE_MODULE::m_matchModeForExchange = wxID_MATCH_FP_REF;
int DIALOG_EXCHANGE_MODULE::m_matchModeForUpdateSelected = wxID_MATCH_FP_REF;
int DIALOG_EXCHANGE_MODULE::m_matchModeForExchangeSelected = wxID_MATCH_FP_REF;
DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* parent, MODULE* Module ) : DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* parent, MODULE* Module,
bool updateMode ) :
DIALOG_EXCHANGE_MODULE_BASE( parent ), m_commit( parent ) DIALOG_EXCHANGE_MODULE_BASE( parent ), m_commit( parent )
{ {
m_parent = parent; m_parent = parent;
m_currentModule = Module; m_currentModule = Module;
init(); m_updateMode = updateMode;
init( m_updateMode );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Center(); Center();
@ -64,66 +71,224 @@ DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* parent, MODULE*
void DIALOG_EXCHANGE_MODULE::OnQuit( wxCommandEvent& event ) void DIALOG_EXCHANGE_MODULE::OnQuit( wxCommandEvent& event )
{ {
m_selectionMode = m_Selection->GetSelection();
Show( false ); Show( false );
EndQuasiModal( wxID_CANCEL ); EndQuasiModal( wxID_CANCEL );
} }
void DIALOG_EXCHANGE_MODULE::init() void DIALOG_EXCHANGE_MODULE::init( bool updateMode )
{ {
SetFocus(); SetFocus();
m_CurrentFootprintFPID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) ); // fetch title and mode strings out of the dialog (so they can be easily localized)
m_NewFootprintFPID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) ); wxString title = updateMode ? m_updateModeTitle->GetLabel() : m_exchangeModeTitle->GetLabel();
m_CmpValue->AppendText( m_currentModule->GetValue() ); wxString verb = updateMode ? m_updateModeVerb->GetLabel() : m_exchangeModeVerb->GetLabel();
m_CmpReference->AppendText( m_currentModule->GetReference() ); wxString label;
m_Selection->SetString( 0, wxString::Format( m_localizationSizer->Show( false );
_( "Change footprint of \"%s\"" ),
GetChars( m_currentModule->GetReference() ) ) );
wxString fpname = m_CurrentFootprintFPID->GetValue().AfterLast( ':' );
if( fpname.IsEmpty() ) // Happens for old fp names SetTitle( title );
fpname = m_CurrentFootprintFPID->GetValue();
m_Selection->SetString( 1, wxString::Format( if( updateMode )
_( "Change footprints \"%s\"" ), {
GetChars( fpname.Left( 12 ) ) ) ); label.Printf( m_matchAll->GetLabel(), verb );
m_matchAll->SetLabel( label );
m_Selection->SetSelection( m_selectionMode ); m_middleSizer->Show( false );
}
else
{
m_allSizer->Show( false );
// Enable/disable widgets: if( m_currentModule )
m_newID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
m_newIDBrowseButton->SetBitmap( KiBitmap( library_browse_xpm ) );
}
if( m_currentModule )
{
m_specifiedRefSizer->Show( false );
label.Printf( m_matchCurrentRef->GetLabel(), verb, m_currentModule->GetReference() );
m_matchCurrentRef->SetLabel( label );
m_specifiedValueSizer->Show( false );
label.Printf( m_matchCurrentValue->GetLabel(), verb, m_currentModule->GetValue() );
m_matchCurrentValue->SetLabel( label );
}
else
{
m_currentRefSizer->Show( false );
label.Printf( m_matchSpecifiedRef->GetLabel(), verb );
m_matchSpecifiedRef->SetLabel( label );
m_currentValueSizer->Show( false );
label.Printf( m_matchSpecifiedValue->GetLabel(), verb );
m_matchSpecifiedValue->SetLabel( label );
}
label.Printf( m_matchSpecifiedID->GetLabel(), verb );
m_matchSpecifiedID->SetLabel( label );
if( m_currentModule )
m_specifiedID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
m_specifiedIDBrowseButton->SetBitmap( KiBitmap( library_browse_xpm ) );
// initialize match-mode
wxCommandEvent event; wxCommandEvent event;
OnSelectionClicked( event ); switch( getMatchMode() )
{
case wxID_MATCH_FP_ALL:
if( m_currentModule )
OnMatchRefClicked( event );
else
OnMatchAllClicked( event );
break;
case wxID_MATCH_FP_REF:
OnMatchRefClicked( event );
break;
case wxID_MATCH_FP_VAL:
OnMatchValueClicked( event );
break;
case wxID_MATCH_FP_ID:
OnMatchIDClicked( event );
}
}
int DIALOG_EXCHANGE_MODULE::getMatchMode()
{
if( m_updateMode )
return( m_currentModule ? m_matchModeForUpdateSelected : m_matchModeForUpdate );
else
return( m_currentModule ? m_matchModeForExchangeSelected : m_matchModeForExchange );
}
void DIALOG_EXCHANGE_MODULE::setMatchMode( int aMatchMode )
{
if( m_updateMode )
{
if( m_currentModule )
m_matchModeForUpdateSelected = aMatchMode;
else
m_matchModeForUpdate = aMatchMode;
}
else
{
if( m_currentModule )
m_matchModeForExchangeSelected = aMatchMode;
else
m_matchModeForExchange = aMatchMode;
}
}
bool DIALOG_EXCHANGE_MODULE::isMatch( MODULE* aModule )
{
switch( getMatchMode() )
{
case wxID_MATCH_FP_ALL:
return true;
case wxID_MATCH_FP_REF:
// currentModule case goes through changeCurrentFootprint, so we only have
// to handle specifiedRef case
return aModule->GetReference() == m_specifiedRef->GetValue();
case wxID_MATCH_FP_VAL:
// currentValue must also check FPID so we don't get accidental matches that
// the user didn't intend
if( m_currentModule )
return aModule->GetValue() == m_currentModule->GetValue()
&& aModule->GetFPID() == m_currentModule->GetFPID();
else
return aModule->GetValue() == m_specifiedValue->GetValue();
case wxID_MATCH_FP_ID:
return aModule->GetFPID() == m_specifiedID->GetValue();
}
return false; // just to quiet compiler warnings....
}
wxRadioButton* DIALOG_EXCHANGE_MODULE::getRadioButtonForMode()
{
switch( getMatchMode() )
{
case wxID_MATCH_FP_ALL:
return( m_matchAll );
case wxID_MATCH_FP_REF:
return( m_matchCurrentRef->IsShown() ? m_matchCurrentRef : m_matchSpecifiedRef );
case wxID_MATCH_FP_VAL:
return( m_matchCurrentValue->IsShown() ? m_matchCurrentValue : m_matchSpecifiedValue );
case wxID_MATCH_FP_ID:
return( m_matchSpecifiedID );
default:
return nullptr;
}
}
void DIALOG_EXCHANGE_MODULE::updateMatchModeRadioButtons()
{
wxRadioButton* button = getRadioButtonForMode();
m_matchAll->SetValue( m_matchAll == button );
m_matchCurrentRef->SetValue( m_matchCurrentRef == button );
m_matchSpecifiedRef->SetValue( m_matchSpecifiedRef == button );
m_matchCurrentValue->SetValue( m_matchCurrentValue == button );
m_matchSpecifiedValue->SetValue( m_matchSpecifiedValue == button );
m_matchSpecifiedID->SetValue(m_matchSpecifiedID == button );
}
void DIALOG_EXCHANGE_MODULE::OnMatchAllClicked( wxCommandEvent& event )
{
setMatchMode( wxID_MATCH_FP_ALL );
updateMatchModeRadioButtons();
m_matchAll->SetFocus();
}
void DIALOG_EXCHANGE_MODULE::OnMatchRefClicked( wxCommandEvent& event )
{
setMatchMode( wxID_MATCH_FP_REF );
updateMatchModeRadioButtons();
if( m_specifiedRef->IsShown() && event.GetEventObject() != m_specifiedRef )
m_specifiedRef->SetFocus();
}
void DIALOG_EXCHANGE_MODULE::OnMatchValueClicked( wxCommandEvent& event )
{
setMatchMode( wxID_MATCH_FP_VAL );
updateMatchModeRadioButtons();
if( m_specifiedValue->IsShown() && event.GetEventObject() != m_specifiedValue )
m_specifiedValue->SetFocus();
}
void DIALOG_EXCHANGE_MODULE::OnMatchIDClicked( wxCommandEvent& event )
{
setMatchMode( wxID_MATCH_FP_ID );
updateMatchModeRadioButtons();
if( m_specifiedID->IsShown() && event.GetEventObject() != m_specifiedID )
m_specifiedID->SetFocus();
} }
void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event ) void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event )
{ {
m_selectionMode = m_Selection->GetSelection();
bool result = false; bool result = false;
m_MessageWindow->Clear(); m_MessageWindow->Clear();
m_MessageWindow->Flush(); m_MessageWindow->Flush();
switch( m_Selection->GetSelection() ) if( getMatchMode() == wxID_MATCH_FP_REF && m_currentModule )
{
case 0:
result = changeCurrentFootprint(); result = changeCurrentFootprint();
break; else
result = changeSameFootprints();
case 1:
result = changeSameFootprints( false );
break;
case 2:
result = changeSameFootprints( true );
break;
case 3:
result = changeAllFootprints();
break;
}
if( result ) if( result )
{ {
@ -137,27 +302,6 @@ void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event )
} }
void DIALOG_EXCHANGE_MODULE::OnSelectionClicked( wxCommandEvent& event )
{
bool enable = true;
switch( m_Selection->GetSelection() )
{
case 0:
case 1:
case 2:
break;
case 3:
enable = false;
break;
}
m_NewFootprintFPID->Enable( enable );
m_Browsebutton->Enable( enable );
}
void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event ) void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event )
{ {
wxString msg; wxString msg;
@ -185,52 +329,31 @@ void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event )
bool DIALOG_EXCHANGE_MODULE::changeCurrentFootprint() bool DIALOG_EXCHANGE_MODULE::changeCurrentFootprint()
{ {
wxString newmodulename = m_NewFootprintFPID->GetValue(); if( m_updateMode )
return change_1_Module( m_currentModule, m_currentModule->GetFPID(), true );
if( newmodulename == wxEmptyString ) wxString newFPID = m_newID->GetValue();
if( newFPID == wxEmptyString )
return false; return false;
return change_1_Module( m_currentModule, newmodulename, true ); return change_1_Module( m_currentModule, newFPID, true );
} }
bool DIALOG_EXCHANGE_MODULE::changeSameFootprints( bool aUseValue ) bool DIALOG_EXCHANGE_MODULE::changeSameFootprints()
{ {
wxString msg;
MODULE* Module; MODULE* Module;
MODULE* PtBack; MODULE* PtBack;
bool change = false; bool change = false;
wxString newmodulename = m_NewFootprintFPID->GetValue(); wxString newFPID = m_newID->GetValue();
wxString value; wxString value;
LIB_ID lib_reference;
bool check_module_value = false;
int ShowErr = 3; // Post 3 error messages max. int ShowErr = 3; // Post 3 error messages max.
if( m_parent->GetBoard()->m_Modules == NULL ) if( m_parent->GetBoard()->m_Modules == NULL )
return false; return false;
if( newmodulename == wxEmptyString ) if( !m_updateMode && newFPID == wxEmptyString )
return false;
lib_reference = m_currentModule->GetFPID();
if( aUseValue )
{
check_module_value = true;
value = m_currentModule->GetValue();
msg.Printf( _( "Change footprint %s -> %s (for value = %s)?" ),
GetChars( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) ),
GetChars( newmodulename ),
GetChars( m_currentModule->GetValue() ) );
}
else
{
msg.Printf( _( "Change footprint %s -> %s ?" ),
GetChars( FROM_UTF8( lib_reference.Format().c_str() ) ),
GetChars( newmodulename ) );
}
if( !IsOK( this, msg ) )
return false; return false;
/* The change is done from the last module because /* The change is done from the last module because
@ -245,50 +368,16 @@ bool DIALOG_EXCHANGE_MODULE::changeSameFootprints( bool aUseValue )
{ {
PtBack = Module->Back(); PtBack = Module->Back();
if( lib_reference != Module->GetFPID() ) if( !isMatch( Module ) )
continue; continue;
if( check_module_value ) bool result;
{ if( m_updateMode )
if( value.CmpNoCase( Module->GetValue() ) != 0 ) result = change_1_Module( Module, Module->GetFPID(), ShowErr );
continue; else
} result = change_1_Module( Module, newFPID, ShowErr );
if( change_1_Module( Module, newmodulename, ShowErr ) ) if( result )
change = true;
else if( ShowErr )
ShowErr--;
}
return change;
}
bool DIALOG_EXCHANGE_MODULE::changeAllFootprints()
{
MODULE* Module, * PtBack;
bool change = false;
int ShowErr = 3; // Post 3 error max.
if( m_parent->GetBoard()->m_Modules == NULL )
return false;
if( !IsOK( this, _( "Are you sure you want to change all footprints?" ) ) )
return false;
/* The change is done from the last module because the function
* change_1_Module () modifies the last module in the list
*
* note: for the first module in chain (the last here), Module->Back()
* points the board or is NULL
*/
Module = m_parent->GetBoard()->m_Modules.GetLast();
for( ; Module && ( Module->Type() == PCB_MODULE_T ); Module = PtBack )
{
PtBack = Module->Back();
if( change_1_Module( Module, Module->GetFPID(), ShowErr ) )
change = true; change = true;
else if( ShowErr ) else if( ShowErr )
ShowErr--; ShowErr--;
@ -333,6 +422,8 @@ bool DIALOG_EXCHANGE_MODULE::change_1_Module( MODULE* aModule,
if( aModule == m_currentModule ) if( aModule == m_currentModule )
m_currentModule = newModule; m_currentModule = newModule;
if( aModule == m_parent->GetCurItem() )
m_parent->SetCurItem( newModule );
msg += ": OK"; msg += ": OK";
reporter.Report( msg, REPORTER::RPT_ACTION ); reporter.Report( msg, REPORTER::RPT_ACTION );
@ -382,19 +473,6 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
} }
// Displays the list of available footprints in library name and select a footprint.
void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event )
{
wxString newname;
newname = m_parent->SelectFootprint( m_parent, wxEmptyString, wxEmptyString, wxEmptyString,
Prj().PcbFootprintLibs() );
if( newname != wxEmptyString )
m_NewFootprintFPID->SetValue( newname );
}
void DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint( wxCommandEvent& event ) void DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint( wxCommandEvent& event )
{ {
wxString newname; wxString newname;
@ -403,7 +481,10 @@ void DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint( wxCommandEvent& event )
if( frame->ShowModal( &newname, this ) ) if( frame->ShowModal( &newname, this ) )
{ {
m_NewFootprintFPID->SetValue( newname ); if( event.GetEventObject() == m_newIDBrowseButton )
m_newID->SetValue( newname );
else
m_specifiedID->SetValue( newname );
} }
frame->Destroy(); frame->Destroy();

View File

@ -37,24 +37,37 @@ class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE
private: private:
PCB_EDIT_FRAME* m_parent; PCB_EDIT_FRAME* m_parent;
MODULE* m_currentModule; MODULE* m_currentModule;
static int m_selectionMode; // Remember the last exchange option bool m_updateMode;
static int m_matchModeForUpdate; // remember last match-mode
static int m_matchModeForExchange; // remember last match-mode
static int m_matchModeForUpdateSelected; // remember last match-mode
static int m_matchModeForExchangeSelected; // remember last match-mode
public: public:
DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* aParent, MODULE* aModule ); DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* aParent, MODULE* aModule, bool updateMode );
~DIALOG_EXCHANGE_MODULE() { }; ~DIALOG_EXCHANGE_MODULE() { };
private: private:
void OnSelectionClicked( wxCommandEvent& event ) override; void OnMatchAllClicked( wxCommandEvent& event ) override;
void OnMatchRefClicked( wxCommandEvent& event ) override;
void OnMatchValueClicked( wxCommandEvent& event ) override;
void OnMatchIDClicked( wxCommandEvent& event ) override;
void OnOkClick( wxCommandEvent& event ) override; void OnOkClick( wxCommandEvent& event ) override;
void OnQuit( wxCommandEvent& event ) override; void OnQuit( wxCommandEvent& event ) override;
void BrowseAndSelectFootprint( wxCommandEvent& event ) override;
void ViewAndSelectFootprint( wxCommandEvent& event ) override; void ViewAndSelectFootprint( wxCommandEvent& event ) override;
void RebuildCmpList( wxCommandEvent& event ) override; void RebuildCmpList( wxCommandEvent& event ) override;
void init();
void init( bool updateMode );
int getMatchMode();
void setMatchMode( int aMatchMode );
wxRadioButton* getRadioButtonForMode();
void updateMatchModeRadioButtons();
bool isMatch( MODULE* );
bool changeCurrentFootprint(); bool changeCurrentFootprint();
bool changeSameFootprints( bool aUseValue); bool changeSameFootprints();
bool changeAllFootprints();
bool change_1_Module( MODULE* aModule, bool change_1_Module( MODULE* aModule,
const LIB_ID& aNewFootprintFPID, const LIB_ID& aNewFootprintFPID,
bool eShowError ); bool eShowError );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -15,118 +15,227 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer; wxBoxSizer* mainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL ); mainSizer = new wxBoxSizer( wxVERTICAL );
m_localizationSizer = new wxBoxSizer( wxHORIZONTAL );
m_updateModeTitle = new wxStaticText( this, wxID_ANY, _("Update Footprints from Library"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateModeTitle->Wrap( -1 );
m_localizationSizer->Add( m_updateModeTitle, 0, wxALL, 5 );
m_exchangeModeTitle = new wxStaticText( this, wxID_ANY, _("Change Footprints"), wxDefaultPosition, wxDefaultSize, 0 );
m_exchangeModeTitle->Wrap( -1 );
m_localizationSizer->Add( m_exchangeModeTitle, 0, wxALL, 5 );
m_updateModeVerb = new wxStaticText( this, wxID_ANY, _("Update"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateModeVerb->Wrap( -1 );
m_localizationSizer->Add( m_updateModeVerb, 0, wxALL, 5 );
m_exchangeModeVerb = new wxStaticText( this, wxID_ANY, _("Change"), wxDefaultPosition, wxDefaultSize, 0 );
m_exchangeModeVerb->Wrap( -1 );
m_localizationSizer->Add( m_exchangeModeVerb, 0, wxALL, 5 );
mainSizer->Add( m_localizationSizer, 0, 0, 5 );
wxBoxSizer* bUpperSizer; wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); bUpperSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bLeftSizer; m_allSizer = new wxBoxSizer( wxHORIZONTAL );
bLeftSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextCmpVal = new wxStaticText( this, wxID_ANY, _("Footprint value"), wxDefaultPosition, wxDefaultSize, 0 ); m_matchAll = new wxRadioButton( this, wxID_MATCH_FP_ALL, _("%s all footprints on board"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCmpVal->Wrap( -1 ); m_matchAll->SetValue( true );
bLeftSizer->Add( m_staticTextCmpVal, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_matchAll->SetMinSize( wxSize( -1,26 ) );
m_CmpValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); m_allSizer->Add( m_matchAll, 0, wxALL, 2 );
bLeftSizer->Add( m_CmpValue, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticTexCmpRef = new wxStaticText( this, wxID_ANY, _("Footprint reference"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTexCmpRef->Wrap( -1 );
bLeftSizer->Add( m_staticTexCmpRef, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CmpReference = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
bLeftSizer->Add( m_CmpReference, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bUpperSizer->Add( bLeftSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); bUpperSizer->Add( m_allSizer, 29, wxEXPAND, 5 );
wxBoxSizer* bMiddleSizer; m_currentRefSizer = new wxBoxSizer( wxHORIZONTAL );
bMiddleSizer = new wxBoxSizer( wxVERTICAL );
wxString m_SelectionChoices[] = { _("Change footprint"), _("Change footprints"), _("Change footprints having same value"), _("Update all footprints of the board") }; m_matchCurrentRef = new wxRadioButton( this, wxID_MATCH_FP_REF, _("%s current footprint (%s)"), wxDefaultPosition, wxDefaultSize, 0 );
int m_SelectionNChoices = sizeof( m_SelectionChoices ) / sizeof( wxString ); m_matchCurrentRef->SetMinSize( wxSize( -1,26 ) );
m_Selection = new wxRadioBox( this, ID_SELECTION_CLICKED, _("Options"), wxDefaultPosition, wxDefaultSize, m_SelectionNChoices, m_SelectionChoices, 1, wxRA_SPECIFY_COLS );
m_Selection->SetSelection( 1 ); m_currentRefSizer->Add( m_matchCurrentRef, 0, wxALL, 2 );
bMiddleSizer->Add( m_Selection, 0, wxALL, 5 );
bUpperSizer->Add( bMiddleSizer, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); bUpperSizer->Add( m_currentRefSizer, 31, wxEXPAND, 5 );
wxBoxSizer* bRightSizer; m_specifiedRefSizer = new wxBoxSizer( wxHORIZONTAL );
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonCmpList = new wxButton( this, wxID_ANY, _("Export Footprint Association File"), wxDefaultPosition, wxDefaultSize, 0 ); m_matchSpecifiedRef = new wxRadioButton( this, wxID_MATCH_FP_REF, _("%s footprint with reference:"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonCmpList, 0, wxALL|wxEXPAND, 5 ); m_matchSpecifiedRef->SetMinSize( wxSize( -1,26 ) );
m_Browsebutton = new wxButton( this, wxID_ANY, _("List Footprints"), wxDefaultPosition, wxDefaultSize, 0 ); m_specifiedRefSizer->Add( m_matchSpecifiedRef, 0, wxALL, 2 );
bRightSizer->Add( m_Browsebutton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonFPViewer = new wxButton( this, wxID_ANY, _("View Footprints"), wxDefaultPosition, wxDefaultSize, 0 ); m_specifiedRef = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonFPViewer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); m_specifiedRef->SetMinSize( wxSize( -1,24 ) );
m_specifiedRef->SetMaxSize( wxSize( 80,-1 ) );
m_specifiedRefSizer->Add( m_specifiedRef, 0, wxALL, 3 );
bUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); bUpperSizer->Add( m_specifiedRefSizer, 29, wxEXPAND, 5 );
m_currentValueSizer = new wxBoxSizer( wxHORIZONTAL );
m_matchCurrentValue = new wxRadioButton( this, wxID_MATCH_FP_VAL, _("%s footprints with matching value (%s)"), wxDefaultPosition, wxDefaultSize, 0 );
m_matchCurrentValue->SetMinSize( wxSize( -1,26 ) );
m_currentValueSizer->Add( m_matchCurrentValue, 0, wxALL, 2 );
bMainSizer->Add( bUpperSizer, 0, wxALL|wxEXPAND, 5 ); bUpperSizer->Add( m_currentValueSizer, 31, wxEXPAND, 5 );
m_staticTextCurrFPID = new wxStaticText( this, wxID_ANY, _("Current footprint identifier"), wxDefaultPosition, wxDefaultSize, 0 ); m_specifiedValueSizer = new wxBoxSizer( wxHORIZONTAL );
m_staticTextCurrFPID->Wrap( -1 );
bMainSizer->Add( m_staticTextCurrFPID, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_CurrentFootprintFPID = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); m_matchSpecifiedValue = new wxRadioButton( this, wxID_MATCH_FP_VAL, _("%s footprints with value:"), wxDefaultPosition, wxDefaultSize, 0 );
bMainSizer->Add( m_CurrentFootprintFPID, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_matchSpecifiedValue->SetMinSize( wxSize( -1,26 ) );
m_staticTextNewFPID = new wxStaticText( this, wxID_ANY, _("New footprint identifier"), wxDefaultPosition, wxDefaultSize, 0 ); m_specifiedValueSizer->Add( m_matchSpecifiedValue, 0, wxALL, 2 );
m_staticTextNewFPID->Wrap( -1 );
bMainSizer->Add( m_staticTextNewFPID, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_NewFootprintFPID = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_specifiedValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bMainSizer->Add( m_NewFootprintFPID, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_specifiedValue->SetMinSize( wxSize( 160,24 ) );
m_specifiedValueSizer->Add( m_specifiedValue, 0, wxALL, 3 );
bUpperSizer->Add( m_specifiedValueSizer, 31, wxEXPAND, 5 );
m_specifiedIDSizer = new wxBoxSizer( wxVERTICAL );
m_matchSpecifiedID = new wxRadioButton( this, wxID_MATCH_FP_ID, _("%s footprints with identifier:"), wxDefaultPosition, wxDefaultSize, 0 );
m_specifiedIDSizer->Add( m_matchSpecifiedID, 0, wxALL, 2 );
wxBoxSizer* specifiedIDSizer;
specifiedIDSizer = new wxBoxSizer( wxHORIZONTAL );
m_specifiedID = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_specifiedID->SetMinSize( wxSize( 500,24 ) );
specifiedIDSizer->Add( m_specifiedID, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2 );
m_specifiedIDBrowseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
specifiedIDSizer->Add( m_specifiedIDBrowseButton, 0, wxALL, 0 );
m_specifiedIDSizer->Add( specifiedIDSizer, 0, wxALIGN_TOP|wxEXPAND, 0 );
bUpperSizer->Add( m_specifiedIDSizer, 45, wxEXPAND, 5 );
mainSizer->Add( bUpperSizer, 0, wxALL|wxEXPAND, 5 );
m_middleSizer = new wxBoxSizer( wxVERTICAL );
wxStaticLine* staticline1;
staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_middleSizer->Add( staticline1, 0, wxEXPAND | wxALL, 0 );
wxStaticText* newIdLabel;
newIdLabel = new wxStaticText( this, wxID_ANY, _("New footprint identifier:"), wxDefaultPosition, wxDefaultSize, 0 );
newIdLabel->Wrap( -1 );
m_middleSizer->Add( newIdLabel, 0, wxALL, 2 );
wxBoxSizer* newIDSizer;
newIDSizer = new wxBoxSizer( wxHORIZONTAL );
m_newID = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_newID->SetMinSize( wxSize( 500,24 ) );
newIDSizer->Add( m_newID, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2 );
m_newIDBrowseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
newIDSizer->Add( m_newIDBrowseButton, 0, wxALL, 0 );
m_middleSizer->Add( newIDSizer, 0, wxEXPAND, 0 );
mainSizer->Add( m_middleSizer, 0, wxALL|wxEXPAND, 5 );
m_MessageWindow = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_MessageWindow = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_MessageWindow->SetMinSize( wxSize( -1,300 ) ); m_MessageWindow->SetMinSize( wxSize( -1,300 ) );
bMainSizer->Add( m_MessageWindow, 1, wxEXPAND | wxALL, 5 ); mainSizer->Add( m_MessageWindow, 1, wxALL|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); wxStaticLine* staticline2;
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( staticline2, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerButts; wxBoxSizer* bottomSizer;
bSizerButts = new wxBoxSizer( wxHORIZONTAL ); bottomSizer = new wxBoxSizer( wxHORIZONTAL );
m_Applybutton = new wxButton( this, wxID_OK, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 ); m_exportButton = new wxButton( this, wxID_ANY, _("Export Footprint Associations"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButts->Add( m_Applybutton, 0, wxEXPAND|wxALL, 5 ); bottomSizer->Add( m_exportButton, 0, wxALL, 5 );
m_Quitbutton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); wxBoxSizer* paddingSizer;
bSizerButts->Add( m_Quitbutton, 0, wxALL|wxEXPAND, 5 ); paddingSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText* padding1;
padding1 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
padding1->Wrap( -1 );
paddingSizer->Add( padding1, 1, wxALL, 5 );
bMainSizer->Add( bSizerButts, 0, wxALIGN_RIGHT, 5 ); bottomSizer->Add( paddingSizer, 1, 0, 5 );
m_applyButton = new wxButton( this, wxID_ANY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
bottomSizer->Add( m_applyButton, 0, wxALL, 5 );
m_closeButton = new wxButton( this, wxID_ANY, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bottomSizer->Add( m_closeButton, 0, wxALL, 5 );
this->SetSizer( bMainSizer ); mainSizer->Add( bottomSizer, 0, wxEXPAND, 5 );
this->SetSizer( mainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this ); mainSizer->Fit( this );
// Connect Events // Connect Events
m_Selection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnSelectionClicked ), NULL, this ); m_matchAll->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchAllClicked ), NULL, this );
m_buttonCmpList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::RebuildCmpList ), NULL, this ); m_matchCurrentRef->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchRefClicked ), NULL, this );
m_Browsebutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::BrowseAndSelectFootprint ), NULL, this ); m_matchSpecifiedRef->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchRefClicked ), NULL, this );
m_buttonFPViewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this ); m_specifiedRef->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchRefClicked ), NULL, this );
m_Applybutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this ); m_specifiedRef->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchRefClicked ), NULL, this );
m_Quitbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this ); m_matchCurrentValue->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchValueClicked ), NULL, this );
m_matchSpecifiedValue->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchValueClicked ), NULL, this );
m_specifiedValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchValueClicked ), NULL, this );
m_specifiedValue->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchValueClicked ), NULL, this );
m_matchSpecifiedID->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchIDClicked ), NULL, this );
m_specifiedID->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchIDClicked ), NULL, this );
m_specifiedID->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchIDClicked ), NULL, this );
m_specifiedIDBrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this );
m_newIDBrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this );
m_exportButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::RebuildCmpList ), NULL, this );
m_applyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this );
m_closeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this );
} }
DIALOG_EXCHANGE_MODULE_BASE::~DIALOG_EXCHANGE_MODULE_BASE() DIALOG_EXCHANGE_MODULE_BASE::~DIALOG_EXCHANGE_MODULE_BASE()
{ {
// Disconnect Events // Disconnect Events
m_Selection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnSelectionClicked ), NULL, this ); m_matchAll->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchAllClicked ), NULL, this );
m_buttonCmpList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::RebuildCmpList ), NULL, this ); m_matchCurrentRef->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchRefClicked ), NULL, this );
m_Browsebutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::BrowseAndSelectFootprint ), NULL, this ); m_matchSpecifiedRef->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchRefClicked ), NULL, this );
m_buttonFPViewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this ); m_specifiedRef->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchRefClicked ), NULL, this );
m_Applybutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this ); m_specifiedRef->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchRefClicked ), NULL, this );
m_Quitbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this ); m_matchCurrentValue->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchValueClicked ), NULL, this );
m_matchSpecifiedValue->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchValueClicked ), NULL, this );
m_specifiedValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchValueClicked ), NULL, this );
m_specifiedValue->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchValueClicked ), NULL, this );
m_matchSpecifiedID->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchIDClicked ), NULL, this );
m_specifiedID->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchIDClicked ), NULL, this );
m_specifiedID->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnMatchIDClicked ), NULL, this );
m_specifiedIDBrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this );
m_newIDBrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this );
m_exportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::RebuildCmpList ), NULL, this );
m_applyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this );
m_closeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this );
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -20,17 +20,24 @@ class WX_HTML_REPORT_PANEL;
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/radiobox.h> #include <wx/radiobut.h>
#include <wx/textctrl.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/panel.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/panel.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#define ID_SELECTION_CLICKED 1000 #define wxID_MATCH_FP_ALL 4200
#define wxID_MATCH_FP_REF 4201
#define wxID_MATCH_FP_VAL 4202
#define wxID_MATCH_FP_ID 4203
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EXCHANGE_MODULE_BASE /// Class DIALOG_EXCHANGE_MODULE_BASE
@ -38,37 +45,51 @@ class WX_HTML_REPORT_PANEL;
class DIALOG_EXCHANGE_MODULE_BASE : public DIALOG_SHIM class DIALOG_EXCHANGE_MODULE_BASE : public DIALOG_SHIM
{ {
private: private:
wxButton* m_applyButton;
wxButton* m_closeButton;
protected: protected:
wxStaticText* m_staticTextCmpVal; wxBoxSizer* m_localizationSizer;
wxTextCtrl* m_CmpValue; wxStaticText* m_updateModeTitle;
wxStaticText* m_staticTexCmpRef; wxStaticText* m_exchangeModeTitle;
wxTextCtrl* m_CmpReference; wxStaticText* m_updateModeVerb;
wxRadioBox* m_Selection; wxStaticText* m_exchangeModeVerb;
wxButton* m_buttonCmpList; wxBoxSizer* m_allSizer;
wxButton* m_Browsebutton; wxRadioButton* m_matchAll;
wxButton* m_buttonFPViewer; wxBoxSizer* m_currentRefSizer;
wxStaticText* m_staticTextCurrFPID; wxRadioButton* m_matchCurrentRef;
wxTextCtrl* m_CurrentFootprintFPID; wxBoxSizer* m_specifiedRefSizer;
wxStaticText* m_staticTextNewFPID; wxRadioButton* m_matchSpecifiedRef;
wxTextCtrl* m_NewFootprintFPID; wxTextCtrl* m_specifiedRef;
wxBoxSizer* m_currentValueSizer;
wxRadioButton* m_matchCurrentValue;
wxBoxSizer* m_specifiedValueSizer;
wxRadioButton* m_matchSpecifiedValue;
wxTextCtrl* m_specifiedValue;
wxBoxSizer* m_specifiedIDSizer;
wxRadioButton* m_matchSpecifiedID;
wxTextCtrl* m_specifiedID;
wxBitmapButton* m_specifiedIDBrowseButton;
wxBoxSizer* m_middleSizer;
wxTextCtrl* m_newID;
wxBitmapButton* m_newIDBrowseButton;
WX_HTML_REPORT_PANEL* m_MessageWindow; WX_HTML_REPORT_PANEL* m_MessageWindow;
wxStaticLine* m_staticline1; wxButton* m_exportButton;
wxButton* m_Applybutton;
wxButton* m_Quitbutton;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnSelectionClicked( wxCommandEvent& event ) { event.Skip(); } virtual void OnMatchAllClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void RebuildCmpList( wxCommandEvent& event ) { event.Skip(); } virtual void OnMatchRefClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void BrowseAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); } virtual void OnMatchValueClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMatchIDClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void ViewAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); } virtual void ViewAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void RebuildCmpList( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); } virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Change Footprint"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("%s"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXCHANGE_MODULE_BASE(); ~DIALOG_EXCHANGE_MODULE_BASE();
}; };

View File

@ -852,13 +852,19 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Change_Side_Module( (MODULE*) GetCurItem(), &dc ); Change_Side_Module( (MODULE*) GetCurItem(), &dc );
break; break;
case ID_POPUP_PCB_EXCHANGE_FOOTPRINTS: case ID_POPUP_PCB_UPDATE_FOOTPRINTS:
if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T ) if( GetCurItem() && GetCurItem()->Type() != PCB_MODULE_T )
break; break;
InstallExchangeModuleFrame( (MODULE*) GetCurItem() ); InstallExchangeModuleFrame( (MODULE*) GetCurItem(), true );
// Warning: the current item can be deleted by exchange module m_canvas->MoveCursorToCrossHair();
SetCurItem( NULL ); break;
case ID_POPUP_PCB_EXCHANGE_FOOTPRINTS:
if( GetCurItem() && GetCurItem()->Type() != PCB_MODULE_T )
break;
InstallExchangeModuleFrame( (MODULE*) GetCurItem(), false );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
@ -1236,6 +1242,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Clean_Pcb(); Clean_Pcb();
break; break;
case ID_MENU_PCB_UPDATE_FOOTPRINTS:
InstallExchangeModuleFrame( (MODULE*) nullptr, true );
break;
case ID_MENU_PCB_EXCHANGE_FOOTPRINTS:
InstallExchangeModuleFrame( (MODULE*) nullptr, false );
break;
case ID_MENU_PCB_SWAP_LAYERS: case ID_MENU_PCB_SWAP_LAYERS:
Swap_Layers( event ); Swap_Layers( event );
break; break;

View File

@ -87,11 +87,14 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
editor->Raise(); // Iconize( false ); editor->Raise(); // Iconize( false );
} }
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_UPDATE_FP )
{
InstallExchangeModuleFrame( Module, true );
}
if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP ) if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP )
{ {
InstallExchangeModuleFrame( Module ); InstallExchangeModuleFrame( Module, false );
// Warning: the current item can be deleted by exchange module
SetCurItem( NULL );
} }
} }

View File

@ -488,6 +488,16 @@ void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal )
_( "Set text size and width of footprint fields" ), _( "Set text size and width of footprint fields" ),
KiBitmap( reset_text_xpm ) ); KiBitmap( reset_text_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_UPDATE_FOOTPRINTS,
_( "Update Footprints from Library" ),
_( "Update footprints to include any changes from the library" ),
KiBitmap( reload_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_EXCHANGE_FOOTPRINTS,
_( "Change Footprints" ),
_( "Assign different footprints from the library" ),
KiBitmap( exchange_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_SWAP_LAYERS, AddMenuItem( aParentMenu, ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers" ), _( "&Swap Layers" ),
_( "Swap tracks on copper layers or drawings on other layers" ), _( "Swap tracks on copper layers or drawings on other layers" ),

View File

@ -850,6 +850,9 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_CREATE_ARRAY, AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_CREATE_ARRAY,
msg, KiBitmap( array_xpm ) ); msg, KiBitmap( array_xpm ) );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_UPDATE_FOOTPRINTS,
_( "Update Footprint" ), KiBitmap( reload_xpm ) );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EXCHANGE_FOOTPRINTS, AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EXCHANGE_FOOTPRINTS,
_( "Change Footprint" ), KiBitmap( exchange_xpm ) ); _( "Change Footprint" ), KiBitmap( exchange_xpm ) );
} }

View File

@ -173,6 +173,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_PCB_GLOBAL_DELETE, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_PCB_GLOBAL_DELETE, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_CLEAN, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_CLEAN, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_UPDATE_FOOTPRINTS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_EXCHANGE_FOOTPRINTS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES, EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
PCB_EDIT_FRAME::OnResetModuleTextSizes ) PCB_EDIT_FRAME::OnResetModuleTextSizes )
@ -1278,9 +1280,9 @@ void PCB_EDIT_FRAME::PythonPluginsReload()
} }
int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module ) int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module, bool updateMode )
{ {
DIALOG_EXCHANGE_MODULE dialog( this, Module ); DIALOG_EXCHANGE_MODULE dialog( this, Module, updateMode );
return dialog.ShowQuasiModal(); return dialog.ShowQuasiModal();
} }

View File

@ -67,6 +67,7 @@ enum pcbnew_ids
ID_POPUP_PCB_DELETE_MODULE, ID_POPUP_PCB_DELETE_MODULE,
ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE,
ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE,
ID_POPUP_PCB_UPDATE_FOOTPRINTS,
ID_POPUP_PCB_EXCHANGE_FOOTPRINTS, ID_POPUP_PCB_EXCHANGE_FOOTPRINTS,
ID_POPUP_PCB_EDIT_PAD, ID_POPUP_PCB_EDIT_PAD,
@ -266,6 +267,8 @@ enum pcbnew_ids
ID_MENU_LIST_NETS, ID_MENU_LIST_NETS,
ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
ID_MENU_PCB_CLEAN, ID_MENU_PCB_CLEAN,
ID_MENU_PCB_UPDATE_FOOTPRINTS,
ID_MENU_PCB_EXCHANGE_FOOTPRINTS,
ID_MENU_PCB_SWAP_LAYERS, ID_MENU_PCB_SWAP_LAYERS,
ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,

View File

@ -146,9 +146,14 @@ TOOL_ACTION PCB_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
_( "Delete (Alternative)" ), _( "Deletes selected item(s)" ), delete_xpm, _( "Delete (Alternative)" ), _( "Deletes selected item(s)" ), delete_xpm,
AF_NONE, (void*) REMOVE_FLAGS::ALT ); AF_NONE, (void*) REMOVE_FLAGS::ALT );
TOOL_ACTION PCB_ACTIONS::updateFootprints( "pcbnew.InteractiveEdit.updateFootprints",
AS_GLOBAL, 0,
_( "Update Footprint" ), _( "Update the footprint from the library" ),
reload_xpm );
TOOL_ACTION PCB_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints", TOOL_ACTION PCB_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints",
AS_GLOBAL, 0, AS_GLOBAL, 0,
_( "Exchange Footprint" ), _( "Change the footprint used for modules" ), _( "Change Footprint" ), _( "Assign a different footprint from the library" ),
exchange_xpm ); exchange_xpm );
TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties", TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
@ -313,10 +318,9 @@ bool EDIT_TOOL::Init()
menu.AddItem( PCB_ACTIONS::explodePadToShapes, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty ); menu.AddItem( PCB_ACTIONS::explodePadToShapes, editingModuleCondition && SELECTION_CONDITIONS::NotEmpty );
// Footprint actions // Footprint actions
menu.AddItem( PCB_ACTIONS::editFootprintInFpEditor, menu.AddItem( PCB_ACTIONS::editFootprintInFpEditor, singleModuleCondition );
singleModuleCondition ); menu.AddItem( PCB_ACTIONS::updateFootprints, singleModuleCondition );
menu.AddItem( PCB_ACTIONS::exchangeFootprints, menu.AddItem( PCB_ACTIONS::exchangeFootprints, singleModuleCondition );
singleModuleCondition );
return true; return true;
} }
@ -1100,13 +1104,9 @@ int EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
{ {
const auto& selection = m_selectionTool->RequestSelection( 0, FootprintFilter ); const auto& selection = m_selectionTool->RequestSelection( 0, FootprintFilter );
if( selection.Empty() ) bool updateMode = aEvent.IsAction( &PCB_ACTIONS::updateFootprints );
return 0;
MODULE* mod = selection.FirstOfKind<MODULE> (); MODULE* mod = (selection.Empty() ? nullptr : selection.FirstOfKind<MODULE> () );
if( !mod )
return 0;
frame()->SetCurItem( mod ); frame()->SetCurItem( mod );
@ -1116,14 +1116,10 @@ int EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
// invoke the exchange dialog process // invoke the exchange dialog process
{ {
DIALOG_EXCHANGE_MODULE dialog( frame(), mod ); DIALOG_EXCHANGE_MODULE dialog( frame(), mod, updateMode );
dialog.ShowQuasiModal(); dialog.ShowQuasiModal();
} }
// The current item can be deleted by exchange module, and the
// selection is emptied, so remove current item from frame info area
frame()->SetCurItem( nullptr );
return 0; return 0;
} }
@ -1240,6 +1236,7 @@ void EDIT_TOOL::setTransitions()
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() ); Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
Go( &EDIT_TOOL::editFootprintInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() ); Go( &EDIT_TOOL::editFootprintInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::updateFootprints.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::exchangeFootprints.MakeEvent() ); Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::exchangeFootprints.MakeEvent() );
Go( &EDIT_TOOL::MeasureTool, PCB_ACTIONS::measureTool.MakeEvent() ); Go( &EDIT_TOOL::MeasureTool, PCB_ACTIONS::measureTool.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, PCB_ACTIONS::copyToClipboard.MakeEvent() ); Go( &EDIT_TOOL::copyToClipboard, PCB_ACTIONS::copyToClipboard.MakeEvent() );

View File

@ -128,8 +128,8 @@ public:
/** /**
* Function ExchangeFootprints() * Function ExchangeFootprints()
* *
* Invoke the dialog used to change the footprints used for modules * Invoke the dialog used to update or exchange the footprints used for
* and update module footprints based on result * modules. The mode depends on the PCB_ACTIONS held by the TOOL_EVENT.
*/ */
int ExchangeFootprints( const TOOL_EVENT& aEvent ); int ExchangeFootprints( const TOOL_EVENT& aEvent );

View File

@ -116,6 +116,9 @@ public:
/// Activation of the duplication tool with incrementing (e.g. pad number) /// Activation of the duplication tool with incrementing (e.g. pad number)
static TOOL_ACTION duplicateIncrement; static TOOL_ACTION duplicateIncrement;
/// Update footprints to reflect any changes in the library
static TOOL_ACTION updateFootprints;
/// Exchange footprints of modules /// Exchange footprints of modules
static TOOL_ACTION exchangeFootprints; static TOOL_ACTION exchangeFootprints;

View File

@ -1134,7 +1134,7 @@ public:
*/ */
void Change_Side_Module( MODULE* Module, wxDC* DC ); void Change_Side_Module( MODULE* Module, wxDC* DC );
int InstallExchangeModuleFrame( MODULE* ExchangeModuleModule ); int InstallExchangeModuleFrame( MODULE* ExchangeModuleModule, bool updateMode );
/** /**
* Function Exchange_Module * Function Exchange_Module