diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 7e1ac35cc2..3c35c39fa3 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -1124,7 +1124,7 @@ public: */ void Change_Side_Module( MODULE* Module, wxDC* DC ); - void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule ); + int InstallExchangeModuleFrame( MODULE* ExchangeModuleModule ); /** * Function Exchange_Module diff --git a/pcbnew/dialogs/dialog_exchange_modules_base.cpp b/pcbnew/dialogs/dialog_exchange_modules_base.cpp index 2341f12063..c0faa9bc3c 100644 --- a/pcbnew/dialogs/dialog_exchange_modules_base.cpp +++ b/pcbnew/dialogs/dialog_exchange_modules_base.cpp @@ -55,14 +55,14 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi wxBoxSizer* bMiddleSizer; bMiddleSizer = new wxBoxSizer( wxVERTICAL ); - wxString m_SelectionChoices[] = { _("Change footprint"), _("Change same footprint"), _("Ch. same footprint+value"), _("Change all") }; + wxString m_SelectionChoices[] = { _("Change footprint"), _("Reload footprint"), _("Change footprint and value"), _("Change all footprints") }; int m_SelectionNChoices = sizeof( m_SelectionChoices ) / sizeof( wxString ); m_Selection = new wxRadioBox( this, ID_SELECTION_CLICKED, _("Options"), wxDefaultPosition, wxDefaultSize, m_SelectionNChoices, m_SelectionChoices, 1, wxRA_SPECIFY_COLS ); m_Selection->SetSelection( 1 ); bMiddleSizer->Add( m_Selection, 0, wxALL, 5 ); - bUpperSizer->Add( bMiddleSizer, 0, 0, 5 ); + bUpperSizer->Add( bMiddleSizer, 0, wxALL, 5 ); wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); @@ -73,33 +73,34 @@ DIALOG_EXCHANGE_MODULE_BASE::DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWi 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 .cmp List"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonCmpList = new wxButton( this, wxID_ANY, _("Export Footprint Association File"), wxDefaultPosition, wxDefaultSize, 0 ); bRightSizer->Add( m_buttonCmpList, 0, wxALL|wxEXPAND, 5 ); - m_Browsebutton = new wxButton( this, wxID_ANY, _("Browse FP List"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Browsebutton = new wxButton( this, wxID_ANY, _("List Footprints"), wxDefaultPosition, wxDefaultSize, 0 ); bRightSizer->Add( m_Browsebutton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - m_buttonFPViewer = new wxButton( this, wxID_ANY, _("FP Viewer"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonFPViewer = new wxButton( this, wxID_ANY, _("View Footprints"), wxDefaultPosition, wxDefaultSize, 0 ); bRightSizer->Add( m_buttonFPViewer, 0, wxALL|wxEXPAND, 5 ); bUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bMainSizer->Add( bUpperSizer, 0, wxEXPAND, 5 ); + bMainSizer->Add( bUpperSizer, 0, wxALL|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( 450,300 ) ); + m_WinMessages->SetMinSize( wxSize( -1,75 ) ); bMainSizer->Add( m_WinMessages, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 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 ); diff --git a/pcbnew/dialogs/dialog_exchange_modules_base.fbp b/pcbnew/dialogs/dialog_exchange_modules_base.fbp index b75d3776bd..c55077ae97 100644 --- a/pcbnew/dialogs/dialog_exchange_modules_base.fbp +++ b/pcbnew/dialogs/dialog_exchange_modules_base.fbp @@ -44,10 +44,10 @@ DIALOG_EXCHANGE_MODULE_BASE - 421,517 + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h - Exchange Footprints + Change Footprint @@ -95,7 +95,7 @@ none 5 - wxEXPAND + wxALL|wxEXPAND 0 @@ -647,7 +647,7 @@ 5 - + wxALL 0 @@ -672,7 +672,7 @@ 1 0 - "Change footprint" "Change same footprint" "Ch. same footprint+value" "Change all" + "Change footprint" "Reload footprint" "Change footprint and value" "Change all footprints" 1 1 @@ -964,7 +964,7 @@ 0 0 wxID_ANY - Export .cmp List + Export Footprint Association File 0 @@ -1052,7 +1052,7 @@ 0 0 wxID_ANY - Browse FP List + List Footprints 0 @@ -1140,7 +1140,7 @@ 0 0 wxID_ANY - FP Viewer + View Footprints 0 @@ -1320,7 +1320,7 @@ 0 - 450,300 + -1,75 1 m_WinMessages 1 diff --git a/pcbnew/dialogs/dialog_exchange_modules_base.h b/pcbnew/dialogs/dialog_exchange_modules_base.h index fa97b2d75a..b28cf192e3 100644 --- a/pcbnew/dialogs/dialog_exchange_modules_base.h +++ b/pcbnew/dialogs/dialog_exchange_modules_base.h @@ -64,7 +64,7 @@ class DIALOG_EXCHANGE_MODULE_BASE : public DIALOG_SHIM public: - DIALOG_EXCHANGE_MODULE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Exchange Footprints"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 421,517 ), 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( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EXCHANGE_MODULE_BASE(); }; diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 96c510ee29..348cf7f61e 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -48,6 +48,7 @@ static bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName ); + class DIALOG_EXCHANGE_MODULE : public DIALOG_EXCHANGE_MODULE_BASE { private: @@ -78,8 +79,10 @@ private: PICKED_ITEMS_LIST m_undoPickList; }; + int DIALOG_EXCHANGE_MODULE::m_selectionMode = 0; + DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* parent, MODULE* Module ) : DIALOG_EXCHANGE_MODULE_BASE( parent ) { @@ -91,12 +94,11 @@ DIALOG_EXCHANGE_MODULE::DIALOG_EXCHANGE_MODULE( PCB_EDIT_FRAME* parent, MODULE* } -void PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module ) +int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module ) { DIALOG_EXCHANGE_MODULE dialog( this, Module ); - int ret = dialog.ShowQuasiModal(); - (void) ret; // make coverity quiet. + return dialog.ShowQuasiModal(); } @@ -263,14 +265,14 @@ bool DIALOG_EXCHANGE_MODULE::changeSameFootprints( bool aUseValue ) { check_module_value = true; value = m_currentModule->GetValue(); - msg.Printf( _( "Change modules %s -> %s (for value = %s)?" ), + 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 modules %s -> %s ?" ), + msg.Printf( _( "Change footprint %s -> %s ?" ), GetChars( FROM_UTF8( lib_reference.Format().c_str() ) ), GetChars( newmodulename ) ); } @@ -325,7 +327,7 @@ bool DIALOG_EXCHANGE_MODULE::changeAllFootprints() if( m_parent->GetBoard()->m_Modules == NULL ) return false; - if( !IsOK( this, _( "Change ALL modules ?" ) ) ) + 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 @@ -482,6 +484,7 @@ void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event ) m_NewModule->SetValue( newname ); } + /* * Displays the footprint viewer to select a footprint. */ @@ -520,7 +523,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() ); - wxFileDialog dlg( this, _( "Save Component Files" ), pro_dir, + wxFileDialog dlg( this, _( "Save Footprint Association File" ), pro_dir, fn.GetFullName(), wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); @@ -537,6 +540,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) } } + bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName ) { FILE* cmpFile;