From 66eb84097a7019b0cabd89d3c3ec339e9a1d973c Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 5 May 2020 21:44:00 -0400 Subject: [PATCH] Auto-size theme list --- common/dialogs/panel_color_settings.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/dialogs/panel_color_settings.cpp b/common/dialogs/panel_color_settings.cpp index 7c4c1abd08..aa81de0b40 100644 --- a/common/dialogs/panel_color_settings.cpp +++ b/common/dialogs/panel_color_settings.cpp @@ -163,6 +163,12 @@ void PANEL_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event ) void PANEL_COLOR_SETTINGS::createThemeList( const wxString& aCurrent ) { + int width = 0; + int height = 0; + + m_cbTheme->GetTextExtent( _( "New Theme..." ), &width, &height ); + int minwidth = width; + m_cbTheme->Clear(); for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() ) @@ -171,10 +177,15 @@ void PANEL_COLOR_SETTINGS::createThemeList( const wxString& aCurrent ) if( settings->GetFilename() == aCurrent ) m_cbTheme->SetSelection( pos ); + + m_cbTheme->GetTextExtent( settings->GetName(), &width, &height ); + minwidth = std::max( minwidth, width ); } m_cbTheme->Append( wxT( "---" ) ); m_cbTheme->Append( _( "New Theme..." ) ); + + m_cbTheme->SetMinSize( wxSize( minwidth + 50, -1 ) ); }