Hide scaling hacks on platforms that don't need them.

Fixes https://gitlab.com/kicad/code/kicad/issues/9171
This commit is contained in:
Jeff Young 2021-09-16 23:45:28 +01:00
parent d90094de39
commit 364ecc02ee
7 changed files with 536 additions and 3580 deletions

View File

@ -32,18 +32,76 @@
#include <id.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <widgets/stepped_slider.h>
#include <wx/filedlg.h>
static constexpr int dpi_scaling_precision = 1;
static constexpr double dpi_scaling_increment = 0.5;
/*
* What follows is a whole lot of ugly to handle various platform GUI deficiences with respect
* to light/dark mode, DPI scaling, and other foibles.
*
* Ugly as it all is, it does improve our usability on various platforms.
*/
PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent )
: PANEL_COMMON_SETTINGS_BASE( aParent ),
m_dialog( aDialog ),
m_iconScaleLabel( nullptr ),
m_iconScaleSlider( nullptr ),
m_iconScaleAuto( nullptr ),
m_last_scale( -1 )
{
/*
* Cairo canvas doesn't work on Mac, so no need for fallback anti-aliasing options
*/
#ifdef __WXMAC__
m_antialiasingFallback->Show( false );
m_antialiasingFallbackLabel->Show( false );
#endif
m_textEditorBtn->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_pdfViewerBtn->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
/*
* Automatic dark mode detection works fine on Mac, so no need for the explicit options.
*/
#ifdef __WXMAC__
m_stIconTheme->Show( false );
m_rbIconThemeLight->Show( false );
m_rbIconThemeDark->Show( false );
m_rbIconThemeAuto->Show( false );
#endif
/*
* Automatic icon scaling works fine on Mac. It works mostly fine on MSW, but perhaps not
* uniformly enough to exclude the explicit controls there.
*/
#if defined( __WXGTK__ ) || defined( __WXMSW__ )
// Sadly wxSlider is poorly implemented and adds its legends as sibiling windows (so that
// showing/hiding the control doesn't work). So we have to create it conditionally.
wxWindow* parent = m_sbUserInterface->GetStaticBox();
wxGridBagSizer* gb = m_gbUserInterface;
m_iconScaleLabel = new wxStaticText( parent, wxID_ANY, _( "Icon scale:" ) );
m_iconScaleLabel->Wrap( -1 );
gb->Add( m_iconScaleLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_iconScaleSlider = new STEPPED_SLIDER( parent, wxID_ANY, 100, 50, 275, wxDefaultPosition,
wxDefaultSize, wxSL_HORIZONTAL|wxSL_VALUE_LABEL );
m_iconScaleSlider->SetStep( 25 );
gb->Add( m_iconScaleSlider, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxBOTTOM, 5 );
m_iconScaleAuto = new wxCheckBox( parent, wxID_ANY, _( "Automatic" ) );
gb->Add( m_iconScaleAuto, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
#endif
/*
* Automatic canvas scaling works fine on Mac and MSW, and on GTK under wxWidgets 3.1 or
* better.
*/
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
static constexpr int dpi_scaling_precision = 1;
static constexpr double dpi_scaling_increment = 0.5;
m_canvasScaleCtrl->SetRange( DPI_SCALING::GetMinScaleFactor(),
DPI_SCALING::GetMaxScaleFactor() );
m_canvasScaleCtrl->SetDigits( dpi_scaling_precision );
@ -65,31 +123,108 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aP
"\n\n"
"On some platforms, the automatic value is incorrect and should be "
"set manually." ) );
m_iconScaleSlider->SetStep( 25 );
#ifdef __WXMAC__
// Cairo canvas doesn't work on Mac, so no need for anti-aliasing options
m_antialiasingFallback->Show( false );
m_antialiasingFallbackLabel->Show( false );
#else
m_staticTextCanvasScale->Show( false );
m_canvasScaleCtrl->Show( false );
m_canvasScaleCtrl = nullptr;
m_canvasScaleAuto->Show( false );
#endif
m_textEditorBtn->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_pdfViewerBtn->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
/*
* Font scaling hacks are only needed on GTK under wxWidgets 3.0.
*/
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
m_fontScalingHelp->SetFont( KIUI::GetInfoFont( this ).Italic() );
#else
m_scaleFonts->Show( false );
m_fontScalingHelp->Show( false );
#endif
m_canvasScaleCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnCanvasScaleChange ),
nullptr, this );
if( m_iconScaleSlider )
{
m_iconScaleSlider->Connect( wxEVT_SCROLL_TOP,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_BOTTOM,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_LINEUP,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_LINEDOWN,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_PAGEUP,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_PAGEDOWN,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBTRACK,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBRELEASE,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_CHANGED,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnIconScaleAuto ),
nullptr, this );
}
if( m_canvasScaleCtrl )
{
m_canvasScaleCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnCanvasScaleChange ),
nullptr, this );
}
}
PANEL_COMMON_SETTINGS::~PANEL_COMMON_SETTINGS()
{
m_canvasScaleCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnCanvasScaleChange ),
nullptr, this );
if( m_iconScaleSlider )
{
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_TOP,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_BOTTOM,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_LINEUP,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_LINEDOWN,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_PAGEUP,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_PAGEDOWN,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_THUMBTRACK,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_CHANGED,
wxScrollEventHandler( PANEL_COMMON_SETTINGS::OnScaleSlider ),
nullptr, this );
m_iconScaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnIconScaleAuto ),
nullptr, this );
}
if( m_canvasScaleCtrl )
{
m_canvasScaleCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnCanvasScaleChange ),
nullptr, this );
}
}
@ -120,9 +255,13 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow()
commonSettings->m_Graphics.opengl_aa_mode = m_antialiasing->GetSelection();
commonSettings->m_Graphics.cairo_aa_mode = m_antialiasingFallback->GetSelection();
const int scale_fourths = m_iconScaleAuto->GetValue() ? -1 : m_iconScaleSlider->GetValue() / 25;
commonSettings->m_Appearance.icon_scale = scale_fourths;
if( m_iconScaleSlider )
{
int scale_fourths = m_iconScaleAuto->GetValue() ? -1 : m_iconScaleSlider->GetValue() / 25;
commonSettings->m_Appearance.icon_scale = scale_fourths;
}
if( m_canvasScaleCtrl )
{
DPI_SCALING dpi( commonSettings, this );
dpi.SetDpiConfig( m_canvasScaleAuto->GetValue(), m_canvasScaleCtrl->GetValue() );
@ -193,19 +332,23 @@ void PANEL_COMMON_SETTINGS::applySettingsToPanel( COMMON_SETTINGS& aSettings )
m_Clear3DCacheFilesOlder->SetValue( aSettings.m_System.clear_3d_cache_interval );
int icon_scale_fourths = aSettings.m_Appearance.icon_scale;
if( m_iconScaleSlider )
{
int icon_scale_fourths = aSettings.m_Appearance.icon_scale;
if( icon_scale_fourths <= 0 )
{
m_iconScaleAuto->SetValue( true );
m_iconScaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
m_iconScaleAuto->SetValue( false );
m_iconScaleSlider->SetValue( icon_scale_fourths * 25 );
if( icon_scale_fourths <= 0 )
{
m_iconScaleAuto->SetValue( true );
m_iconScaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
m_iconScaleAuto->SetValue( false );
m_iconScaleSlider->SetValue( icon_scale_fourths * 25 );
}
}
if( m_canvasScaleCtrl )
{
const DPI_SCALING dpi( &aSettings, this );
m_canvasScaleCtrl->SetValue( dpi.GetScaleFactor() );
@ -245,15 +388,18 @@ void PANEL_COMMON_SETTINGS::OnScaleSlider( wxScrollEvent& aEvent )
void PANEL_COMMON_SETTINGS::OnIconScaleAuto( wxCommandEvent& aEvent )
{
if( m_iconScaleAuto->GetValue() )
if( m_iconScaleSlider )
{
m_last_scale = m_iconScaleAuto->GetValue();
m_iconScaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
if( m_last_scale >= 0 )
m_iconScaleSlider->SetValue( m_last_scale );
if( m_iconScaleAuto->GetValue() )
{
m_last_scale = m_iconScaleAuto->GetValue();
m_iconScaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
if( m_last_scale >= 0 )
m_iconScaleSlider->SetValue( m_last_scale );
}
}
}
@ -268,7 +414,7 @@ void PANEL_COMMON_SETTINGS::OnCanvasScaleAuto( wxCommandEvent& aEvent )
{
const bool automatic = m_canvasScaleAuto->GetValue();
if( automatic )
if( automatic && m_canvasScaleCtrl )
{
// set the scale to the auto value, without consulting the config
DPI_SCALING dpi( nullptr, this );

View File

@ -109,83 +109,61 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
bLeftSizer->Add( sizerHelperApps, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerIconsOpts;
sbSizerIconsOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxHORIZONTAL );
m_sbUserInterface = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxVERTICAL );
wxGridBagSizer* gbSizer4;
gbSizer4 = new wxGridBagSizer( 1, 0 );
gbSizer4->SetFlexibleDirection( wxBOTH );
gbSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer4->SetEmptyCellSize( wxSize( -1,5 ) );
m_gbUserInterface = new wxGridBagSizer( 10, 0 );
m_gbUserInterface->SetFlexibleDirection( wxVERTICAL );
m_gbUserInterface->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_stIconTheme = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Icon theme:"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxIconsInMenus = new wxCheckBox( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 );
m_gbUserInterface->Add( m_checkBoxIconsInMenus, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
m_stIconTheme = new wxStaticText( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Icon theme:"), wxDefaultPosition, wxDefaultSize, 0 );
m_stIconTheme->Wrap( -1 );
gbSizer4->Add( m_stIconTheme, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
m_gbUserInterface->Add( m_stIconTheme, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbIconThemeLight = new wxRadioButton( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Light"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbIconThemeLight = new wxRadioButton( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Light"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbIconThemeLight->SetToolTip( _("Use icons designed for light window backgrounds") );
m_rbIconThemeLight->SetMinSize( wxSize( 100,-1 ) );
gbSizer4->Add( m_rbIconThemeLight, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_gbUserInterface->Add( m_rbIconThemeLight, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbIconThemeDark = new wxRadioButton( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Dark"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbIconThemeDark = new wxRadioButton( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Dark"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbIconThemeDark->SetToolTip( _("Use icons designed for dark window backgrounds") );
m_rbIconThemeDark->SetMinSize( wxSize( 100,-1 ) );
gbSizer4->Add( m_rbIconThemeDark, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_gbUserInterface->Add( m_rbIconThemeDark, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbIconThemeAuto = new wxRadioButton( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbIconThemeAuto = new wxRadioButton( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbIconThemeAuto->SetValue( true );
m_rbIconThemeAuto->SetToolTip( _("Automatically choose light or dark icons based on the system color theme") );
gbSizer4->Add( m_rbIconThemeAuto, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
m_gbUserInterface->Add( m_rbIconThemeAuto, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
m_staticTexticonscale = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTexticonscale->Wrap( -1 );
gbSizer4->Add( m_staticTexticonscale, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_iconScaleSlider = new STEPPED_SLIDER( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, 100, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_VALUE_LABEL );
gbSizer4->Add( m_iconScaleSlider, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_iconScaleAuto = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer4->Add( m_iconScaleAuto, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
gbSizer4->Add( 0, 10, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_staticTextCanvasScale = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Canvas scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCanvasScale = new wxStaticText( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Canvas scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCanvasScale->Wrap( -1 );
gbSizer4->Add( m_staticTextCanvasScale, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_gbUserInterface->Add( m_staticTextCanvasScale, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_canvasScaleCtrl = new wxSpinCtrlDouble( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0, 1 );
m_canvasScaleCtrl = new wxSpinCtrlDouble( m_sbUserInterface->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0, 1 );
m_canvasScaleCtrl->SetDigits( 0 );
gbSizer4->Add( m_canvasScaleCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_gbUserInterface->Add( m_canvasScaleCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_canvasScaleAuto = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer4->Add( m_canvasScaleAuto, wxGBPosition( 5, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 5 );
m_canvasScaleAuto = new wxCheckBox( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 );
m_gbUserInterface->Add( m_canvasScaleAuto, wxGBPosition( 3, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 15 );
gbSizer4->Add( 0, 10, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_sbUserInterface->Add( m_gbUserInterface, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_checkBoxIconsInMenus = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer4->Add( m_checkBoxIconsInMenus, wxGBPosition( 7, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 );
m_scaleFonts = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Apply icon scaling to fonts"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer4->Add( m_scaleFonts, wxGBPosition( 8, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
m_sbUserInterface->Add( 0, 10, 0, wxEXPAND, 5 );
m_fontScalingHelp = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("(This workaround will improve some GTK HiDPI font scaling issues.)"), wxDefaultPosition, wxDefaultSize, 0 );
m_scaleFonts = new wxCheckBox( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Apply icon scaling to fonts"), wxDefaultPosition, wxDefaultSize, 0 );
m_sbUserInterface->Add( m_scaleFonts, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_fontScalingHelp = new wxStaticText( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("(This workaround will improve some GTK HiDPI font scaling issues.)"), wxDefaultPosition, wxDefaultSize, 0 );
m_fontScalingHelp->Wrap( -1 );
gbSizer4->Add( m_fontScalingHelp, wxGBPosition( 9, 0 ), wxGBSpan( 1, 5 ), wxLEFT, 5 );
m_sbUserInterface->Add( m_fontScalingHelp, 0, wxLEFT, 8 );
gbSizer4->AddGrowableCol( 1 );
gbSizer4->AddGrowableCol( 2 );
gbSizer4->AddGrowableRow( 0 );
sbSizerIconsOpts->Add( gbSizer4, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bLeftSizer->Add( sbSizerIconsOpts, 1, wxEXPAND|wxALL, 5 );
bLeftSizer->Add( m_sbUserInterface, 1, wxEXPAND|wxALL, 5 );
bPanelSizer->Add( bLeftSizer, 1, wxBOTTOM|wxEXPAND, 5 );
@ -350,16 +328,6 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
m_PDFViewerPath->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this );
m_pdfViewerBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnPDFViewerClick ), NULL, this );
m_pdfViewerBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnIconScaleAuto ), NULL, this );
m_canvasScaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnCanvasScaleAuto ), NULL, this );
}
@ -370,16 +338,6 @@ PANEL_COMMON_SETTINGS_BASE::~PANEL_COMMON_SETTINGS_BASE()
m_PDFViewerPath->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this );
m_pdfViewerBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnPDFViewerClick ), NULL, this );
m_pdfViewerBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_TOP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnIconScaleAuto ), NULL, this );
m_canvasScaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnCanvasScaleAuto ), NULL, this );
}

View File

@ -882,35 +882,102 @@
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">User Interface</property>
<property name="minimum_size"></property>
<property name="name">sbSizerIconsOpts</property>
<property name="orient">wxHORIZONTAL</property>
<property name="name">m_sbUserInterface</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="0">
<property name="empty_cell_size">-1,5</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1,2</property>
<property name="growablerows">0</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size">-1,-1</property>
<property name="flexible_direction">wxVERTICAL</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">gbSizer4</property>
<property name="name">m_gbUserInterface</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="vgap">1</property>
<property name="permission">protected</property>
<property name="vgap">10</property>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show icons in menus</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxIconsInMenus</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxBOTTOM|wxALIGN_CENTER_VERTICAL</property>
<property name="row">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -973,8 +1040,8 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="row">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
@ -1010,7 +1077,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">100,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_rbIconThemeLight</property>
<property name="pane_border">1</property>
@ -1040,8 +1107,8 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="row">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
@ -1077,7 +1144,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">100,-1</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_rbIconThemeDark</property>
<property name="pane_border">1</property>
@ -1104,11 +1171,11 @@
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="border">15</property>
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT</property>
<property name="row">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
@ -1175,222 +1242,8 @@
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Icon scale:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTexticonscale</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxSlider" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maxValue">275</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">50</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_iconScaleSlider</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSL_HORIZONTAL|wxSL_VALUE_LABEL</property>
<property name="subclass">STEPPED_SLIDER; widgets/stepped_slider.h; Not forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">100</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnScroll">OnScaleSlider</event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Automatic</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_iconScaleAuto</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">OnIconScaleAuto</event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxEXPAND</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="spacer" expanded="1">
<property name="height">10</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">5</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1452,8 +1305,8 @@
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="row">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxSpinCtrlDouble" expanded="0">
<property name="BottomDockable">1</property>
@ -1516,11 +1369,11 @@
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="border">15</property>
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT</property>
<property name="row">5</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@ -1583,217 +1436,141 @@
<event name="OnCheckBox">OnCanvasScaleAuto</event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxEXPAND</property>
<property name="row">6</property>
<property name="rowspan">1</property>
<object class="spacer" expanded="1">
<property name="height">10</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
<property name="row">7</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show icons in menus</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxIconsInMenus</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP</property>
<property name="row">8</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Apply icon scaling to fonts</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_scaleFonts</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">5</property>
<property name="column">0</property>
<property name="flag">wxLEFT</property>
<property name="row">9</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">(This workaround will improve some GTK HiDPI font scaling issues.)</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_fontScalingHelp</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">10</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Apply icon scaling to fonts</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_scaleFonts</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">8</property>
<property name="flag">wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">(This workaround will improve some GTK HiDPI font scaling issues.)</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_fontScalingHelp</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>

View File

@ -10,7 +10,6 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "widgets/stepped_slider.h"
#include "widgets/resettable_panel.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -29,7 +28,6 @@
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/radiobut.h>
#include <wx/slider.h>
#include <wx/checkbox.h>
#include <wx/spinctrl.h>
#include <wx/panel.h>
@ -53,17 +51,16 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
wxRadioButton* m_otherPDFViewer;
wxTextCtrl* m_PDFViewerPath;
wxBitmapButton* m_pdfViewerBtn;
wxStaticBoxSizer* m_sbUserInterface;
wxGridBagSizer* m_gbUserInterface;
wxCheckBox* m_checkBoxIconsInMenus;
wxStaticText* m_stIconTheme;
wxRadioButton* m_rbIconThemeLight;
wxRadioButton* m_rbIconThemeDark;
wxRadioButton* m_rbIconThemeAuto;
wxStaticText* m_staticTexticonscale;
STEPPED_SLIDER* m_iconScaleSlider;
wxCheckBox* m_iconScaleAuto;
wxStaticText* m_staticTextCanvasScale;
wxSpinCtrlDouble* m_canvasScaleCtrl;
wxCheckBox* m_canvasScaleAuto;
wxCheckBox* m_checkBoxIconsInMenus;
wxCheckBox* m_scaleFonts;
wxStaticText* m_fontScalingHelp;
wxCheckBox* m_warpMouseOnMove;
@ -93,8 +90,6 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
virtual void OnTextEditorClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateUIPdfPath( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnPDFViewerClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); }
virtual void OnIconScaleAuto( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCanvasScaleAuto( wxCommandEvent& event ) { event.Skip(); }

File diff suppressed because it is too large Load Diff

View File

@ -55,33 +55,58 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
m_System(),
m_NetclassPanel()
{
// This only effect the first time KiCad is run. The user's setting will be used for all
// subsequent runs.
// Menu icons are off by default on OSX and on for all other platforms.
// Use automatic canvas scaling on OSX, but not on the other platforms (their detection
// isn't as good).
#if defined( __WXMAC__ )
bool defaultUseIconsInMenus = false;
double canvasScale = 0.0;
#else
bool defaultUseIconsInMenus = true;
double canvasScale = 1.0;
#endif
m_params.emplace_back( new PARAM<double>( "appearance.canvas_scale",
&m_Appearance.canvas_scale, canvasScale ) );
m_params.emplace_back( new PARAM<int>( "appearance.icon_scale",
&m_Appearance.icon_scale, 0 ) );
/*
* Automatic dark mode detection works fine on Mac.
*/
#if defined( __WXGTK__ ) || defined( __WXMSW__ )
m_params.emplace_back( new PARAM_ENUM<ICON_THEME>( "appearance.icon_theme",
&m_Appearance.icon_theme, ICON_THEME::AUTO, ICON_THEME::LIGHT, ICON_THEME::AUTO ) );
#else
m_Appearance.icon_theme = ICON_THEME::AUTO;
#endif
/*
* Automatic icon scaling works fine on Mac. It works mostly fine on MSW, but perhaps not
* uniformly enough to exclude the explicit controls there.
*/
#if defined( __WXGTK__ ) || defined( __WXMSW__ )
m_params.emplace_back( new PARAM<int>( "appearance.icon_scale",
&m_Appearance.icon_scale, 0 ) );
#else
m_Appearance.icon_scale = 0.0;
#endif
/*
* Automatic canvas scaling works fine on Mac and MSW, and on GTK under wxWidgets 3.1 or
* better.
*/
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
m_params.emplace_back( new PARAM<double>( "appearance.canvas_scale",
&m_Appearance.canvas_scale, 1.0 ) );
#else
m_Appearance.canvas_scale = 0.0;
#endif
/*
* Menu icons are off by default on OSX and on for all other platforms.
*/
#ifdef __WXMAC__
m_params.emplace_back( new PARAM<bool>( "appearance.use_icons_in_menus",
&m_Appearance.use_icons_in_menus, defaultUseIconsInMenus ) );
&m_Appearance.use_icons_in_menus, false ) );
#else
m_params.emplace_back( new PARAM<bool>( "appearance.use_icons_in_menus",
&m_Appearance.use_icons_in_menus, true ) );
#endif
/*
* Font scaling hacks are only needed on GTK under wxWidgets 3.0.
*/
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 1, 0 )
m_params.emplace_back( new PARAM<bool>( "appearance.apply_icon_scale_to_fonts",
&m_Appearance.apply_icon_scale_to_fonts, false ) );
#else
m_Appearance.apply_icon_scale_to_fonts = false;
#endif
m_params.emplace_back( new PARAM<bool>( "auto_backup.enabled", &m_Backup.enabled, true ) );
@ -368,50 +393,44 @@ bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
{
bool ret = true;
ret &= fromLegacy<double>( aCfg, "CanvasScale", "appearance.canvas_scale" );
ret &= fromLegacy<int>( aCfg, "IconScale", "appearance.icon_scale" );
ret &= fromLegacy<bool>( aCfg, "UseIconsInMenus", "appearance.use_icons_in_menus" );
ret &= fromLegacy<double>( aCfg, "CanvasScale", "appearance.canvas_scale" );
ret &= fromLegacy<int>( aCfg, "IconScale", "appearance.icon_scale" );
ret &= fromLegacy<bool>( aCfg, "UseIconsInMenus", "appearance.use_icons_in_menus" );
ret &= fromLegacy<bool>( aCfg, "ShowEnvVarWarningDialog", "environment.show_warning_dialog" );
// Force OSX to automatically scale the canvas. Before v6, the user setting wasn't used on OSX
// and was set to 1.0. In v6, the setting is now used by OSX and should default to automatic
// scaling.
#ifdef __WXMAC__
Set( "appearance.canvas_scale", 0.0 );
#endif
auto load_env_vars =
[&]()
{
wxString key, value;
long index = 0;
nlohmann::json::json_pointer ptr = m_internals->PointerFromString( "environment.vars" );
ret &= fromLegacy<bool>( aCfg, "ShowEnvVarWarningDialog", "environment.show_warning_dialog" );
aCfg->SetPath( "EnvironmentVariables" );
( *m_internals )[ptr] = nlohmann::json( {} );
auto load_env_vars = [&] () {
wxString key, value;
long index = 0;
nlohmann::json::json_pointer ptr = m_internals->PointerFromString( "environment.vars" );
while( aCfg->GetNextEntry( key, index ) )
{
if( envVarBlacklist.count( key ) )
{
wxLogTrace( traceSettings, "Migrate Env: %s is blacklisted; skipping.", key );
continue;
}
aCfg->SetPath( "EnvironmentVariables" );
( *m_internals )[ptr] = nlohmann::json( {} );
value = aCfg->Read( key, wxEmptyString );
while( aCfg->GetNextEntry( key, index ) )
{
if( envVarBlacklist.count( key ) )
{
wxLogTrace( traceSettings, "Migrate Env: %s is blacklisted; skipping.", key );
continue;
}
if( !value.IsEmpty() )
{
ptr.push_back( key.ToStdString() );
value = aCfg->Read( key, wxEmptyString );
wxLogTrace( traceSettings, "Migrate Env: %s=%s", ptr.to_string(), value );
( *m_internals )[ptr] = value.ToUTF8();
if( !value.IsEmpty() )
{
ptr.push_back( key.ToStdString() );
ptr.pop_back();
}
}
wxLogTrace( traceSettings, "Migrate Env: %s=%s", ptr.to_string(), value );
( *m_internals )[ptr] = value.ToUTF8();
ptr.pop_back();
}
}
aCfg->SetPath( ".." );
};
aCfg->SetPath( ".." );
};
load_env_vars();

View File

@ -29,6 +29,7 @@
class COMMON_SETTINGS;
class DIALOG_SHIM;
class STEPPED_SLIDER;
class PANEL_COMMON_SETTINGS : public PANEL_COMMON_SETTINGS_BASE
@ -45,8 +46,8 @@ protected:
void applySettingsToPanel( COMMON_SETTINGS& aSettings );
void OnScaleSlider( wxScrollEvent& aEvent ) override;
void OnIconScaleAuto( wxCommandEvent& aEvent ) override;
void OnScaleSlider( wxScrollEvent& aEvent );
void OnIconScaleAuto( wxCommandEvent& aEvent );
void OnTextEditorClick( wxCommandEvent& event ) override;
void OnPDFViewerClick( wxCommandEvent& event ) override;
void onUpdateUIPdfPath( wxUpdateUIEvent& event ) override;
@ -61,9 +62,14 @@ protected:
*/
void OnCanvasScaleAuto( wxCommandEvent& aEvent ) override;
DIALOG_SHIM* m_dialog;
protected:
DIALOG_SHIM* m_dialog;
int m_last_scale; ///< saved icon scale when Auto selected
wxStaticText* m_iconScaleLabel;
STEPPED_SLIDER* m_iconScaleSlider;
wxCheckBox* m_iconScaleAuto;
int m_last_scale; ///< saved icon scale when Auto selected
};
#endif //KICAD_DIALOG_SUITE_OPTIONS_H