Preference dialog fixes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10139
This commit is contained in:
Wayne Stambaugh 2021-12-31 14:59:24 -05:00
parent 01d1f8723c
commit d634b33c34
5 changed files with 545 additions and 529 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -18,14 +18,14 @@ PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindow
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Theme:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
bControlSizer->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bControlSizer->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
wxArrayString m_cbThemeChoices;
m_cbTheme = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbThemeChoices, 0 );
m_cbTheme->SetSelection( 0 );
m_cbTheme->SetMinSize( wxSize( 150,-1 ) );
bControlSizer->Add( m_cbTheme, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
bControlSizer->Add( m_cbTheme, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 );
bControlSizer->Add( 0, 0, 1, wxEXPAND, 5 );
@ -33,7 +33,7 @@ PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindow
m_optOverrideColors = new wxCheckBox( this, wxID_ANY, _("Override individual item colors"), wxDefaultPosition, wxDefaultSize, 0 );
m_optOverrideColors->SetToolTip( _("Show all items in their default color even if they have specific colors set in their properties.") );
bControlSizer->Add( m_optOverrideColors, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bControlSizer->Add( m_optOverrideColors, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
bControlSizer->Add( 0, 0, 1, wxEXPAND, 5 );
@ -41,7 +41,7 @@ PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindow
m_btnOpenFolder = new wxButton( this, wxID_ANY, _("Open Theme Folder"), wxDefaultPosition, wxDefaultSize, 0 );
m_btnOpenFolder->SetToolTip( _("Open the folder containing color themes") );
bControlSizer->Add( m_btnOpenFolder, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bControlSizer->Add( m_btnOpenFolder, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_mainSizer->Add( bControlSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
@ -74,12 +74,18 @@ PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindow
m_colorsMainSizer->Add( bottomMargin, 0, wxEXPAND|wxBOTTOM, 3 );
m_previewPanelSizer = new wxBoxSizer( wxVERTICAL );
m_colorsMainSizer->Add( m_previewPanelSizer, 1, wxEXPAND, 5 );
m_mainSizer->Add( m_colorsMainSizer, 1, wxEXPAND|wxLEFT, 5 );
this->SetSizer( m_mainSizer );
this->Layout();
m_mainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_COLOR_SETTINGS_BASE::OnSize ) );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -19,10 +19,10 @@
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/scrolwin.h>
@ -46,8 +46,9 @@ class PANEL_COLOR_SETTINGS_BASE : public RESETTABLE_PANEL
wxBoxSizer* m_colorsMainSizer;
wxScrolledWindow* m_colorsListWindow;
wxFlexGridSizer* m_colorsGridSizer;
wxBoxSizer* m_previewPanelSizer;
// Virtual event handlers, overide them in your derived class
// Virtual event handlers, override them in your derived class
virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnThemeChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLeftDownTheme( wxMouseEvent& event ) { event.Skip(); }
@ -58,7 +59,8 @@ class PANEL_COLOR_SETTINGS_BASE : public RESETTABLE_PANEL
public:
wxCheckBox* m_optOverrideColors;
PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 826,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_COLOR_SETTINGS_BASE();
};

View File

@ -125,4 +125,6 @@ void PANEL_FP_EDITOR_COLOR_SETTINGS::createSwatches()
for( GAL_LAYER_ID layer : galLayers )
createSwatch( layer, LayerName( layer ) );
Layout();
}

View File

@ -454,22 +454,13 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createSwatches()
createSwatch( layer, name );
}
// Give a minimal width to m_colorsListWindow, in order to always having
// a full row shown
int min_width = m_colorsGridSizer->GetMinSize().x;
const int margin = 20; // A margin around the sizer
m_colorsListWindow->SetMinSize( wxSize( min_width + margin, -1 ) );
m_colorsMainSizer->Insert( 0, 10, 0, 0, wxEXPAND, 5 );
m_preview = FOOTPRINT_PREVIEW_PANEL::New( nullptr, this );
m_preview->GetGAL()->SetAxesEnabled( false );
m_colorsMainSizer->Add( 10, 0, 0, wxEXPAND, 5 );
m_colorsMainSizer->Add( m_preview, 1, wxALL | wxEXPAND, 5 );
m_colorsMainSizer->Add( 10, 0, 0, wxEXPAND, 5 );
m_previewPanelSizer->Add( m_preview, 1, wxALL | wxEXPAND, 5 );
createPreviewItems();
Layout();
updatePreview();
zoomFitPreview();
}