diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index b4ac65472e..7b852ebc4d 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -172,21 +172,31 @@ void DIALOG_BOARD_SETUP::OnAuxiliaryAction( wxCommandEvent& event ) { BOARD* loadedBoard = m_frame->GetBoard(); - // Check if "Import Settings" board has more layers than the current board. - okToProceed = m_layers->compareCopperLayerCount( loadedBoard, otherBoard ); + // Check if "Import Settings" board has more layers than the current board. + okToProceed = m_layers->CheckCopperLayerCount( loadedBoard, otherBoard ); } } catch( const IO_ERROR& ioe ) { - if( ioe.Problem() != wxT( "CANCEL" ) ) + // You wouldn't think boardFn.GetFullPath() would throw, but we get a stack buffer + // underflow from ASAN. While it's probably an ASAN error, a second try/catch doesn't + // cost us much. + try { - wxString msg = - wxString::Format( _( "Error loading board file:\n%s" ), boardFn.GetFullPath() ); - DisplayErrorMessage( this, msg, ioe.What() ); - } + if( ioe.Problem() != wxT( "CANCEL" ) ) + { + wxString msg = wxString::Format( _( "Error loading board file:\n%s" ), + boardFn.GetFullPath() ); + DisplayErrorMessage( this, msg, ioe.What() ); + } - if( otherPrj != &m_frame->Prj() ) - m_frame->GetSettingsManager()->UnloadProject( otherPrj, false ); + if( otherPrj != &m_frame->Prj() ) + m_frame->GetSettingsManager()->UnloadProject( otherPrj, false ); + } + catch(...) + { + // That was already our best-efforts + } return; } diff --git a/pcbnew/dialogs/dialog_import_settings_base.cpp b/pcbnew/dialogs/dialog_import_settings_base.cpp index 095b3fdc5a..303c2caa53 100644 --- a/pcbnew/dialogs/dialog_import_settings_base.cpp +++ b/pcbnew/dialogs/dialog_import_settings_base.cpp @@ -15,64 +15,79 @@ DIALOG_IMPORT_SETTINGS_BASE::DIALOG_IMPORT_SETTINGS_BASE( wxWindow* parent, wxWi m_MainSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bupperSizer; - bupperSizer = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* bUpperSizer; + bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticText* importFromLabel; importFromLabel = new wxStaticText( this, wxID_ANY, _("Import from:"), wxDefaultPosition, wxDefaultSize, 0 ); importFromLabel->Wrap( -1 ); - bupperSizer->Add( importFromLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + bUpperSizer->Add( importFromLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_filePathCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_filePathCtrl->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the board file location.") ); m_filePathCtrl->SetMinSize( wxSize( 300,-1 ) ); - bupperSizer->Add( m_filePathCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + bUpperSizer->Add( m_filePathCtrl, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_browseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); m_browseButton->SetMinSize( wxSize( 29,29 ) ); - bupperSizer->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + bUpperSizer->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_MainSizer->Add( bupperSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + m_MainSizer->Add( bUpperSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - wxBoxSizer* bmiddleSizer; - bmiddleSizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bMiddleSizer; + bMiddleSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bLeftCol; + bLeftCol = new wxBoxSizer( wxVERTICAL ); wxStaticText* importLabel; importLabel = new wxStaticText( this, wxID_ANY, _("Import:"), wxDefaultPosition, wxDefaultSize, 0 ); importLabel->Wrap( -1 ); - bmiddleSizer->Add( importLabel, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); + bLeftCol->Add( importLabel, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); m_LayersOpt = new wxCheckBox( this, wxID_ANY, _("Layers setup"), wxDefaultPosition, wxDefaultSize, 0 ); - bmiddleSizer->Add( m_LayersOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLeftCol->Add( m_LayersOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_TextAndGraphicsOpt = new wxCheckBox( this, wxID_ANY, _("Text and graphics default properties"), wxDefaultPosition, wxDefaultSize, 0 ); - bmiddleSizer->Add( m_TextAndGraphicsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLeftCol->Add( m_TextAndGraphicsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_ConstraintsOpt = new wxCheckBox( this, wxID_ANY, _("Design rules"), wxDefaultPosition, wxDefaultSize, 0 ); - bmiddleSizer->Add( m_ConstraintsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLeftCol->Add( m_ConstraintsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_TracksAndViasOpt = new wxCheckBox( this, wxID_ANY, _("Predefined track and via dimensions"), wxDefaultPosition, wxDefaultSize, 0 ); - bmiddleSizer->Add( m_TracksAndViasOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLeftCol->Add( m_TracksAndViasOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_MaskAndPasteOpt = new wxCheckBox( this, wxID_ANY, _("Solder mask/paste defaults"), wxDefaultPosition, wxDefaultSize, 0 ); - bmiddleSizer->Add( m_MaskAndPasteOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLeftCol->Add( m_MaskAndPasteOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_SeveritiesOpt = new wxCheckBox( this, wxID_ANY, _("Violation severities"), wxDefaultPosition, wxDefaultSize, 0 ); - bmiddleSizer->Add( m_SeveritiesOpt, 0, wxRIGHT|wxLEFT, 5 ); + bLeftCol->Add( m_SeveritiesOpt, 0, wxRIGHT|wxLEFT, 5 ); m_NetclassesOpt = new wxCheckBox( this, wxID_ANY, _("Net classes"), wxDefaultPosition, wxDefaultSize, 0 ); - bmiddleSizer->Add( m_NetclassesOpt, 0, wxALL, 5 ); + bLeftCol->Add( m_NetclassesOpt, 0, wxALL, 5 ); - m_MainSizer->Add( bmiddleSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + bMiddleSizer->Add( bLeftCol, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); - m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* bRightCol; + bRightCol = new wxBoxSizer( wxVERTICAL ); m_selectAllButton = new wxButton( this, wxID_ANY, _("Select All"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonsSizer->Add( m_selectAllButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 ); + bRightCol->Add( m_selectAllButton, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxALIGN_RIGHT, 10 ); + + + bMiddleSizer->Add( bRightCol, 1, wxEXPAND|wxALL, 20 ); + + + m_MainSizer->Add( bMiddleSizer, 1, wxEXPAND|wxBOTTOM, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + m_MainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL ); m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); diff --git a/pcbnew/dialogs/dialog_import_settings_base.fbp b/pcbnew/dialogs/dialog_import_settings_base.fbp index b469b58043..e6eb75394e 100644 --- a/pcbnew/dialogs/dialog_import_settings_base.fbp +++ b/pcbnew/dialogs/dialog_import_settings_base.fbp @@ -27,7 +27,7 @@ UI 1 0 - + 0 wxAUI_MGR_DEFAULT @@ -53,18 +53,18 @@ - + m_MainSizer wxVERTICAL protected - + 5 wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 - + - bupperSizer + bUpperSizer wxHORIZONTAL none @@ -267,615 +267,695 @@ - - 10 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - + + 5 + wxEXPAND|wxBOTTOM + 1 + - bmiddleSizer - wxVERTICAL + bMiddleSizer + wxHORIZONTAL none - - 5 - wxTOP|wxBOTTOM|wxRIGHT + + 10 + wxEXPAND|wxRIGHT|wxLEFT 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Import: - 0 - - 0 - - - 0 + - 1 - importLabel - 1 - - + bLeftCol + wxVERTICAL none - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 + + 5 + wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Import: + 0 + + 0 + + + 0 + + 1 + importLabel + 1 + + + none + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layers setup + + 0 + + + 0 + + 1 + m_LayersOpt + 1 + + + public + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckboxClicked + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text and graphics default properties + + 0 + + + 0 + + 1 + m_TextAndGraphicsOpt + 1 + + + public + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckboxClicked + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Design rules + + 0 + + + 0 + + 1 + m_ConstraintsOpt + 1 + + + public + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckboxClicked + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Predefined track and via dimensions + + 0 + + + 0 + + 1 + m_TracksAndViasOpt + 1 + + + public + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckboxClicked + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Solder mask/paste defaults + + 0 + + + 0 + + 1 + m_MaskAndPasteOpt + 1 + + + public + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckboxClicked + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Violation severities + + 0 + + + 0 + + 1 + m_SeveritiesOpt + 1 + + + public + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckboxClicked + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Net classes + + 0 + + + 0 + + 1 + m_NetclassesOpt + 1 + + + public + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCheckboxClicked + + - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Layers setup - - 0 - - - 0 + + 20 + wxEXPAND|wxALL + 1 + - 1 - m_LayersOpt - 1 - - - public - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckboxClicked - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Text and graphics default properties - - 0 - - - 0 - - 1 - m_TextAndGraphicsOpt - 1 - - - public - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckboxClicked - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Design rules - - 0 - - - 0 - - 1 - m_ConstraintsOpt - 1 - - - public - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckboxClicked - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Predefined track and via dimensions - - 0 - - - 0 - - 1 - m_TracksAndViasOpt - 1 - - - public - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckboxClicked - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Solder mask/paste defaults - - 0 - - - 0 - - 1 - m_MaskAndPasteOpt - 1 - - - public - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckboxClicked - - - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Violation severities - - 0 - - - 0 - - 1 - m_SeveritiesOpt - 1 - - - public - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckboxClicked - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Net classes - - 0 - - - 0 - - 1 - m_NetclassesOpt - 1 - - - public - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCheckboxClicked + bRightCol + wxVERTICAL + none + + 10 + wxALIGN_CENTER_VERTICAL|wxALL|wxALIGN_RIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Select All + + 0 + + 0 + + + 0 + + 1 + m_selectAllButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSelectAll + + - + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 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 + ; ; forward_declare + 0 + + + + + + + 5 wxEXPAND 0 - + m_buttonsSizer wxHORIZONTAL protected - - 10 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Select All - - 0 - - 0 - - - 0 - - 1 - m_selectAllButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnSelectAll - - 5 wxALL|wxEXPAND diff --git a/pcbnew/dialogs/dialog_import_settings_base.h b/pcbnew/dialogs/dialog_import_settings_base.h index 055d94e9ff..03bb61e03f 100644 --- a/pcbnew/dialogs/dialog_import_settings_base.h +++ b/pcbnew/dialogs/dialog_import_settings_base.h @@ -25,6 +25,7 @@ #include #include #include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -40,8 +41,9 @@ class DIALOG_IMPORT_SETTINGS_BASE : public DIALOG_SHIM wxBoxSizer* m_MainSizer; wxTextCtrl* m_filePathCtrl; wxBitmapButton* m_browseButton; - wxBoxSizer* m_buttonsSizer; wxButton* m_selectAllButton; + wxStaticLine* m_staticline1; + wxBoxSizer* m_buttonsSizer; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; diff --git a/pcbnew/dialogs/panel_setup_layers.cpp b/pcbnew/dialogs/panel_setup_layers.cpp index 8d4a3037cc..b57019d616 100644 --- a/pcbnew/dialogs/panel_setup_layers.cpp +++ b/pcbnew/dialogs/panel_setup_layers.cpp @@ -749,12 +749,14 @@ void PANEL_SETUP_LAYERS::ImportSettingsFrom( BOARD* aBoard ) } -bool PANEL_SETUP_LAYERS::compareCopperLayerCount( BOARD* aWorkingBoard, BOARD* aImportedBoard ) +bool PANEL_SETUP_LAYERS::CheckCopperLayerCount( BOARD* aWorkingBoard, BOARD* aImportedBoard ) { - /* This function warns users if they are going to delete inner copper layers because - they're importing settings from a board with less copper layers than the board - already loaded. We want to return "true" as default on the assumption no layer will - actually be deleted. */ + /* + * This function warns users if they are going to delete inner copper layers because + * they're importing settings from a board with less copper layers than the board + * already loaded. We want to return "true" as default on the assumption no layer will + * actually be deleted. + */ bool okToDeleteCopperLayers = true; // Get the number of copper layers in the loaded board and the "import settings" board diff --git a/pcbnew/dialogs/panel_setup_layers.h b/pcbnew/dialogs/panel_setup_layers.h index f2c152cba6..b481f79bab 100644 --- a/pcbnew/dialogs/panel_setup_layers.h +++ b/pcbnew/dialogs/panel_setup_layers.h @@ -70,7 +70,7 @@ public: * * @return bool - Approval to delete inner copper if needed */ - bool compareCopperLayerCount( BOARD* aWorkingBoard, BOARD* aImportedBoard ); + bool CheckCopperLayerCount( BOARD* aWorkingBoard, BOARD* aImportedBoard ); ///> @return the selected layer mask within the UI checkboxes LSET GetUILayerMask();