KiCad PCB EDA Suite
PANEL_COMMON_SETTINGS Class Reference

#include <panel_common_settings.h>

Inheritance diagram for PANEL_COMMON_SETTINGS:
PANEL_COMMON_SETTINGS_BASE RESETTABLE_PANEL

Public Member Functions

 PANEL_COMMON_SETTINGS (DIALOG_SHIM *aDialog, wxWindow *aParent)
 
 ~PANEL_COMMON_SETTINGS () override
 
void ResetPanel () override
 Reset the contents of this panel. More...
 
virtual wxString GetResetTooltip ()
 Get the tooltip the reset button should display when showing this panel. More...
 

Protected Member Functions

bool TransferDataFromWindow () override
 
bool TransferDataToWindow () override
 
void applySettingsToPanel (COMMON_SETTINGS &aSettings)
 
void OnScaleSlider (wxScrollEvent &aEvent) override
 
void OnIconScaleAuto (wxCommandEvent &aEvent) override
 
void OnTextEditorClick (wxCommandEvent &event) override
 
void OnPDFViewerClick (wxCommandEvent &event) override
 
void onUpdateUIPdfPath (wxUpdateUIEvent &event) override
 
void OnCanvasScaleChange (wxCommandEvent &aEvent)
 Event fired when the canvas scale field is modified. More...
 
void OnCanvasScaleAuto (wxCommandEvent &aEvent) override
 Event fired when the canvas auto-scale option is changed. More...
 

Protected Attributes

DIALOG_SHIMm_dialog
 
int m_last_scale
 saved icon scale when Auto selected More...
 
wxStaticText * m_staticTextautosave
 
wxSpinCtrl * m_SaveTime
 
wxStaticText * m_staticTextFileHistorySize
 
wxSpinCtrl * m_fileHistorySize
 
wxStaticText * m_staticTextClear3DCache
 
wxSpinCtrl * m_Clear3DCacheFilesOlder
 
wxStaticText * m_staticTextDays
 
wxChoice * m_antialiasing
 
wxStaticText * m_antialiasingFallbackLabel
 
wxChoice * m_antialiasingFallback
 
wxTextCtrl * m_textEditorPath
 
wxBitmapButton * m_textEditorBtn
 
wxRadioButton * m_defaultPDFViewer
 
wxRadioButton * m_otherPDFViewer
 
wxTextCtrl * m_PDFViewerPath
 
wxBitmapButton * m_pdfViewerBtn
 
wxStaticText * m_staticTexticonscale
 
STEPPED_SLIDERm_iconScaleSlider
 
wxCheckBox * m_iconScaleAuto
 
wxStaticText * m_staticTextCanvasScale
 
wxSpinCtrlDouble * m_canvasScaleCtrl
 
wxCheckBox * m_canvasScaleAuto
 
wxCheckBox * m_checkBoxIconsInMenus
 
wxStaticText * m_stIconTheme
 
wxRadioButton * m_rbIconThemeLight
 
wxRadioButton * m_rbIconThemeDark
 
wxRadioButton * m_rbIconThemeAuto
 
wxCheckBox * m_warpMouseOnMove
 
wxCheckBox * m_NonImmediateActions
 
wxCheckBox * m_cbBackupEnabled
 
wxCheckBox * m_cbBackupAutosave
 
wxStaticText * m_staticText9
 
wxSpinCtrl * m_backupLimitTotalFiles
 
wxStaticText * m_staticText10
 
wxSpinCtrl * m_backupLimitDailyFiles
 
wxStaticText * m_staticText11
 
wxSpinCtrl * m_backupMinInterval
 
wxStaticText * m_staticText15
 
wxStaticText * m_staticText16
 
wxSpinCtrl * m_backupLimitTotalSize
 
wxStaticText * m_staticText17
 
wxCheckBox * m_cbRememberOpenFiles
 

Detailed Description

Definition at line 34 of file panel_common_settings.h.

Constructor & Destructor Documentation

◆ PANEL_COMMON_SETTINGS()

PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS ( DIALOG_SHIM aDialog,
wxWindow *  aParent 
)

Definition at line 40 of file panel_common_settings.cpp.

