Debian Codegraph @

wxcrafter/src/wxcSettingsDlg.cpp

raw
1 #include "wxcSettingsDlg.h"
2 #include "wxc_settings.h"
3
4 wxcSettingsDlg::wxcSettingsDlg(wxWindow* parent)
5 : wxcSettingsDlgBase(parent)
6 , m_useTabModeStart(false)
7 , m_useTabModeEnd(false)
8
9 {
10 m_useTabModeStart = m_useTabModeEnd = wxcSettings::Get().HasFlag(wxcSettings::USE_TABBED_MODE);
11 m_checkBoxFormatInheritedFiles->SetValue(wxcSettings::Get().HasFlag(wxcSettings::FORMAT_INHERITED_FILES));
12 m_checkBoxKeepAllPossibleNames->SetValue(wxcSettings::Get().HasFlag(wxcSettings::DUPLICATE_KEEPS_ALL_NAMES));
13 m_checkBoxKeepAllUsersetNames->SetValue(wxcSettings::Get().HasFlag(wxcSettings::DUPLICATE_KEEPS_USERSET_NAMES));
14 m_checkBoxCopyEventhandlerToo->SetValue(wxcSettings::Get().HasFlag(wxcSettings::DUPLICATE_EVENTHANDLERS_TOO));
15 m_checkBoxUseTRay->SetValue(wxcSettings::Get().HasFlag(wxcSettings::EXIT_MINIMIZE_TO_TRAY));
16 }
17
18 wxcSettingsDlg::~wxcSettingsDlg() {}
19
20 void wxcSettingsDlg::OnOk(wxCommandEvent& event)
21 {
22 wxcSettings::Get().EnableFlag(wxcSettings::FORMAT_INHERITED_FILES, m_checkBoxFormatInheritedFiles->IsChecked());
23 wxcSettings::Get().EnableFlag(wxcSettings::DUPLICATE_KEEPS_ALL_NAMES, m_checkBoxKeepAllPossibleNames->IsChecked());
24 wxcSettings::Get().EnableFlag(wxcSettings::DUPLICATE_KEEPS_USERSET_NAMES,
25 m_checkBoxKeepAllUsersetNames->IsChecked());
26 wxcSettings::Get().EnableFlag(wxcSettings::DUPLICATE_EVENTHANDLERS_TOO, m_checkBoxCopyEventhandlerToo->IsChecked());
27 wxcSettings::Get().EnableFlag(wxcSettings::EXIT_MINIMIZE_TO_TRAY, m_checkBoxUseTRay->IsChecked());
28 wxcSettings::Get().Save();
29
30 m_useTabModeEnd = wxcSettings::Get().HasFlag(wxcSettings::USE_TABBED_MODE);
31 EndModal(wxID_OK);
32 }
33
34 bool wxcSettingsDlg::IsRestartRequired() const { return m_useTabModeStart != m_useTabModeEnd; }
35 void wxcSettingsDlg::OnUseAsTabUI(wxUpdateUIEvent& event)
36 {
37 #if STANDALONE_BUILD
38 event.Enable(false);
39 #endif
40 }
41
42 void wxcSettingsDlg::OnMinimizeToTrayUI(wxUpdateUIEvent& event)
43 {
44 #if STANDALONE_BUILD && defined(__WXMSW__)
45 event.Enable(true);
46 #else
47 event.Check(false);
48 event.Enable(false);
49 #endif
50 }