diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index e3968c5159..90dd783445 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -190,7 +190,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() void DIALOG_MODULE_BOARD_EDITOR::OnCancelClick( wxCommandEvent& event ) { - ENDQUASIMODAL( -1 ); + EndModal( PRM_EDITOR_ABORT ); } @@ -202,17 +202,13 @@ void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event ) m_Parent->OnModify(); } - ENDQUASIMODAL( 2 ); + EndModal( PRM_EDITOR_WANT_MODEDIT ); } void DIALOG_MODULE_BOARD_EDITOR::ExchangeModule( wxCommandEvent& event ) { - m_Parent->InstallExchangeModuleFrame( m_CurrentModule ); - - // Warning: m_CurrentModule was deleted by exchange module - m_Parent->SetCurItem( NULL ); - ENDQUASIMODAL( 0 ); + EndModal( PRM_EDITOR_WANT_EXCHANGE_FP ); } @@ -694,7 +690,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) m_Parent->OnModify(); - ENDQUASIMODAL( 1 ); + EndModal( PRM_EDITOR_EDIT_OK ); if( m_DC ) { diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h index c83b093f82..ae299c9d7a 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h @@ -27,7 +27,6 @@ class DIALOG_MODULE_BOARD_EDITOR: public DIALOG_MODULE_BOARD_EDITOR_BASE { private: - PCB_EDIT_FRAME * m_Parent; wxDC * m_DC; MODULE* m_CurrentModule; @@ -41,7 +40,17 @@ private: static size_t m_page; // remember the last open page during session public: + // The dialog can be closed for several reasons. + // they are listed here: + enum FP_PRM_EDITOR_RETVALUE + { + PRM_EDITOR_ABORT, + PRM_EDITOR_WANT_EXCHANGE_FP, + PRM_EDITOR_EDIT_OK, + PRM_EDITOR_WANT_MODEDIT + }; +public: // Constructor and destructor DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, MODULE* aModule, wxDC* aDC ); ~DIALOG_MODULE_BOARD_EDITOR(); diff --git a/pcbnew/dialogs/dialog_exchange_modules_base.cpp b/pcbnew/dialogs/dialog_exchange_modules_base.cpp index 79bc5cc04d..c20ff83fdd 100644 --- a/pcbnew/dialogs/dialog_exchange_modules_base.cpp +++ b/pcbnew/dialogs/dialog_exchange_modules_base.cpp @@ -22,39 +22,23 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); - m_staticText6 = new wxStaticText( this, wxID_ANY, _("Current footprint"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText6->Wrap( -1 ); - bLeftSizer->Add( m_staticText6, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + m_staticTextCmpVal = new wxStaticText( this, wxID_ANY, _("Component value"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCmpVal->Wrap( -1 ); + bLeftSizer->Add( m_staticTextCmpVal, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_OldModule = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - m_OldModule->SetMaxLength( 0 ); - bLeftSizer->Add( m_OldModule, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + m_CmpValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + m_CmpValue->SetMaxLength( 0 ); + bLeftSizer->Add( m_CmpValue, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_staticText7 = new wxStaticText( this, wxID_ANY, _("Current value"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText7->Wrap( -1 ); - bLeftSizer->Add( m_staticText7, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + m_staticTexCmpRef = new wxStaticText( this, wxID_ANY, _("Component reference"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTexCmpRef->Wrap( -1 ); + bLeftSizer->Add( m_staticTexCmpRef, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_CurrValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - m_CurrValue->SetMaxLength( 0 ); - bLeftSizer->Add( m_CurrValue, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_staticText5 = new wxStaticText( this, wxID_ANY, _("Current reference"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText5->Wrap( -1 ); - bLeftSizer->Add( m_staticText5, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_CurrReference = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); - bLeftSizer->Add( m_CurrReference, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticText8 = new wxStaticText( this, wxID_ANY, _("New footprint"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText8->Wrap( -1 ); - bLeftSizer->Add( m_staticText8, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_NewModule = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_NewModule->SetMaxLength( 0 ); - bLeftSizer->Add( m_NewModule, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + m_CmpReference = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + bLeftSizer->Add( m_CmpReference, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bUpperSizer->Add( bLeftSizer, 1, 0, 5 ); + bUpperSizer->Add( bLeftSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); wxBoxSizer* bMiddleSizer; bMiddleSizer = new wxBoxSizer( wxVERTICAL ); @@ -66,17 +50,11 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi bMiddleSizer->Add( m_Selection, 0, wxALL, 5 ); - bUpperSizer->Add( bMiddleSizer, 0, wxALL, 5 ); + bUpperSizer->Add( bMiddleSizer, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); - m_OKbutton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_OKbutton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_Quitbutton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_Quitbutton, 0, wxALL|wxEXPAND, 5 ); - m_buttonCmpList = new wxButton( this, wxID_ANY, _("Export Footprint Association File"), wxDefaultPosition, wxDefaultSize, 0 ); bRightSizer->Add( m_buttonCmpList, 0, wxALL|wxEXPAND, 5 ); @@ -92,37 +70,67 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi bMainSizer->Add( bUpperSizer, 0, wxALL|wxEXPAND, 5 ); + m_staticTextCurrFPID = new wxStaticText( this, wxID_ANY, _("Current footprint name (FPID)"), wxDefaultPosition, wxDefaultSize, 0 ); + 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_CurrentFootprintFPID->SetMaxLength( 0 ); + bMainSizer->Add( m_CurrentFootprintFPID, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticTextNewFPID = new wxStaticText( this, wxID_ANY, _("New footprint name (FPID)"), wxDefaultPosition, wxDefaultSize, 0 ); + 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_NewFootprintFPID->SetMaxLength( 0 ); + bMainSizer->Add( m_NewFootprintFPID, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextMsg->Wrap( -1 ); bMainSizer->Add( m_staticTextMsg, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_WinMessages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - m_WinMessages->SetMinSize( wxSize( -1,75 ) ); + m_WinMessages->SetMinSize( wxSize( -1,150 ) ); bMainSizer->Add( m_WinMessages, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* bSizerButts; + bSizerButts = new wxBoxSizer( wxHORIZONTAL ); + + m_Applybutton = new wxButton( this, wxID_OK, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButts->Add( m_Applybutton, 0, wxEXPAND|wxALL, 5 ); + + m_Quitbutton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerButts->Add( m_Quitbutton, 0, wxALL|wxEXPAND, 5 ); + + + bMainSizer->Add( bSizerButts, 0, wxALIGN_RIGHT, 5 ); + this->SetSizer( bMainSizer ); this->Layout(); - bMainSizer->Fit( this ); // Connect Events m_Selection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnSelectionClicked ), NULL, this ); - m_OKbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this ); - m_Quitbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this ); m_buttonCmpList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::RebuildCmpList ), NULL, this ); m_Browsebutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::BrowseAndSelectFootprint ), NULL, this ); m_buttonFPViewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this ); + m_Applybutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this ); + m_Quitbutton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this ); } DIALOG_EXCHANGE_MODULE_BASE::~DIALOG_EXCHANGE_MODULE_BASE() { // Disconnect Events m_Selection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnSelectionClicked ), NULL, this ); - m_OKbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this ); - m_Quitbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this ); m_buttonCmpList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::RebuildCmpList ), NULL, this ); m_Browsebutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::BrowseAndSelectFootprint ), NULL, this ); m_buttonFPViewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::ViewAndSelectFootprint ), NULL, this ); + m_Applybutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnOkClick ), NULL, this ); + m_Quitbutton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXCHANGE_MODULE_BASE::OnQuit ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_exchange_modules_base.fbp b/pcbnew/dialogs/dialog_exchange_modules_base.fbp index 48c0d7a497..a624bd592b 100644 --- a/pcbnew/dialogs/dialog_exchange_modules_base.fbp +++ b/pcbnew/dialogs/dialog_exchange_modules_base.fbp @@ -44,7 +44,7 @@ DIALOG_EXCHANGE_MODULE_BASE - -1,-1 + 555,449 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Change Footprint @@ -104,7 +104,7 @@ none 5 - + wxALIGN_CENTER_VERTICAL 1 @@ -143,7 +143,7 @@ 0 0 wxID_ANY - Current footprint + Component value 0 @@ -151,7 +151,7 @@ 0 1 - m_staticText6 + m_staticTextCmpVal 1 @@ -234,7 +234,7 @@ 0 1 - m_OldModule + m_CmpValue 1 @@ -317,7 +317,7 @@ 0 0 wxID_ANY - Current value + Component reference 0 @@ -325,181 +325,7 @@ 0 1 - m_staticText7 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_CurrValue - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Current reference - - 0 - - - 0 - - 1 - m_staticText5 + m_staticTexCmpRef 1 @@ -582,7 +408,7 @@ 0 1 - m_CurrReference + m_CmpReference 1 @@ -633,185 +459,11 @@ - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - New footprint - - 0 - - - 0 - - 1 - m_staticText8 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_NewModule - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL + wxALL|wxALIGN_CENTER_VERTICAL 0 @@ -919,182 +571,6 @@ bRightSizer wxVERTICAL none - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_OK - OK - - 0 - - - 0 - - 1 - m_OKbutton - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnOkClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Close - - 0 - - - 0 - - 1 - m_Quitbutton - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnQuit - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxALL|wxEXPAND @@ -1363,6 +839,354 @@ + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Current footprint name (FPID) + + 0 + + + 0 + + 1 + m_staticTextCurrFPID + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_CurrentFootprintFPID + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_READONLY + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + New footprint name (FPID) + + 0 + + + 0 + + 1 + m_staticTextNewFPID + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_NewFootprintFPID + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxTOP|wxRIGHT|wxLEFT @@ -1484,7 +1308,7 @@ 0 - -1,75 + -1,150 1 m_WinMessages 1 @@ -1537,6 +1361,274 @@ + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + + bSizerButts + wxHORIZONTAL + none + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_OK + Apply + + 0 + + + 0 + + 1 + m_Applybutton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnOkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_CANCEL + Close + + 0 + + + 0 + + 1 + m_Quitbutton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnQuit + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_exchange_modules_base.h b/pcbnew/dialogs/dialog_exchange_modules_base.h index cfae35ae5a..ee1075e88c 100644 --- a/pcbnew/dialogs/dialog_exchange_modules_base.h +++ b/pcbnew/dialogs/dialog_exchange_modules_base.h @@ -24,6 +24,7 @@ class DIALOG_SHIM; #include #include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -38,35 +39,36 @@ class DIALOG_EXCHANGE_MODULE_BASE : public DIALOG_SHIM private: protected: - wxStaticText* m_staticText6; - wxTextCtrl* m_OldModule; - wxStaticText* m_staticText7; - wxTextCtrl* m_CurrValue; - wxStaticText* m_staticText5; - wxTextCtrl* m_CurrReference; - wxStaticText* m_staticText8; - wxTextCtrl* m_NewModule; + wxStaticText* m_staticTextCmpVal; + wxTextCtrl* m_CmpValue; + wxStaticText* m_staticTexCmpRef; + wxTextCtrl* m_CmpReference; wxRadioBox* m_Selection; - wxButton* m_OKbutton; - wxButton* m_Quitbutton; wxButton* m_buttonCmpList; wxButton* m_Browsebutton; wxButton* m_buttonFPViewer; + wxStaticText* m_staticTextCurrFPID; + wxTextCtrl* m_CurrentFootprintFPID; + wxStaticText* m_staticTextNewFPID; + wxTextCtrl* m_NewFootprintFPID; wxStaticText* m_staticTextMsg; wxTextCtrl* m_WinMessages; + wxStaticLine* m_staticline1; + wxButton* m_Applybutton; + wxButton* m_Quitbutton; // Virtual event handlers, overide them in your derived class virtual void OnSelectionClicked( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); } virtual void RebuildCmpList( wxCommandEvent& event ) { event.Skip(); } virtual void BrowseAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); } virtual void ViewAndSelectFootprint( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); } 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 = _("Change Footprint"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 555,449 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EXCHANGE_MODULE_BASE(); }; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 8335d0415c..41c5a0d4ea 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -831,6 +831,16 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) Change_Side_Module( (MODULE*) GetCurItem(), &dc ); break; + case ID_POPUP_PCB_EXCHANGE_FOOTPRINTS: + if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T ) + break; + + InstallExchangeModuleFrame( (MODULE*) GetCurItem() ); + // Warning: the current item can be deleted by exchange module + SetCurItem( NULL ); + m_canvas->MoveCursorToCrossHair(); + break; + case ID_POPUP_PCB_EDIT_MODULE_PRMS: // If the current Item is a pad, text module ...: Get its parent if( GetCurItem()->Type() != PCB_MODULE_T ) diff --git a/pcbnew/editmod.cpp b/pcbnew/editmod.cpp index 1046888e53..b2c9dc0691 100644 --- a/pcbnew/editmod.cpp +++ b/pcbnew/editmod.cpp @@ -51,29 +51,30 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) if( Module == NULL ) return; -#ifndef __WXMAC__ - DIALOG_MODULE_BOARD_EDITOR* dialog = new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC ); -#else +#ifdef __WXMAC__ // avoid Avoid "writes" in the dialog, creates errors with WxOverlay and NSView & Modal // Raising an Exception - Fixes #764678 - DIALOG_MODULE_BOARD_EDITOR* dialog = new DIALOG_MODULE_BOARD_EDITOR( this, Module, NULL ); + DC = NULL; #endif - int retvalue = dialog->SHOWQUASIMODAL(); /* retvalue = - * -1 if abort, - * 0 if exchange module, - * 1 for normal edition - * and 2 for a goto editor command - */ - dialog->Destroy(); + DIALOG_MODULE_BOARD_EDITOR* dlg = new DIALOG_MODULE_BOARD_EDITOR( this, Module, DC ); + + int retvalue = dlg->ShowModal(); + /* retvalue = + * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_ABORT if abort, + * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_EXCHANGE_FP if exchange module, + * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_EDIT_OK for normal edition + * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_MODEDIT for a goto editor command + */ + dlg->Destroy(); #ifdef __WXMAC__ // If something edited, push a refresh request - if( retvalue == 0 || retvalue == 1 ) + if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_EDIT_OK ) m_canvas->Refresh(); #endif - if( retvalue == 2 ) + if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_MODEDIT ) { FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true ); @@ -83,6 +84,13 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) editor->Show( true ); editor->Raise(); // Iconize( false ); } + + if( retvalue == DIALOG_MODULE_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP ) + { + InstallExchangeModuleFrame( Module ); + // Warning: the current item can be deleted by exchange module + SetCurItem( NULL ); + } } diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 52098031e5..8675bdfd1b 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -808,21 +808,6 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_MOVE_MODULE_REQUEST, msg, KiBitmap( move_module_xpm ) ); - msg = AddHotkeyName( _( "Duplicate Footprint" ), g_Board_Editor_Hokeys_Descr, - HK_DUPLICATE_ITEM ); - AddMenuItem( menu, ID_POPUP_PCB_DUPLICATE_ITEM, - msg, KiBitmap( duplicate_module_xpm ) ); - - msg = AddHotkeyName( _("Move Footprint Exactly" ), g_Board_Editor_Hokeys_Descr, - HK_MOVE_ITEM_EXACT ); - AddMenuItem( menu, ID_POPUP_PCB_MOVE_EXACT, - msg, KiBitmap( move_module_xpm ) ); - - msg = AddHotkeyName( _("Create Footprint Array" ), g_Board_Editor_Hokeys_Descr, - HK_CREATE_ARRAY ); - AddMenuItem( menu, ID_POPUP_PCB_CREATE_ARRAY, - msg, KiBitmap( array_module_xpm ) ); - msg = AddHotkeyName( _( "Drag" ), g_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM ); AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DRAG_MODULE_REQUEST, msg, KiBitmap( drag_module_xpm ) ); @@ -855,6 +840,26 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu g_Board_Editor_Hokeys_Descr, HK_DELETE ); AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE, msg, KiBitmap( delete_module_xpm ) ); + + sub_menu_footprint->AppendSeparator(); + + msg = AddHotkeyName( _("Move Footprint Exactly" ), g_Board_Editor_Hokeys_Descr, + HK_MOVE_ITEM_EXACT ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_MOVE_EXACT, + msg, KiBitmap( move_module_xpm ) ); + + msg = AddHotkeyName( _( "Duplicate Footprint" ), g_Board_Editor_Hokeys_Descr, + HK_DUPLICATE_ITEM ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DUPLICATE_ITEM, + msg, KiBitmap( duplicate_module_xpm ) ); + + msg = AddHotkeyName( _("Create Footprint Array" ), g_Board_Editor_Hokeys_Descr, + HK_CREATE_ARRAY ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_CREATE_ARRAY, + msg, KiBitmap( array_module_xpm ) ); + + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EXCHANGE_FOOTPRINTS, + _( "Exchange Footprint(s)" ), KiBitmap( import_module_xpm ) ); } } diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 6fd8bb6709..9b7aa94eca 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -61,6 +61,7 @@ enum pcbnew_ids ID_POPUP_PCB_DELETE_MODULE, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE, + ID_POPUP_PCB_EXCHANGE_FOOTPRINTS, ID_POPUP_PCB_EDIT_PAD, ID_POPUP_PCB_EDIT_MORE_PAD, diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 9070091667..09d6532da0 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -91,6 +91,7 @@ DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* parent, MODULE* init(); GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); + Center(); } @@ -114,17 +115,17 @@ void DIALOG_EXCHANGE_MODULE::init() { SetFocus(); - m_OldModule->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) ); - m_NewModule->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) ); - m_CurrValue->AppendText( m_currentModule->GetValue() ); - m_CurrReference->AppendText( m_currentModule->GetReference() ); + m_CurrentFootprintFPID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) ); + m_NewFootprintFPID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) ); + m_CmpValue->AppendText( m_currentModule->GetValue() ); + m_CmpReference->AppendText( m_currentModule->GetReference() ); m_Selection->SetString( 0, wxString::Format( _("Change footprint of '%s'" ), GetChars( m_currentModule->GetReference() ) ) ); - wxString fpname = m_OldModule->GetValue().AfterLast(':'); + wxString fpname = m_CurrentFootprintFPID->GetValue().AfterLast(':'); if( fpname.IsEmpty() ) // Happens for old fp names - fpname = m_OldModule->GetValue(); + fpname = m_CurrentFootprintFPID->GetValue(); m_Selection->SetString( 1, wxString::Format( _("Change footprints '%s'" ), @@ -192,7 +193,7 @@ void DIALOG_EXCHANGE_MODULE::OnSelectionClicked( wxCommandEvent& event ) break; } - m_NewModule->Enable( enable ); + m_NewFootprintFPID->Enable( enable ); m_Browsebutton->Enable( enable ); } @@ -234,7 +235,7 @@ void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event ) */ bool DIALOG_EXCHANGE_MODULE::changeCurrentFootprint() { - wxString newmodulename = m_NewModule->GetValue(); + wxString newmodulename = m_NewFootprintFPID->GetValue(); if( newmodulename == wxEmptyString ) return false; @@ -260,7 +261,7 @@ bool DIALOG_EXCHANGE_MODULE::changeSameFootprints( bool aUseValue ) MODULE* Module; MODULE* PtBack; bool change = false; - wxString newmodulename = m_NewModule->GetValue(); + wxString newmodulename = m_NewFootprintFPID->GetValue(); wxString value; FPID lib_reference; bool check_module_value = false; @@ -483,9 +484,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule, } -/* - * Displays the list of modules in library name and select a footprint. - */ +// Displays the list of available footprints in library name and select a footprint. void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event ) { wxString newname; @@ -494,13 +493,11 @@ void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event ) Prj().PcbFootprintLibs() ); if( newname != wxEmptyString ) - m_NewModule->SetValue( newname ); + m_NewFootprintFPID->SetValue( newname ); } -/* - * Displays the footprint viewer to select a footprint. - */ +// Runs the footprint viewer to select a footprint. void DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint( wxCommandEvent& event ) { wxString newname; @@ -509,7 +506,7 @@ void DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint( wxCommandEvent& event ) if( frame->ShowModal( &newname, this ) ) { - m_NewModule->SetValue( newname ); + m_NewFootprintFPID->SetValue( newname ); } frame->Destroy();