41  : PANEL_COMMON_SETTINGS_BASE( aParent ),
42  m_dialog( aDialog ),
43  m_last_scale( -1 )
44 {
45  m_canvasScaleCtrl->SetRange(
50 
51  m_canvasScaleCtrl->SetToolTip(
52  _( "Set the scale for the canvas."
53  "\n\n"
54  "On high-DPI displays on some platforms, KiCad cannot determine the "
55  "scaling factor. In this case you may need to set this to a value to "
56  "match your system's DPI scaling. 2.0 is a common value. "
57  "\n\n"
58  "If this does not match the system DPI scaling, the canvas will "
59  "not match the window size and cursor position." ) );
60 
61  m_canvasScaleAuto->SetToolTip(
62  _( "Use an automatic value for the canvas scale."
63  "\n\n"
64  "On some platforms, the automatic value is incorrect and should be "
65  "set manually." ) );
66 
68 
69 #ifdef __WXMAC__
70  // Cairo canvas doesn't work on Mac, so no need for anti-aliasing options
71  m_antialiasingFallback->Show( false );
72  m_antialiasingFallbackLabel->Show( false );
73 #endif
74 
75  if( !ADVANCED_CFG::GetCfg().m_AllowDarkMode )
76  {
77  m_rbIconThemeLight->Hide();
78  m_rbIconThemeDark->Hide();
79  m_rbIconThemeAuto->Hide();
80  m_stIconTheme->Hide();
81  }
82 
85 
86  m_canvasScaleCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED,
87  wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnCanvasScaleChange ),
88  NULL, this );
89 }
void OnCanvasScaleChange(wxCommandEvent &aEvent)
Event fired when the canvas scale field is modified.
static double GetDefaultScaleFactor()
Get the "default" scaling factor to use if not other config is available.
PANEL_COMMON_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)
static constexpr int dpi_scaling_precision
#define NULL
static constexpr double dpi_scaling_increment
static double GetMaxScaleFactor()
static double GetMinScaleFactor()
int m_last_scale
saved icon scale when Auto selected
#define _(s)
Definition: 3d_actions.cpp:33
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void SetStep(int aSize)
Set the step size.
wxBitmap KiBitmap(BITMAPS aBitmap)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104

References _, dpi_scaling_increment, dpi_scaling_precision, ADVANCED_CFG::GetCfg(), DPI_SCALING::GetDefaultScaleFactor(), DPI_SCALING::GetMaxScaleFactor(), DPI_SCALING::GetMinScaleFactor(), KiBitmap(), PANEL_COMMON_SETTINGS_BASE::m_antialiasingFallback, PANEL_COMMON_SETTINGS_BASE::m_antialiasingFallbackLabel, PANEL_COMMON_SETTINGS_BASE::m_canvasScaleAuto, PANEL_COMMON_SETTINGS_BASE::m_canvasScaleCtrl, PANEL_COMMON_SETTINGS_BASE::m_iconScaleSlider, PANEL_COMMON_SETTINGS_BASE::m_pdfViewerBtn, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeAuto, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeDark, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeLight, PANEL_COMMON_SETTINGS_BASE::m_stIconTheme, PANEL_COMMON_SETTINGS_BASE::m_textEditorBtn, NULL, OnCanvasScaleChange(), STEPPED_SLIDER::SetStep(), and small_folder.

◆ ~PANEL_COMMON_SETTINGS()

PANEL_COMMON_SETTINGS::~PANEL_COMMON_SETTINGS ( )
override

Definition at line 92 of file panel_common_settings.cpp.

93 {
94  m_canvasScaleCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED,
95  wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnCanvasScaleChange ),
96  NULL, this );
97 }
void OnCanvasScaleChange(wxCommandEvent &aEvent)
Event fired when the canvas scale field is modified.
#define NULL

References PANEL_COMMON_SETTINGS_BASE::m_canvasScaleCtrl, NULL, and OnCanvasScaleChange().

Member Function Documentation

◆ applySettingsToPanel()

void PANEL_COMMON_SETTINGS::applySettingsToPanel ( COMMON_SETTINGS aSettings)
protected

Definition at line 184 of file panel_common_settings.cpp.

