8 wxConfigBase * config = wxConfigBase::Get (
false);
9 config->SetPath (
"/yatish");
10 config->Read (
"log2text", &
log2text,
false);
11 config->Read (
"limitRow", &
limitRow,
false);
13 config->Read (
"rowLimit", &tmp, 100l);
15 config->Read (
"lib", &tmp, 0l);
17 config->Read (
"logo4pdf", &
logo4pdf,
false);
19 config->Read (
"motto4pdf", &
motto4pdf,
true);
20 config->Read (
"companyMotto", &
companyMotto, wxEmptyString);
21 config->Read (
"pdfCharts", &
pdfCharts,
true);
28 wxConfigBase * config = wxConfigBase::Get (
false);
29 config->SetPath (
"/yatish");
30 config->Write (
"log2text",
log2text);
31 config->Write (
"limitRow",
limitRow);
32 config->Write (
"rowLimit", (
long)
rowLimit);
33 config->Write (
"lib", (
long)
lib);
34 config->Write (
"logo4pdf",
logo4pdf);
43 #include <wx/string.h>
82 wxBoxSizer* BoxSizer1;
83 wxBoxSizer* BoxSizer2;
84 wxBoxSizer* BoxSizer3;
85 wxBoxSizer* BoxSizer4;
86 wxBoxSizer* BoxSizer5;
87 wxBoxSizer* BoxSizer6;
88 wxButton* buttonCancel;
90 wxFlexGridSizer* FlexGridSizer1;
94 wxStaticBoxSizer* StaticBoxSizer1;
96 Create(0, wxID_ANY, _(
"Yatish settings"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T(
"wxID_ANY"));
97 SetExtraStyle( GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
98 BoxSizer1 =
new wxBoxSizer(wxVERTICAL);
99 notebook =
new wxNotebook(
this, idNotebook, wxDefaultPosition, wxDefaultSize, 0, _T(
"idNotebook"));
100 panelGUI =
new wxPanel(notebook, idPanelGUI, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"idPanelGUI"));
101 FlexGridSizer1 =
new wxFlexGridSizer(4, 2, 0, 0);
102 StaticText1 =
new wxStaticText(panelGUI, ID_STATICTEXT1, _(
"Logging:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT1"));
103 FlexGridSizer1->Add(StaticText1, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
104 checkBoxLog =
new wxCheckBox(panelGUI, idCheckBoxLog, _(
"main frame"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"idCheckBoxLog"));
105 checkBoxLog->SetValue(
false);
106 FlexGridSizer1->Add(checkBoxLog, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
107 StaticText2 =
new wxStaticText(panelGUI, ID_STATICTEXT2, _(
"Timeslot:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT2"));
108 FlexGridSizer1->Add(StaticText2, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
109 checkBoxLimit =
new wxCheckBox(panelGUI, idCheckBoxLimit, _(
"limit list"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"idCheckBoxLimit"));
110 checkBoxLimit->SetValue(
false);
111 FlexGridSizer1->Add(checkBoxLimit, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
112 StaticText3 =
new wxStaticText(panelGUI, ID_STATICTEXT3, _(
"Row limit:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT3"));
113 FlexGridSizer1->Add(StaticText3, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
114 spinCtrlLimit =
new wxSpinCtrl(panelGUI, idSpinCtrlLimit, _T(
"100"), wxDefaultPosition, wxSize(125,-1), 0, 10, 1000, 100, _T(
"idSpinCtrlLimit"));
115 spinCtrlLimit->SetValue(_T(
"100"));
116 FlexGridSizer1->Add(spinCtrlLimit, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
117 StaticText4 =
new wxStaticText(panelGUI, ID_STATICTEXT4, _(
"Charts:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"ID_STATICTEXT4"));
118 FlexGridSizer1->Add(StaticText4, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
119 choiceLib =
new wxChoice(panelGUI, idChoiceLib, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"idChoiceLib"));
120 choiceLib->SetSelection( choiceLib->Append(_(
"wxMathPlot")) );
121 choiceLib->Append(_(
"wxFreeChart"));
122 choiceLib->Append(_(
"wxCharts"));
123 FlexGridSizer1->Add(choiceLib, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
124 panelGUI->SetSizer(FlexGridSizer1);
125 FlexGridSizer1->Fit(panelGUI);
126 FlexGridSizer1->SetSizeHints(panelGUI);
127 panelPDF =
new wxPanel(notebook, idPanelPDF, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T(
"idPanelPDF"));
128 BoxSizer3 =
new wxBoxSizer(wxVERTICAL);
129 StaticBoxSizer1 =
new wxStaticBoxSizer(wxVERTICAL, panelPDF, _(
"Company"));
130 BoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
131 radioButtonName =
new wxRadioButton(panelPDF, idRadioButtonName, _(
"Name"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP, wxDefaultValidator, _T(
"idRadioButtonName"));
132 BoxSizer4->Add(radioButtonName, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
133 textCtrlName =
new wxTextCtrl(panelPDF, idTextCtrlName, wxEmptyString, wxDefaultPosition, wxSize(120,-1), 0, wxDefaultValidator, _T(
"idTextCtrlName"));
134 BoxSizer4->Add(textCtrlName, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5);
135 StaticBoxSizer1->Add(BoxSizer4, 1, wxALL|wxEXPAND, 0);
136 BoxSizer5 =
new wxBoxSizer(wxHORIZONTAL);
137 radioButtonLogo =
new wxRadioButton(panelPDF, idRadioButtonLogo, _(
"Logo"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"idRadioButtonLogo"));
138 BoxSizer5->Add(radioButtonLogo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
139 BoxSizer5->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
140 buttonLogo =
new wxButton(panelPDF, idButtonLogo, _(
"File..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"idButtonLogo"));
141 BoxSizer5->Add(buttonLogo, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
142 StaticBoxSizer1->Add(BoxSizer5, 1, wxALL|wxEXPAND, 0);
143 BoxSizer6 =
new wxBoxSizer(wxHORIZONTAL);
144 checkBoxMotto =
new wxCheckBox(panelPDF, idCheckBoxMotto, _(
"Motto"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"idCheckBoxMotto"));
145 checkBoxMotto->SetValue(
false);
146 BoxSizer6->Add(checkBoxMotto, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
147 textCtrlMotto =
new wxTextCtrl(panelPDF, idTextCtrlMotto, wxEmptyString, wxDefaultPosition, wxSize(120,-1), 0, wxDefaultValidator, _T(
"idTextCtrlMotto"));
148 BoxSizer6->Add(textCtrlMotto, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
149 StaticBoxSizer1->Add(BoxSizer6, 1, wxALL|wxEXPAND, 0);
150 BoxSizer3->Add(StaticBoxSizer1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
151 checkBoxPDFcharts =
new wxCheckBox(panelPDF, idCheckBoxPDFcharts, _(
"with charts"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"idCheckBoxPDFcharts"));
152 checkBoxPDFcharts->SetValue(
false);
153 BoxSizer3->Add(checkBoxPDFcharts, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
154 panelPDF->SetSizer(BoxSizer3);
155 BoxSizer3->Fit(panelPDF);
156 BoxSizer3->SetSizeHints(panelPDF);
157 notebook->AddPage(panelGUI, _(
"GUI"),
false);
158 notebook->AddPage(panelPDF, _(
"PDF"),
false);
159 BoxSizer1->Add(notebook, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
160 BoxSizer2 =
new wxBoxSizer(wxHORIZONTAL);
161 buttonCancel =
new wxButton(
this, wxID_CANCEL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"wxID_CANCEL"));
162 BoxSizer2->Add(buttonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
163 BoxSizer2->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
164 buttonOK =
new wxButton(
this, wxID_OK, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"wxID_OK"));
165 BoxSizer2->Add(buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
166 BoxSizer1->Add(BoxSizer2, 0, wxALL|wxEXPAND, 5);
168 BoxSizer1->Fit(
this);
169 BoxSizer1->SetSizeHints(
this);
173 checkBoxLog->SetValidator ( wxGenericValidator (&log2text) );
174 checkBoxLimit->SetValidator ( wxGenericValidator (&limitRow) );
175 spinCtrlLimit->SetValidator ( wxGenericValidator (&rowLimit) );
176 choiceLib->SetValidator ( wxGenericValidator (&lib) );
177 radioButtonLogo->SetValidator ( wxGenericValidator (&logo4pdf) );
178 textCtrlName->SetValidator ( wxTextValidator (wxFILTER_NONE, &companyName_or_logoPath) );
179 checkBoxMotto->SetValidator ( wxGenericValidator (&motto4pdf) );
180 textCtrlMotto->SetValidator ( wxTextValidator (wxFILTER_NONE, &companyMotto) );
181 checkBoxPDFcharts->SetValidator ( wxGenericValidator (&pdfCharts) );
182 Fit(); SetMaxSize ( GetSize() );
228 wxFileDialog logoDlg (
this, _(
"Select the logo file"),
229 wxStandardPaths::Get().GetDocumentsDir(), wxEmptyString,
230 "PNG|*.png|GIF|*.gif|JPEG|*.jpg", wxFD_OPEN|wxFD_FILE_MUST_EXIST);
231 if (logoDlg.ShowModal() == wxID_CANCEL)
return;
A dialog to modify YATiSh settings.
wxCheckBox * checkBoxMotto
static const long idCheckBoxPDFcharts
wxRadioButton * radioButtonName
static const long ID_STATICTEXT2
static const long idButtonLogo
static const long idChoiceLib
static const long idPanelGUI
static const long idCheckBoxMotto
wxString companyName_or_logoPath
static const long idRadioButtonName
static const long ID_STATICTEXT1
void OnSpinCtrlLimitUpdate(wxUpdateUIEvent &)
void OnButtonLogoUpdate(wxUpdateUIEvent &)
static const long idCheckBoxLimit
static const long idRadioButtonLogo
static const long idNotebook
static const long ID_STATICTEXT3
static const long idSpinCtrlLimit
static const long idTextCtrlMotto
wxTextCtrl * textCtrlName
wxCheckBox * checkBoxLimit
static const long idPanelPDF
static const long idTextCtrlName
static const long ID_STATICTEXT4
void OnTextCtrlMottoUpdate(wxUpdateUIEvent &)
static const long idCheckBoxLog
void OnButtonLogoClick(wxCommandEvent &event)
wxRadioButton * radioButtonLogo
void OnTextCtrlNameUpdate(wxUpdateUIEvent &)
As its names implies: the class holding YATiSh settings.
int rowLimit
...to rowLimit lines.
bool pdfCharts
PDF charts?
wxString companyName_or_logoPath
Either the company name or its logo.
bool motto4pdf
Print the company motto in the PDF header?
ChartLib lib
A ChartLib enumerates the graphic libraries available for panel #3.
bool log2text
If True, error/warning messages will be forwarded to the bottom of the main frame.
~Settings()
The Settings destructor saves itself to the configuration file.
bool limitRow
If True, the listing in panel #2 will be limited...
wxString companyMotto
Slogan or short description of the purpose.
bool logo4pdf
If True the company name is replaced by its logo in the PDF header.
Settings()
The Settings constructor retrieves itself from the configuration file.
ChartLib
Same order as yatishSettings::choiceLib.