From f005977aabb12b30408c9a3bb0794daa34c8da8d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 28 Aug 2020 14:01:29 +0100 Subject: [PATCH] Minor simplification to custom colour theme GUI for print/plot dialogs. --- .../dialogs/dialog_print_using_printer.cpp | 2 - .../dialog_print_using_printer_base.cpp | 13 ++-- .../dialog_print_using_printer_base.fbp | 71 ++----------------- .../dialogs/dialog_print_using_printer_base.h | 2 - pcbnew/dialogs/dialog_print_pcbnew.cpp | 22 ++---- 5 files changed, 15 insertions(+), 95 deletions(-) diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 8b8ce244ae..0a1187463e 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -197,7 +197,6 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow() m_colorTheme->SetMinSize( wxSize( minwidth + 50, -1 ) ); - m_lblTheme->Enable( cfg->m_Printing.use_theme ); m_colorTheme->Enable( cfg->m_Printing.use_theme ); // Initialize page specific print setup dialog settings. @@ -226,7 +225,6 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow() void DIALOG_PRINT_USING_PRINTER::OnUseColorThemeChecked( wxCommandEvent& event ) { - m_lblTheme->Enable( m_checkUseColorTheme->GetValue() ); m_colorTheme->Enable( m_checkUseColorTheme->GetValue() ); } diff --git a/eeschema/dialogs/dialog_print_using_printer_base.cpp b/eeschema/dialogs/dialog_print_using_printer_base.cpp index f272b1c174..1001bc8bbb 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.cpp +++ b/eeschema/dialogs/dialog_print_using_printer_base.cpp @@ -32,28 +32,23 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare m_checkBackgroundColor = new wxCheckBox( this, wxID_ANY, _("Print background color"), wxDefaultPosition, wxDefaultSize, 0 ); bleftSizer->Add( m_checkBackgroundColor, 0, wxALL, 5 ); - m_checkUseColorTheme = new wxCheckBox( this, wxID_ANY, _("Use a different color theme for printing"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkUseColorTheme = new wxCheckBox( this, wxID_ANY, _("Use a different color theme for printing:"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkUseColorTheme->SetValue(true); bleftSizer->Add( m_checkUseColorTheme, 0, wxALL, 5 ); wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxHORIZONTAL ); - m_lblTheme = new wxStaticText( this, wxID_ANY, _("Color theme:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_lblTheme->Wrap( -1 ); - m_lblTheme->Enable( false ); - - bSizer4->Add( m_lblTheme, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - wxArrayString m_colorThemeChoices; m_colorTheme = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_colorThemeChoices, 0 ); m_colorTheme->SetSelection( 0 ); m_colorTheme->Enable( false ); + m_colorTheme->SetMinSize( wxSize( 200,-1 ) ); - bSizer4->Add( m_colorTheme, 0, wxALL, 5 ); + bSizer4->Add( m_colorTheme, 0, wxLEFT, 25 ); - bleftSizer->Add( bSizer4, 1, wxEXPAND|wxLEFT, 5 ); + bleftSizer->Add( bSizer4, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( bleftSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 10 ); diff --git a/eeschema/dialogs/dialog_print_using_printer_base.fbp b/eeschema/dialogs/dialog_print_using_printer_base.fbp index 196500ad7c..805426ca19 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.fbp +++ b/eeschema/dialogs/dialog_print_using_printer_base.fbp @@ -294,7 +294,7 @@ 0 0 wxID_ANY - Use a different color theme for printing + Use a different color theme for printing: 0 @@ -328,7 +328,7 @@ 5 - wxEXPAND|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 1 @@ -336,69 +336,8 @@ wxHORIZONTAL none - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - Color theme: - 0 - - 0 - - - 0 - - 1 - m_lblTheme - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALL + 25 + wxLEFT 0 1 @@ -434,7 +373,7 @@ 0 - + 200,-1 1 m_colorTheme 1 diff --git a/eeschema/dialogs/dialog_print_using_printer_base.h b/eeschema/dialogs/dialog_print_using_printer_base.h index 5612deb79d..3ee4a012e3 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.h +++ b/eeschema/dialogs/dialog_print_using_printer_base.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -41,7 +40,6 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM wxCheckBox* m_checkMonochrome; wxCheckBox* m_checkBackgroundColor; wxCheckBox* m_checkUseColorTheme; - wxStaticText* m_lblTheme; wxChoice* m_colorTheme; wxStaticLine* m_staticline1; wxButton* m_buttonPageSetup; diff --git a/pcbnew/dialogs/dialog_print_pcbnew.cpp b/pcbnew/dialogs/dialog_print_pcbnew.cpp index d3974c8fee..1d9e42d9fc 100644 --- a/pcbnew/dialogs/dialog_print_pcbnew.cpp +++ b/pcbnew/dialogs/dialog_print_pcbnew.cpp @@ -99,7 +99,6 @@ private: wxCheckBox* m_checkAsItems; wxCheckBox* m_checkBackground; wxCheckBox* m_checkUseTheme; - wxStaticText* m_lblTheme; wxChoice* m_colorTheme; }; @@ -209,26 +208,19 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions() optionsSizer->Add( m_checkBackground, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 ); m_checkUseTheme = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, - _( "Use a different color theme for printing" ), + _( "Use a different color theme for printing:" ), wxDefaultPosition, wxDefaultSize, 0 ); - optionsSizer->Add( m_checkUseTheme, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 3 ), - wxLEFT | wxRIGHT | wxTOP, 5 ); + optionsSizer->Add( m_checkUseTheme, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 ); - m_checkUseTheme->Bind( - wxEVT_COMMAND_CHECKBOX_CLICKED, &DIALOG_PRINT_PCBNEW::onUseThemeChecked, this ); - - m_lblTheme = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _( "Theme:" ), - wxDefaultPosition, wxDefaultSize, 0 ); - m_lblTheme->Wrap( -1 ); - optionsSizer->Add( m_lblTheme, wxGBPosition( rows, 0 ), wxGBSpan( 1, 1 ), - wxALIGN_CENTER_VERTICAL | wxLEFT, 25 ); + m_checkUseTheme->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &DIALOG_PRINT_PCBNEW::onUseThemeChecked, this ); wxArrayString m_colorThemeChoices; m_colorTheme = new wxChoice( sbOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_colorThemeChoices, 0 ); m_colorTheme->SetSelection( 0 ); - optionsSizer->Add( m_colorTheme, wxGBPosition( rows++, 1 ), wxGBSpan( 1, 2 ), - wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 ); + + optionsSizer->Add( m_colorTheme, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ), + wxALIGN_CENTER_VERTICAL | wxLEFT, 25 ); // Drill marks option auto drillMarksLabel = new wxStaticText( box, wxID_ANY, _( "Drill marks:" ) ); @@ -338,7 +330,6 @@ void DIALOG_PRINT_PCBNEW::onDeselectAllClick( wxCommandEvent& event ) void DIALOG_PRINT_PCBNEW::onUseThemeChecked( wxCommandEvent& event ) { - m_lblTheme->Enable( m_checkUseTheme->GetValue() ); m_colorTheme->Enable( m_checkUseTheme->GetValue() ); } @@ -351,7 +342,6 @@ void DIALOG_PRINT_PCBNEW::onColorModeChanged( wxCommandEvent& event ) m_checkBackground->Enable( !m_settings->m_blackWhite ); m_checkUseTheme->Enable( !m_settings->m_blackWhite ); - m_lblTheme->Enable( !m_settings->m_blackWhite && cfg->m_Printing.use_theme ); m_colorTheme->Enable( !m_settings->m_blackWhite && cfg->m_Printing.use_theme ); }