185 {
186  int timevalue = aSettings.m_System.autosave_interval;
187  wxString msg;
188 
189  msg << timevalue / 60;
190  m_SaveTime->SetValue( msg );
191 
192  m_fileHistorySize->SetValue( aSettings.m_System.file_history_size );
193 
194  m_antialiasing->SetSelection( aSettings.m_Graphics.opengl_aa_mode );
195  m_antialiasingFallback->SetSelection( aSettings.m_Graphics.cairo_aa_mode );
196 
198 
199  int icon_scale_fourths = aSettings.m_Appearance.icon_scale;
200 
201  if( icon_scale_fourths <= 0 )
202  {
203  m_iconScaleAuto->SetValue( true );
204  m_iconScaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
205  }
206  else
207  {
208  m_iconScaleAuto->SetValue( false );
209  m_iconScaleSlider->SetValue( icon_scale_fourths * 25 );
210  }
211 
212  {
213  const DPI_SCALING dpi( &aSettings, this );
214  m_canvasScaleCtrl->SetValue( dpi.GetScaleFactor() );
215  m_canvasScaleAuto->SetValue( dpi.GetCanvasIsAutoScaled() );
216  }
217 
218  switch( aSettings.m_Appearance.icon_theme )
219  {
220  case ICON_THEME::LIGHT: m_rbIconThemeLight->SetValue( true ); break;
221  case ICON_THEME::DARK: m_rbIconThemeDark->SetValue( true ); break;
222  case ICON_THEME::AUTO: m_rbIconThemeAuto->SetValue( true ); break;
223  }
224 
226 
227  m_warpMouseOnMove->SetValue( aSettings.m_Input.warp_mouse_on_move );
228  m_NonImmediateActions->SetValue( !aSettings.m_Input.immediate_actions );
229 
230  m_cbRememberOpenFiles->SetValue( aSettings.m_Session.remember_open_files );
231 
232  m_cbBackupEnabled->SetValue( aSettings.m_Backup.enabled );
233  m_cbBackupAutosave->SetValue( aSettings.m_Backup.backup_on_autosave );
234  m_backupLimitTotalFiles->SetValue( aSettings.m_Backup.limit_total_files );
235  m_backupLimitDailyFiles->SetValue( aSettings.m_Backup.limit_daily_files );
236  m_backupMinInterval->SetValue( aSettings.m_Backup.min_interval / 60 );
237  m_backupLimitTotalSize->SetValue( aSettings.m_Backup.limit_total_size / ( 1024 * 1024 ) );
238 }
unsigned long long limit_total_size
Maximum total size of backups (bytes), 0 for unlimited.
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
Definition: bitmap.cpp:121
bool enabled
Automatically back up the project when files are saved.
AUTO_BACKUP m_Backup
APPEARANCE m_Appearance
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:36
int min_interval
Minimum time, in seconds, between subsequent backups.
bool backup_on_autosave
Trigger a backup on autosave.
int limit_daily_files
Maximum files to keep per day, 0 for unlimited.
int limit_total_files
Maximum number of backup archives to retain.

References AUTO, COMMON_SETTINGS::SYSTEM::autosave_interval, COMMON_SETTINGS::AUTO_BACKUP::backup_on_autosave, COMMON_SETTINGS::GRAPHICS::cairo_aa_mode, COMMON_SETTINGS::SYSTEM::clear_3d_cache_interval, DARK, COMMON_SETTINGS::AUTO_BACKUP::enabled, COMMON_SETTINGS::SYSTEM::file_history_size, DPI_SCALING::GetCanvasIsAutoScaled(), DPI_SCALING::GetScaleFactor(), COMMON_SETTINGS::APPEARANCE::icon_scale, COMMON_SETTINGS::APPEARANCE::icon_theme, COMMON_SETTINGS::INPUT::immediate_actions, KiIconScale(), LIGHT, COMMON_SETTINGS::AUTO_BACKUP::limit_daily_files, COMMON_SETTINGS::AUTO_BACKUP::limit_total_files, COMMON_SETTINGS::AUTO_BACKUP::limit_total_size, PANEL_COMMON_SETTINGS_BASE::m_antialiasing, PANEL_COMMON_SETTINGS_BASE::m_antialiasingFallback, COMMON_SETTINGS::m_Appearance, COMMON_SETTINGS::m_Backup, PANEL_COMMON_SETTINGS_BASE::m_backupLimitDailyFiles, PANEL_COMMON_SETTINGS_BASE::m_backupLimitTotalFiles, PANEL_COMMON_SETTINGS_BASE::m_backupLimitTotalSize, PANEL_COMMON_SETTINGS_BASE::m_backupMinInterval, PANEL_COMMON_SETTINGS_BASE::m_canvasScaleAuto, PANEL_COMMON_SETTINGS_BASE::m_canvasScaleCtrl, PANEL_COMMON_SETTINGS_BASE::m_cbBackupAutosave, PANEL_COMMON_SETTINGS_BASE::m_cbBackupEnabled, PANEL_COMMON_SETTINGS_BASE::m_cbRememberOpenFiles, PANEL_COMMON_SETTINGS_BASE::m_checkBoxIconsInMenus, PANEL_COMMON_SETTINGS_BASE::m_Clear3DCacheFilesOlder, PANEL_COMMON_SETTINGS_BASE::m_fileHistorySize, COMMON_SETTINGS::m_Graphics, PANEL_COMMON_SETTINGS_BASE::m_iconScaleAuto, PANEL_COMMON_SETTINGS_BASE::m_iconScaleSlider, COMMON_SETTINGS::m_Input, PANEL_COMMON_SETTINGS_BASE::m_NonImmediateActions, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeAuto, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeDark, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeLight, PANEL_COMMON_SETTINGS_BASE::m_SaveTime, COMMON_SETTINGS::m_Session, COMMON_SETTINGS::m_System, PANEL_COMMON_SETTINGS_BASE::m_warpMouseOnMove, COMMON_SETTINGS::AUTO_BACKUP::min_interval, COMMON_SETTINGS::GRAPHICS::opengl_aa_mode, COMMON_SETTINGS::SESSION::remember_open_files, COMMON_SETTINGS::APPEARANCE::use_icons_in_menus, and COMMON_SETTINGS::INPUT::warp_mouse_on_move.

