MathPlot
MathPlotConfig.h
1 /***************************************************************
2  * Name: MathPlotConfig.h (included from mathplot.h when ENABLE_MP_CONFIG defined)
3  * Purpose: Defines Application Frame
4  * Author: Lionel ()
5  * Created: 2021-01-24
6  * Last edit: 2026-03-27
7  * Copyright: Lionel ()
8  * License:
9  **************************************************************/
10 
11 #ifndef MATHPLOTCONFIG_H_INCLUDED
12 #define MATHPLOTCONFIG_H_INCLUDED
13 
14 //(*Headers(MathPlotConfigDialog)
15 #include <wx/button.h>
16 #include <wx/checkbox.h>
17 #include <wx/choice.h>
18 #include <wx/dialog.h>
19 #include <wx/notebook.h>
20 #include <wx/panel.h>
21 #include <wx/radiobut.h>
22 #include <wx/sizer.h>
23 #include <wx/spinctrl.h>
24 #include <wx/stattext.h>
25 #include <wx/textctrl.h>
26 //*)
27 
28 #include <wx/colordlg.h>
29 #include <wx/fontdlg.h>
30 #include <wx/valnum.h>
31 #include <wx/fileconf.h>
32 
33 #ifdef ENABLE_MP_NAMESPACE
34  namespace MathPlot {
35 #endif // ENABLE_MP_NAMESPACE
36 
45 
49 class MathPlotConfigSettings : public wxFileConfig
50 {
51  public:
56  MathPlotConfigSettings(const wxString& localFilename) :
57  wxFileConfig(wxEmptyString, wxEmptyString, localFilename) {}
58  virtual ~MathPlotConfigSettings() {}
59 
64  void SetSettings(wxWindow* win);
65 
70  void GetSettings(wxWindow* win);
71 
72  protected:
78  void DoPosition(bool set, wxWindow *win);
79 
87  void DoRecursiveSearch(bool set, wxWindow *win, const wxString &path = wxEmptyString, int level = 0);
88 };
89 
93 typedef enum __ConfigPageIndex
94 {
95  mpcpiNone = -1,
96  mpcpiGeneral = 0,
97  mpcpiLegend,
98  mpcpiAxis,
99  mpcpiSeries,
100  mpcpiLines
102 
112 class MathPlotConfigDialog: public wxDialog
113 {
114  public:
115 
121  MathPlotConfigDialog(wxWindow *parent, wxWindowID id = -1);
122  virtual ~MathPlotConfigDialog();
123 
128  void Initialize(mpConfigPageId id = mpcpiNone);
129 
134  void SelectChoiceSerie(unsigned int serie);
135 
142  void CreateSettingsFile(const wxString& filename, const wxString& path = wxEmptyString, bool apply = false);
143 
147  void ApplySettings(void);
148 
153  {
154  return m_settings;
155  }
156 
157  private:
158 
159  mpWindow* m_plot;
160  MathPlotConfigSettings* m_settings;
161  wxButton* colourButton;
162  mpText* CurrentTitle;
163  mpInfoLegend* CurrentLegend;
164  mpInfoCoords* CurrentCoords;
165  mpScale* CurrentScale;
166  mpFunction* CurrentSerie;
167  mpLine* CurrentLine;
168  wxChoice* CurrentChoice;
169  bool fontTitleChanged;
170  bool fontLegendChanged;
171  bool fontAxisChanged;
172  // Margin validator
173  unsigned int int_top, int_bottom, int_left, int_right, int_extra;
174  int scale_offset;
175  // Scale validator
176  double scale_min, scale_max;
177  // Line position validator
178  double line_value;
179  bool CheckBar;
180  bool SerieVisibleChange;
181 
182  //(*Handlers(MathPlotConfigDialog)
183  void OnQuit(wxCommandEvent& event);
184  void OnnbConfigPageChanged(wxNotebookEvent& event);
185  void OnbColorClick(wxCommandEvent& event);
186  void OnChoiceSeries(wxCommandEvent& event);
187  void OnAxisSelect(wxCommandEvent& event);
188  void OncbFormatSelect(wxCommandEvent& event);
189  void OncbAutoScaleClick(wxCommandEvent& event);
190  void OnbApplyClick(wxCommandEvent& event);
191  void OnbFontClick(wxCommandEvent& event);
192  void OnbDelSeriesClick(wxCommandEvent& event);
193  void OnbAddAxisClick(wxCommandEvent& event);
194  void OnChoiceLinesSelect(wxCommandEvent& event);
195  void OnbAddLinesClick(wxCommandEvent& event);
196  void OnbDelLinesClick(wxCommandEvent& event);
197  void OnbDelAxisClick(wxCommandEvent& event);
198  void OncbSeriesShowNameClick(wxCommandEvent& event);
199  //*)
200 
201  //(*Identifiers(MathPlotConfigDialog)
202  //*)
203 
204  //(*Declarations(MathPlotConfigDialog)
205  wxBoxSizer* sizerAxis;
206  wxBoxSizer* sizerLines;
207  wxBoxSizer* sizerMain;
208  wxButton* bAddLines;
209  wxButton* bAddXAxis;
210  wxButton* bAddYAxis;
211  wxButton* bApply;
212  wxButton* bAxisPenColor;
213  wxButton* bBGColor;
214  wxButton* bClose;
215  wxButton* bCoordBrushColor;
216  wxButton* bDelAxis;
217  wxButton* bDelLines;
218  wxButton* bDelSeries;
219  wxButton* bFontAxis;
220  wxButton* bFontLegend;
221  wxButton* bFontTitle;
222  wxButton* bLegendBrushColor;
223  wxButton* bLinesPenColor;
224  wxButton* bSeriesBrushColor;
225  wxButton* bSeriesPenColor;
226  wxCheckBox* cbAutoScale;
227  wxCheckBox* cbAxisOutside;
228  wxCheckBox* cbAxisVisible;
229  wxCheckBox* cbBar;
230  wxCheckBox* cbCoordOutside;
231  wxCheckBox* cbCoordVisible;
232  wxCheckBox* cbCoordinates;
233  wxCheckBox* cbDrawBox;
234  wxCheckBox* cbGridVisible;
235  wxCheckBox* cbLegendVisible;
236  wxCheckBox* cbLinesOutside;
237  wxCheckBox* cbLinesShowName;
238  wxCheckBox* cbLinesVisible;
239  wxCheckBox* cbLogAxis;
240  wxCheckBox* cbMagnetize;
241  wxCheckBox* cbSeriesContinuity;
242  wxCheckBox* cbSeriesOutside;
243  wxCheckBox* cbSeriesShowName;
244  wxCheckBox* cbSeriesVisible;
245  wxCheckBox* cbTitleVisible;
246  wxCheckBox* cbTractable;
247  wxChoice* ChoiceAxis;
248  wxChoice* ChoiceLeftMouseAction;
249  wxChoice* ChoiceLines;
250  wxChoice* ChoiceLinesYAxis;
251  wxChoice* ChoiceSeries;
252  wxChoice* ChoiceSeriesYAxis;
253  wxChoice* cbAxisPenStyle;
254  wxChoice* cbAxisPenWidth;
255  wxChoice* cbAxisPosition;
256  wxChoice* cbCoord;
257  wxChoice* cbCoordBrushStyle;
258  wxChoice* cbFormat;
259  wxChoice* cbLegendBrushStyle;
260  wxChoice* cbLegendDirection;
261  wxChoice* cbLegendPosition;
262  wxChoice* cbLegendStyle;
263  wxChoice* cbLinesPenStyle;
264  wxChoice* cbLinesPenWidth;
265  wxChoice* cbSeriesBrushStyle;
266  wxChoice* cbSeriesNamePosition;
267  wxChoice* cbSeriesPenStyle;
268  wxChoice* cbSeriesPenWidth;
269  wxChoice* cbSeriesSymbolType;
270  wxNotebook* nbConfig;
271  wxPanel* Panel1;
272  wxPanel* Panel2;
273  wxPanel* Panel3;
274  wxPanel* Panel4;
275  wxPanel* Panel5;
276  wxPanel* pLines;
277  wxRadioButton* rbLinesDirection;
278  wxSpinCtrl* cbSeriesStep;
279  wxSpinCtrl* cbSeriesSymbolSize;
280  wxStaticText* StaticText10;
281  wxStaticText* StaticText11;
282  wxStaticText* StaticText12;
283  wxStaticText* StaticText13;
284  wxStaticText* StaticText14;
285  wxStaticText* StaticText15;
286  wxStaticText* StaticText16;
287  wxStaticText* StaticText17;
288  wxStaticText* StaticText18;
289  wxStaticText* StaticText19;
290  wxStaticText* StaticText1;
291  wxStaticText* StaticText20;
292  wxStaticText* StaticText21;
293  wxStaticText* StaticText22;
294  wxStaticText* StaticText23;
295  wxStaticText* StaticText24;
296  wxStaticText* StaticText25;
297  wxStaticText* StaticText26;
298  wxStaticText* StaticText27;
299  wxStaticText* StaticText28;
300  wxStaticText* StaticText29;
301  wxStaticText* StaticText2;
302  wxStaticText* StaticText30;
303  wxStaticText* StaticText31;
304  wxStaticText* StaticText32;
305  wxStaticText* StaticText33;
306  wxStaticText* StaticText34;
307  wxStaticText* StaticText35;
308  wxStaticText* StaticText36;
309  wxStaticText* StaticText37;
310  wxStaticText* StaticText38;
311  wxStaticText* StaticText39;
312  wxStaticText* StaticText3;
313  wxStaticText* StaticText40;
314  wxStaticText* StaticText41;
315  wxStaticText* StaticText4;
316  wxStaticText* StaticText5;
317  wxStaticText* StaticText6;
318  wxStaticText* StaticText7;
319  wxStaticText* StaticText8;
320  wxStaticText* StaticText9;
321  wxStaticText* stLinesYIndexLabel;
322  wxTextCtrl* edAxisName;
323  wxTextCtrl* edExtraMargin;
324  wxTextCtrl* edFormat;
325  wxTextCtrl* edLinesName;
326  wxTextCtrl* edLinesValue;
327  wxTextCtrl* edMarginBottom;
328  wxTextCtrl* edMarginLeft;
329  wxTextCtrl* edMarginRight;
330  wxTextCtrl* edMarginTop;
331  wxTextCtrl* edScaleMax;
332  wxTextCtrl* edScaleMin;
333  wxTextCtrl* edSeriesName;
334  wxTextCtrl* edTitle;
335  //*)
336 
337  void Apply(int pageIndex, bool updateFont = false);
338  void UpdateSelectedSerie(void);
339  void UpdateSelectedLine(void);
340  void UpdateAxis(void);
341  void FillYAxisList(wxChoice* yChoice, bool clearChoice = true);
342 
343  void DoButtonColour(wxButton* button, const wxColour& colour);
344  void DoApplyColour(const wxColour& colour);
345  void UpdateFont(mpLayer* layer, wxButton* button, bool get_set);
346  void SetFontChildren(wxButton* p, const wxFontData& fontdata);
347 
348  wxBrushStyle IdToBrushStyle(int id);
349  int BrushStyleToId(wxBrushStyle style);
350 
351  DECLARE_EVENT_TABLE()
352 };
353 
354 #ifdef ENABLE_MP_NAMESPACE
355  } // namespace MathPlot
356 #endif // ENABLE_MP_NAMESPACE
357 
358 #endif // MATHPLOTCONFIG_H_INCLUDED
MathPlotConfigSettings * GetSettingsHandle(void)
Give access to m_settings if we want to save some others parameters.
Definition: MathPlotConfig.h:152
Abstract class providing a line.
Definition: mathplot.h:1588
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2932
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1389
Dialog box for configuring the plot&#39;s layer objects In this dialog, you can configure: ...
Definition: MathPlotConfig.h:112
MathPlotConfigSettings(const wxString &localFilename)
Manages the backup of configuration window data.
Definition: MathPlotConfig.h:56
#define WXDLLIMPEXP_MATHPLOT
Definition uses windows dll to export function.
Definition: mathplot.h:66
Helper class to save/restore configuration.
Definition: MathPlotConfig.h:49
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:1302
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1485
enum __ConfigPageIndex mpConfigPageId
The list of index of the page of the config window.
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:2378
Plot layer implementing a text string.
Definition: mathplot.h:4194
Plot layer, abstract base class.
Definition: mathplot.h:818