Added common option to hide scrollbars

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9093
This commit is contained in:
aris-kimi 2022-08-21 15:39:55 +03:00
parent 6b2427f858
commit 7bd8cfd7f9
8 changed files with 190 additions and 84 deletions

View File

@ -84,15 +84,17 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aP
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 );
gb->Add( m_iconScaleLabel, wxGBPosition( 3, 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 );
gb->Add( m_iconScaleSlider, wxGBPosition( 3, 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 );
gb->Add( m_iconScaleAuto, wxGBPosition( 3, 3 ),
wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
#endif
/*
@ -284,6 +286,8 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow()
commonSettings->m_Appearance.use_icons_in_menus = m_checkBoxIconsInMenus->GetValue();
commonSettings->m_Appearance.apply_icon_scale_to_fonts = m_scaleFonts->GetValue();
commonSettings->m_Appearance.show_scrollbars = m_showScrollbars->GetValue();
double dimmingPercent = 80;
m_highContrastCtrl->GetValue().ToDouble( &dimmingPercent );
commonSettings->m_Appearance.hicontrast_dimming_factor = dimmingPercent / 100.0f;
@ -391,6 +395,8 @@ void PANEL_COMMON_SETTINGS::applySettingsToPanel( COMMON_SETTINGS& aSettings )
m_backupLimitDailyFiles->SetValue( aSettings.m_Backup.limit_daily_files );
m_backupMinInterval->SetValue( aSettings.m_Backup.min_interval / 60 );
m_backupLimitTotalSize->SetValue( aSettings.m_Backup.limit_total_size / ( 1024 * 1024 ) );
m_showScrollbars->SetValue( aSettings.m_Appearance.show_scrollbars );
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -115,39 +115,51 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
m_gbUserInterface->SetFlexibleDirection( wxVERTICAL );
m_gbUserInterface->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxBoxSizer* bSizer81;
bSizer81 = new wxBoxSizer( wxVERTICAL );
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 );
bSizer81->Add( m_checkBoxIconsInMenus, 0, wxALIGN_LEFT|wxBOTTOM, 5 );
m_showScrollbars = new wxCheckBox( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Show scrollbars in editors"), wxDefaultPosition, wxDefaultSize, 0 );
m_showScrollbars->SetValue(true);
m_showScrollbars->SetToolTip( _("This change takes effect when relaunching the editor.") );
bSizer81->Add( m_showScrollbars, 0, wxALIGN_LEFT|wxBOTTOM, 5 );
m_gbUserInterface->Add( bSizer81, wxGBPosition( 0, 0 ), wxGBSpan( 2, 4 ), wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxEXPAND, 5 );
m_stIconTheme = new wxStaticText( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Icon theme:"), wxDefaultPosition, wxDefaultSize, 0 );
m_stIconTheme->Wrap( -1 );
m_gbUserInterface->Add( m_stIconTheme, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_gbUserInterface->Add( m_stIconTheme, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
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_gbUserInterface->Add( m_rbIconThemeLight, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_gbUserInterface->Add( m_rbIconThemeLight, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbIconThemeDark = new wxRadioButton( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Dark"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbIconThemeDark->SetToolTip( _("Use icons designed for dark window backgrounds") );
m_gbUserInterface->Add( m_rbIconThemeDark, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_gbUserInterface->Add( m_rbIconThemeDark, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
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") );
m_gbUserInterface->Add( m_rbIconThemeAuto, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
m_gbUserInterface->Add( m_rbIconThemeAuto, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
m_staticTextCanvasScale = new wxStaticText( m_sbUserInterface->GetStaticBox(), wxID_ANY, _("Canvas scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCanvasScale->Wrap( -1 );
m_gbUserInterface->Add( m_staticTextCanvasScale, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_gbUserInterface->Add( m_staticTextCanvasScale, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_canvasScaleCtrl = new wxSpinCtrlDouble( m_sbUserInterface->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0, 1 );
m_canvasScaleCtrl->SetDigits( 0 );
m_gbUserInterface->Add( m_canvasScaleCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_gbUserInterface->Add( m_canvasScaleCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 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 );
m_gbUserInterface->Add( m_canvasScaleAuto, wxGBPosition( 4, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 15 );
m_sbUserInterface->Add( m_gbUserInterface, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );

View File

@ -910,71 +910,146 @@
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="vgap">10</property>
<object class="gbsizeritem" expanded="0">
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">2</property>
<property name="colspan">4</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxEXPAND</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="rowspan">2</property>
<object class="wxBoxSizer" expanded="1">
<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>
<property name="name">bSizer81</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_LEFT|wxBOTTOM</property>
<property name="proportion">0</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="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_LEFT|wxBOTTOM</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">1</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 scrollbars in editors</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_showScrollbars</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">This change takes effect when relaunching the editor.</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>
</object>
<object class="gbsizeritem" expanded="0">
@ -982,7 +1057,7 @@
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">1</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -1046,7 +1121,7 @@
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">1</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
@ -1113,7 +1188,7 @@
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">1</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
@ -1180,7 +1255,7 @@
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="row">1</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>
@ -1247,7 +1322,7 @@
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">3</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -1311,7 +1386,7 @@
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="row">3</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxSpinCtrlDouble" expanded="0">
<property name="BottomDockable">1</property>
@ -1378,7 +1453,7 @@
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT</property>
<property name="row">3</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -54,6 +54,7 @@ class PANEL_COMMON_SETTINGS_BASE : public RESETTABLE_PANEL
wxStaticBoxSizer* m_sbUserInterface;
wxGridBagSizer* m_gbUserInterface;
wxCheckBox* m_checkBoxIconsInMenus;
wxCheckBox* m_showScrollbars;
wxStaticText* m_stIconTheme;
wxRadioButton* m_rbIconThemeLight;
wxRadioButton* m_rbIconThemeDark;

View File

@ -24,7 +24,6 @@
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <confirm.h>
#include <eda_draw_frame.h>
#include <kiface_base.h>
@ -53,6 +52,7 @@
#include <profile.h>
#include <pgm_base.h>
EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId,
const wxPoint& aPosition, const wxSize& aSize,
@ -94,7 +94,15 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
SwitchBackend( aGalType );
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
if( Pgm().GetCommonSettings()->m_Appearance.show_scrollbars )
{
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
}
else
{
ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
}
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
KIPLATFORM::UI::SetOverlayScrolling( this, false ); // Prevent excessive repaint on GTK

View File

@ -105,6 +105,9 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
m_Appearance.apply_icon_scale_to_fonts = false;
#endif
m_params.emplace_back( new PARAM<bool>( "appearance.show_scrollbars",
&m_Appearance.show_scrollbars, 1 ) );
m_params.emplace_back( new PARAM<double>( "appearance.hicontrast_dimming_factor",
&m_Appearance.hicontrast_dimming_factor, 0.8f ) );

View File

@ -24,7 +24,7 @@
#ifndef KICAD_DIALOG_SUITE_OPTIONS_H
#define KICAD_DIALOG_SUITE_OPTIONS_H
#include "panel_common_settings_base.h"
#include <dialogs/panel_common_settings_base.h>
class COMMON_SETTINGS;

View File

@ -49,6 +49,7 @@ class COMMON_SETTINGS : public JSON_SETTINGS
public:
struct APPEARANCE
{
bool show_scrollbars;
double canvas_scale;
int icon_scale;
ICON_THEME icon_theme;