Referenced by ResetPanel(), and TransferDataToWindow().

◆ GetResetTooltip()

virtual wxString RESETTABLE_PANEL::GetResetTooltip ( )
inlinevirtualinherited

Get the tooltip the reset button should display when showing this panel.

Returns
the tooltip

Reimplemented in PANEL_HOTKEYS_EDITOR, and PANEL_COLOR_SETTINGS.

Definition at line 52 of file resettable_panel.h.

53  {
54  return _( "Reset all settings on this page to their default" );
55  }
#define _(s)
Definition: 3d_actions.cpp:33

References _.

◆ OnCanvasScaleAuto()

void PANEL_COMMON_SETTINGS::OnCanvasScaleAuto ( wxCommandEvent &  aEvent)
overrideprotectedvirtual

Event fired when the canvas auto-scale option is changed.

Reimplemented from PANEL_COMMON_SETTINGS_BASE.

Definition at line 269 of file panel_common_settings.cpp.

270 {
271  const bool automatic = m_canvasScaleAuto->GetValue();
272 
273  if( automatic )
274  {
275  // set the scale to the auto value, without consulting the config
276  DPI_SCALING dpi( nullptr, this );
277 
278  // update the field (no events sent)
279  m_canvasScaleCtrl->SetValue( dpi.GetScaleFactor() );
280  }
281 }
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:36

References DPI_SCALING::GetScaleFactor(), PANEL_COMMON_SETTINGS_BASE::m_canvasScaleAuto, and PANEL_COMMON_SETTINGS_BASE::m_canvasScaleCtrl.

◆ OnCanvasScaleChange()

void PANEL_COMMON_SETTINGS::OnCanvasScaleChange ( wxCommandEvent &  aEvent)
protected

Event fired when the canvas scale field is modified.

Definition at line 263 of file panel_common_settings.cpp.

264 {
265  m_canvasScaleAuto->SetValue( false );
266 }

References PANEL_COMMON_SETTINGS_BASE::m_canvasScaleAuto.

Referenced by PANEL_COMMON_SETTINGS(), and ~PANEL_COMMON_SETTINGS().

◆ OnIconScaleAuto()

void PANEL_COMMON_SETTINGS::OnIconScaleAuto ( wxCommandEvent &  aEvent)
overrideprotectedvirtual

Reimplemented from PANEL_COMMON_SETTINGS_BASE.

Definition at line 248 of file panel_common_settings.cpp.

249 {
250  if( m_iconScaleAuto->GetValue() )
251  {
252  m_last_scale = m_iconScaleAuto->GetValue();
253  m_iconScaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
254  }
255  else
256  {
257  if( m_last_scale >= 0 )
258  m_iconScaleSlider->SetValue( m_last_scale );
259  }
260 }
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
Definition: bitmap.cpp:121
int m_last_scale
saved icon scale when Auto selected

References KiIconScale(), PANEL_COMMON_SETTINGS_BASE::m_iconScaleAuto, PANEL_COMMON_SETTINGS_BASE::m_iconScaleSlider, and m_last_scale.

◆ OnPDFViewerClick()

void PANEL_COMMON_SETTINGS::OnPDFViewerClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_COMMON_SETTINGS_BASE.

Definition at line 297 of file panel_common_settings.cpp.

298 {
299  wxString mask( wxT( "*" ) );
300 
301 #ifdef __WINDOWS__
302  mask += wxT( ".exe" );
303 #endif
304 
305  wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask;
306 
307  Pgm().ReadPdfBrowserInfos();
308  wxFileName fn = Pgm().GetPdfBrowserName();
309 
310  wxFileDialog dlg( this, _( "Select Preferred PDF Viewer" ), fn.GetPath(), fn.GetFullPath(),
311  wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
312 
313  if( dlg.ShowModal() == wxID_CANCEL )
314  return;
315 
316  m_otherPDFViewer->SetValue( true );
317  m_PDFViewerPath->SetValue( dlg.GetPath() );
318 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
#define _(s)
Definition: 3d_actions.cpp:33

References _, PANEL_COMMON_SETTINGS_BASE::m_otherPDFViewer, PANEL_COMMON_SETTINGS_BASE::m_PDFViewerPath, and Pgm().

◆ OnScaleSlider()

void PANEL_COMMON_SETTINGS::OnScaleSlider ( wxScrollEvent &  aEvent)
overrideprotectedvirtual

Reimplemented from PANEL_COMMON_SETTINGS_BASE.

Definition at line 241 of file panel_common_settings.cpp.

242 {
243  m_iconScaleAuto->SetValue( false );
244  aEvent.Skip();
245 }

References PANEL_COMMON_SETTINGS_BASE::m_iconScaleAuto.

◆ OnTextEditorClick()

void PANEL_COMMON_SETTINGS::OnTextEditorClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_COMMON_SETTINGS_BASE.

Definition at line 284 of file panel_common_settings.cpp.

285 {
286  // Ask the user to select a new editor, but suggest the current one as the default.
287  wxString editorname = Pgm().AskUserForPreferredEditor( m_textEditorPath->GetValue() );
288 
289  // If we have a new editor name request it to be copied to m_editor_name and saved
290  // to the preferences file. If the user cancelled the dialog then the previous
291  // value will be retained.
292  if( !editorname.IsEmpty() )
293  m_textEditorPath->SetValue( editorname );
294 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106

References PANEL_COMMON_SETTINGS_BASE::m_textEditorPath, and Pgm().

◆ onUpdateUIPdfPath()

void PANEL_COMMON_SETTINGS::onUpdateUIPdfPath ( wxUpdateUIEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_COMMON_SETTINGS_BASE.

Definition at line 321 of file panel_common_settings.cpp.

322 {
323  // Used by both the m_pdfViewerBtn and m_PDFViewerPath
324  event.Enable( m_otherPDFViewer->GetValue() );
325 }

References PANEL_COMMON_SETTINGS_BASE::m_otherPDFViewer.

◆ ResetPanel()

void PANEL_COMMON_SETTINGS::ResetPanel ( )
overridevirtual

Reset the contents of this panel.

Implements RESETTABLE_PANEL.

Definition at line 168 of file panel_common_settings.cpp.

169 {
170  COMMON_SETTINGS defaultSettings;
171 
172  defaultSettings.ResetToDefaults();
173 
174  applySettingsToPanel( defaultSettings );
175 
176  // TODO(JE) Move these into COMMON_SETTINGS probably
177  m_textEditorPath->SetValue( defaultSettings.m_System.editor_name );
178  m_defaultPDFViewer->SetValue( defaultSettings.m_System.use_system_pdf_viewer );
179  m_otherPDFViewer->SetValue( !defaultSettings.m_System.use_system_pdf_viewer );
180  m_PDFViewerPath->SetValue( defaultSettings.m_System.pdf_viewer_name );
181 }
void ResetToDefaults()
Resets all parameters to default values.
void applySettingsToPanel(COMMON_SETTINGS &aSettings)

References applySettingsToPanel(), COMMON_SETTINGS::SYSTEM::editor_name, PANEL_COMMON_SETTINGS_BASE::m_defaultPDFViewer, PANEL_COMMON_SETTINGS_BASE::m_otherPDFViewer, PANEL_COMMON_SETTINGS_BASE::m_PDFViewerPath, COMMON_SETTINGS::m_System, PANEL_COMMON_SETTINGS_BASE::m_textEditorPath, COMMON_SETTINGS::SYSTEM::pdf_viewer_name, JSON_SETTINGS::ResetToDefaults(), and COMMON_SETTINGS::SYSTEM::use_system_pdf_viewer.

◆ TransferDataFromWindow()

bool PANEL_COMMON_SETTINGS::TransferDataFromWindow ( )
overrideprotected

Definition at line 116 of file panel_common_settings.cpp.

117 {
118  COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
119 
120  commonSettings->m_System.autosave_interval = m_SaveTime->GetValue() * 60;
121  commonSettings->m_System.file_history_size = m_fileHistorySize->GetValue();
122  commonSettings->m_System.clear_3d_cache_interval = m_Clear3DCacheFilesOlder->GetValue();
123 
124  commonSettings->m_Graphics.opengl_aa_mode = m_antialiasing->GetSelection();
125  commonSettings->m_Graphics.cairo_aa_mode = m_antialiasingFallback->GetSelection();
126 
127  const int scale_fourths = m_iconScaleAuto->GetValue() ? -1 : m_iconScaleSlider->GetValue() / 25;
128  commonSettings->m_Appearance.icon_scale = scale_fourths;
129 
130  {
131  DPI_SCALING dpi( commonSettings, this );
132  dpi.SetDpiConfig( m_canvasScaleAuto->GetValue(), m_canvasScaleCtrl->GetValue() );
133  }
134 
135  if( m_rbIconThemeLight->GetValue() )
136  commonSettings->m_Appearance.icon_theme = ICON_THEME::LIGHT;
137  else if( m_rbIconThemeDark->GetValue() )
138  commonSettings->m_Appearance.icon_theme = ICON_THEME::DARK;
139  else if( m_rbIconThemeAuto->GetValue() )
140  commonSettings->m_Appearance.icon_theme = ICON_THEME::AUTO;
141 
142  commonSettings->m_Appearance.use_icons_in_menus = m_checkBoxIconsInMenus->GetValue();
143 
144  commonSettings->m_Input.immediate_actions = !m_NonImmediateActions->GetValue();
145  commonSettings->m_Input.warp_mouse_on_move = m_warpMouseOnMove->GetValue();
146 
147  commonSettings->m_Backup.enabled = m_cbBackupEnabled->GetValue();
148  commonSettings->m_Backup.backup_on_autosave = m_cbBackupAutosave->GetValue();
149  commonSettings->m_Backup.limit_total_files = m_backupLimitTotalFiles->GetValue();
150  commonSettings->m_Backup.limit_daily_files = m_backupLimitDailyFiles->GetValue();
151  commonSettings->m_Backup.min_interval = m_backupMinInterval->GetValue() * 60;
152  commonSettings->m_Backup.limit_total_size = m_backupLimitTotalSize->GetValue() * 1024 * 1024;
153 
154  commonSettings->m_Session.remember_open_files = m_cbRememberOpenFiles->GetValue();
155 
156  Pgm().SetEditorName( m_textEditorPath->GetValue() );
157 
158  Pgm().SetPdfBrowserName( m_PDFViewerPath->GetValue() );
159  Pgm().ForceSystemPdfBrowser( m_defaultPDFViewer->GetValue() );
160  Pgm().WritePdfBrowserInfos();
161 
162  Pgm().GetSettingsManager().Save( commonSettings );
163 
164  return true;
165 }
unsigned long long limit_total_size
Maximum total size of backups (bytes), 0 for unlimited.
bool enabled
Automatically back up the project when files are saved.
AUTO_BACKUP m_Backup
APPEARANCE m_Appearance
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:36
int min_interval
Minimum time, in seconds, between subsequent backups.
bool backup_on_autosave
Trigger a backup on autosave.
int limit_daily_files
Maximum files to keep per day, 0 for unlimited.
int limit_total_files
Maximum number of backup archives to retain.

References AUTO, COMMON_SETTINGS::SYSTEM::autosave_interval, COMMON_SETTINGS::AUTO_BACKUP::backup_on_autosave, COMMON_SETTINGS::GRAPHICS::cairo_aa_mode, COMMON_SETTINGS::SYSTEM::clear_3d_cache_interval, DARK, COMMON_SETTINGS::AUTO_BACKUP::enabled, COMMON_SETTINGS::SYSTEM::file_history_size, COMMON_SETTINGS::APPEARANCE::icon_scale, COMMON_SETTINGS::APPEARANCE::icon_theme, COMMON_SETTINGS::INPUT::immediate_actions, LIGHT, COMMON_SETTINGS::AUTO_BACKUP::limit_daily_files, COMMON_SETTINGS::AUTO_BACKUP::limit_total_files, COMMON_SETTINGS::AUTO_BACKUP::limit_total_size, PANEL_COMMON_SETTINGS_BASE::m_antialiasing, PANEL_COMMON_SETTINGS_BASE::m_antialiasingFallback, COMMON_SETTINGS::m_Appearance, COMMON_SETTINGS::m_Backup, PANEL_COMMON_SETTINGS_BASE::m_backupLimitDailyFiles, PANEL_COMMON_SETTINGS_BASE::m_backupLimitTotalFiles, PANEL_COMMON_SETTINGS_BASE::m_backupLimitTotalSize, PANEL_COMMON_SETTINGS_BASE::m_backupMinInterval, PANEL_COMMON_SETTINGS_BASE::m_canvasScaleAuto, PANEL_COMMON_SETTINGS_BASE::m_canvasScaleCtrl, PANEL_COMMON_SETTINGS_BASE::m_cbBackupAutosave, PANEL_COMMON_SETTINGS_BASE::m_cbBackupEnabled, PANEL_COMMON_SETTINGS_BASE::m_cbRememberOpenFiles, PANEL_COMMON_SETTINGS_BASE::m_checkBoxIconsInMenus, PANEL_COMMON_SETTINGS_BASE::m_Clear3DCacheFilesOlder, PANEL_COMMON_SETTINGS_BASE::m_defaultPDFViewer, PANEL_COMMON_SETTINGS_BASE::m_fileHistorySize, COMMON_SETTINGS::m_Graphics, PANEL_COMMON_SETTINGS_BASE::m_iconScaleAuto, PANEL_COMMON_SETTINGS_BASE::m_iconScaleSlider, COMMON_SETTINGS::m_Input, PANEL_COMMON_SETTINGS_BASE::m_NonImmediateActions, PANEL_COMMON_SETTINGS_BASE::m_PDFViewerPath, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeAuto, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeDark, PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeLight, PANEL_COMMON_SETTINGS_BASE::m_SaveTime, COMMON_SETTINGS::m_Session, COMMON_SETTINGS::m_System, PANEL_COMMON_SETTINGS_BASE::m_textEditorPath, PANEL_COMMON_SETTINGS_BASE::m_warpMouseOnMove, COMMON_SETTINGS::AUTO_BACKUP::min_interval, COMMON_SETTINGS::GRAPHICS::opengl_aa_mode, Pgm(), COMMON_SETTINGS::SESSION::remember_open_files, DPI_SCALING::SetDpiConfig(), COMMON_SETTINGS::APPEARANCE::use_icons_in_menus, and COMMON_SETTINGS::INPUT::warp_mouse_on_move.

◆ TransferDataToWindow()

bool PANEL_COMMON_SETTINGS::TransferDataToWindow ( )
overrideprotected

Definition at line 100 of file panel_common_settings.cpp.

101 {
102  COMMON_SETTINGS* commonSettings = Pgm().GetCommonSettings();
103 
104  applySettingsToPanel( *commonSettings );
105 
106  // TODO(JE) Move these into COMMON_SETTINGS probably
107  m_textEditorPath->SetValue( Pgm().GetEditorName( false ) );
108  m_defaultPDFViewer->SetValue( Pgm().UseSystemPdfBrowser() );
109  m_otherPDFViewer->SetValue( !Pgm().UseSystemPdfBrowser() );
110  m_PDFViewerPath->SetValue( Pgm().GetPdfBrowserName() );
111 
112  return true;
113 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
void applySettingsToPanel(COMMON_SETTINGS &aSettings)

References applySettingsToPanel(), PANEL_COMMON_SETTINGS_BASE::m_defaultPDFViewer, PANEL_COMMON_SETTINGS_BASE::m_otherPDFViewer, PANEL_COMMON_SETTINGS_BASE::m_PDFViewerPath, PANEL_COMMON_SETTINGS_BASE::m_textEditorPath, and Pgm().

Member Data Documentation

◆ m_antialiasing

wxChoice* PANEL_COMMON_SETTINGS_BASE::m_antialiasing
protectedinherited

◆ m_antialiasingFallback

wxChoice* PANEL_COMMON_SETTINGS_BASE::m_antialiasingFallback
protectedinherited

◆ m_antialiasingFallbackLabel

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_antialiasingFallbackLabel
protectedinherited

◆ m_backupLimitDailyFiles

wxSpinCtrl* PANEL_COMMON_SETTINGS_BASE::m_backupLimitDailyFiles
protectedinherited

◆ m_backupLimitTotalFiles

wxSpinCtrl* PANEL_COMMON_SETTINGS_BASE::m_backupLimitTotalFiles
protectedinherited

◆ m_backupLimitTotalSize

wxSpinCtrl* PANEL_COMMON_SETTINGS_BASE::m_backupLimitTotalSize
protectedinherited

◆ m_backupMinInterval

wxSpinCtrl* PANEL_COMMON_SETTINGS_BASE::m_backupMinInterval
protectedinherited

◆ m_canvasScaleAuto

◆ m_canvasScaleCtrl

wxSpinCtrlDouble* PANEL_COMMON_SETTINGS_BASE::m_canvasScaleCtrl
protectedinherited

◆ m_cbBackupAutosave

wxCheckBox* PANEL_COMMON_SETTINGS_BASE::m_cbBackupAutosave
protectedinherited

◆ m_cbBackupEnabled

wxCheckBox* PANEL_COMMON_SETTINGS_BASE::m_cbBackupEnabled
protectedinherited

◆ m_cbRememberOpenFiles

wxCheckBox* PANEL_COMMON_SETTINGS_BASE::m_cbRememberOpenFiles
protectedinherited

◆ m_checkBoxIconsInMenus

wxCheckBox* PANEL_COMMON_SETTINGS_BASE::m_checkBoxIconsInMenus
protectedinherited

◆ m_Clear3DCacheFilesOlder

wxSpinCtrl* PANEL_COMMON_SETTINGS_BASE::m_Clear3DCacheFilesOlder
protectedinherited

◆ m_defaultPDFViewer

wxRadioButton* PANEL_COMMON_SETTINGS_BASE::m_defaultPDFViewer
protectedinherited

◆ m_dialog

DIALOG_SHIM* PANEL_COMMON_SETTINGS::m_dialog
protected

Definition at line 64 of file panel_common_settings.h.

◆ m_fileHistorySize

wxSpinCtrl* PANEL_COMMON_SETTINGS_BASE::m_fileHistorySize
protectedinherited

◆ m_iconScaleAuto

◆ m_iconScaleSlider

◆ m_last_scale

int PANEL_COMMON_SETTINGS::m_last_scale
protected

saved icon scale when Auto selected

Definition at line 66 of file panel_common_settings.h.

Referenced by OnIconScaleAuto().

◆ m_NonImmediateActions

wxCheckBox* PANEL_COMMON_SETTINGS_BASE::m_NonImmediateActions
protectedinherited

◆ m_otherPDFViewer

wxRadioButton* PANEL_COMMON_SETTINGS_BASE::m_otherPDFViewer
protectedinherited

◆ m_pdfViewerBtn

wxBitmapButton* PANEL_COMMON_SETTINGS_BASE::m_pdfViewerBtn
protectedinherited

◆ m_PDFViewerPath

◆ m_rbIconThemeAuto

wxRadioButton* PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeAuto
protectedinherited

◆ m_rbIconThemeDark

wxRadioButton* PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeDark
protectedinherited

◆ m_rbIconThemeLight

wxRadioButton* PANEL_COMMON_SETTINGS_BASE::m_rbIconThemeLight
protectedinherited

◆ m_SaveTime

wxSpinCtrl* PANEL_COMMON_SETTINGS_BASE::m_SaveTime
protectedinherited

◆ m_staticText10

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticText10
protectedinherited

◆ m_staticText11

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticText11
protectedinherited

◆ m_staticText15

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticText15
protectedinherited

◆ m_staticText16

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticText16
protectedinherited

◆ m_staticText17

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticText17
protectedinherited

◆ m_staticText9

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticText9
protectedinherited

◆ m_staticTextautosave

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticTextautosave
protectedinherited

◆ m_staticTextCanvasScale

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticTextCanvasScale
protectedinherited

◆ m_staticTextClear3DCache

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticTextClear3DCache
protectedinherited

◆ m_staticTextDays

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticTextDays
protectedinherited

◆ m_staticTextFileHistorySize

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticTextFileHistorySize
protectedinherited

◆ m_staticTexticonscale

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_staticTexticonscale
protectedinherited

◆ m_stIconTheme

wxStaticText* PANEL_COMMON_SETTINGS_BASE::m_stIconTheme
protectedinherited

◆ m_textEditorBtn

wxBitmapButton* PANEL_COMMON_SETTINGS_BASE::m_textEditorBtn
protectedinherited

◆ m_textEditorPath

wxTextCtrl* PANEL_COMMON_SETTINGS_BASE::m_textEditorPath
protectedinherited

◆ m_warpMouseOnMove

wxCheckBox* PANEL_COMMON_SETTINGS_BASE::m_warpMouseOnMove
protectedinherited

The documentation for this class was generated from the following files: