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  * Copyright: Lionel ()
7  * License:
8  **************************************************************/
9 
10 #ifndef MATHPLOTCONFIG_H_INCLUDED
11 #define MATHPLOTCONFIG_H_INCLUDED
12 
13 //(*Headers(MathPlotConfigDialog)
14 #include <wx/button.h>
15 #include <wx/checkbox.h>
16 #include <wx/choice.h>
17 #include <wx/dialog.h>
18 #include <wx/notebook.h>
19 #include <wx/panel.h>
20 #include <wx/radiobut.h>
21 #include <wx/sizer.h>
22 #include <wx/spinctrl.h>
23 #include <wx/stattext.h>
24 #include <wx/textctrl.h>
25 //*)
26 
27 #include <wx/colordlg.h>
28 #include <wx/fontdlg.h>
29 #include <wx/valnum.h>
30 #include <wx/fileconf.h>
31 
32 #ifdef ENABLE_MP_NAMESPACE
33  namespace MathPlot {
34 #endif // ENABLE_MP_NAMESPACE
35 
36 class WXDLLIMPEXP_MATHPLOT mpWindow;
37 class WXDLLIMPEXP_MATHPLOT mpLayer;
38 class WXDLLIMPEXP_MATHPLOT mpFunction;
39 class WXDLLIMPEXP_MATHPLOT mpLine;
40 class WXDLLIMPEXP_MATHPLOT mpInfoCoords;
41 class WXDLLIMPEXP_MATHPLOT mpInfoLegend;
42 class WXDLLIMPEXP_MATHPLOT mpScale;
43 class WXDLLIMPEXP_MATHPLOT mpText;
44 
48 class MathPlotConfigSettings : public wxFileConfig
49 {
50  public:
51  MathPlotConfigSettings(const wxString& localFilename) :
52  wxFileConfig(wxEmptyString, wxEmptyString, localFilename) {}
53  virtual ~MathPlotConfigSettings() {}
54 
55  void SetSettings(wxWindow* win);
56  void GetSettings(wxWindow* win);
57  protected:
58  void DoPosition(bool set, wxWindow *win);
59  void DoRecursiveSearch(bool set, wxWindow *win, const wxString &path = wxEmptyString, int level = 0);
60 };
61 
65 typedef enum __ConfigPageIndex
66 {
67  mpcpiNone = -1,
68  mpcpiGeneral = 0,
69  mpcpiLegend,
70  mpcpiAxis,
71  mpcpiSeries,
72  mpcpiLines
74 
75 class MathPlotConfigDialog: public wxDialog
76 {
77  public:
78 
79  MathPlotConfigDialog(wxWindow *parent, wxWindowID id = -1);
80  virtual ~MathPlotConfigDialog();
81 
82  void Initialize(mpConfigPageId id = mpcpiNone);
83  void SelectChoiceSerie(unsigned int serie);
84  void CreateSettingsFile(const wxString& filename, const wxString& path = wxEmptyString, bool apply = false);
85  void ApplySettings(void);
90  {
91  return m_settings;
92  }
93 
94  private:
95 
96  mpWindow* m_plot;
97  MathPlotConfigSettings* m_settings;
98  wxButton* colourButton;
99  mpText* CurrentTitle;
100  mpInfoLegend* CurrentLegend;
101  mpInfoCoords* CurrentCoords;
102  mpScale* CurrentScale;
103  mpFunction* CurrentSerie;
104  mpLine* CurrentLine;
105  wxChoice* CurrentChoice;
106  bool fontTitleChanged;
107  bool fontLegendChanged;
108  bool fontAxisChanged;
109  // Margin validator
110  unsigned int int_top, int_bottom, int_left, int_right, int_extra;
111  int scale_offset;
112  // Scale validator
113  double scale_min, scale_max;
114  // Line position validator
115  double line_value;
116  bool CheckBar;
117  bool SerieVisibleChange;
118 
119  //(*Handlers(MathPlotConfigDialog)
120  void OnQuit(wxCommandEvent& event);
121  void OnnbConfigPageChanged(wxNotebookEvent& event);
122  void OnbColorClick(wxCommandEvent& event);
123  void OnChoiceSeries(wxCommandEvent& event);
124  void OnAxisSelect(wxCommandEvent& event);
125  void OncbFormatSelect(wxCommandEvent& event);
126  void OncbAutoScaleClick(wxCommandEvent& event);
127  void OnbApplyClick(wxCommandEvent& event);
128  void OnbFontClick(wxCommandEvent& event);
129  void OnbDelSeriesClick(wxCommandEvent& event);
130  void OnbAddAxisClick(wxCommandEvent& event);
131  void OnChoiceLinesSelect(wxCommandEvent& event);
132  void OnbAddLinesClick(wxCommandEvent& event);
133  void OnbDelLinesClick(wxCommandEvent& event);
134  void OnbDelAxisClick(wxCommandEvent& event);
135  //*)
136 
137  //(*Identifiers(MathPlotConfigDialog)
138  //*)
139 
140  //(*Declarations(MathPlotConfigDialog)
141  wxBoxSizer* sizerAxis;
142  wxBoxSizer* sizerLines;
143  wxBoxSizer* sizerMain;
144  wxButton* bAddLines;
145  wxButton* bAddXAxis;
146  wxButton* bAddYAxis;
147  wxButton* bApply;
148  wxButton* bAxisPenColor;
149  wxButton* bBGColor;
150  wxButton* bClose;
151  wxButton* bCoordBrushColor;
152  wxButton* bDelAxis;
153  wxButton* bDelLines;
154  wxButton* bDelSeries;
155  wxButton* bFontAxis;
156  wxButton* bFontLegend;
157  wxButton* bFontTitle;
158  wxButton* bLegendBrushColor;
159  wxButton* bLinesPenColor;
160  wxButton* bSeriesBrushColor;
161  wxButton* bSeriesPenColor;
162  wxCheckBox* cbAutoScale;
163  wxCheckBox* cbAxisOutside;
164  wxCheckBox* cbAxisVisible;
165  wxCheckBox* cbBar;
166  wxCheckBox* cbCoordOutside;
167  wxCheckBox* cbCoordVisible;
168  wxCheckBox* cbCoordinates;
169  wxCheckBox* cbDrawBox;
170  wxCheckBox* cbGridVisible;
171  wxCheckBox* cbLegendVisible;
172  wxCheckBox* cbLinesOutside;
173  wxCheckBox* cbLinesShowName;
174  wxCheckBox* cbLinesVisible;
175  wxCheckBox* cbLogAxis;
176  wxCheckBox* cbMagnetize;
177  wxCheckBox* cbSeriesContinuity;
178  wxCheckBox* cbSeriesOutside;
179  wxCheckBox* cbSeriesShowName;
180  wxCheckBox* cbSeriesVisible;
181  wxCheckBox* cbTitleVisible;
182  wxCheckBox* cbTractable;
183  wxChoice* ChoiceAxis;
184  wxChoice* ChoiceLeftMouseAction;
185  wxChoice* ChoiceLines;
186  wxChoice* ChoiceLinesYAxis;
187  wxChoice* ChoiceSeries;
188  wxChoice* ChoiceSeriesYAxis;
189  wxChoice* cbAxisPenStyle;
190  wxChoice* cbAxisPenWidth;
191  wxChoice* cbAxisPosition;
192  wxChoice* cbCoord;
193  wxChoice* cbCoordBrushStyle;
194  wxChoice* cbFormat;
195  wxChoice* cbLegendBrushStyle;
196  wxChoice* cbLegendDirection;
197  wxChoice* cbLegendPosition;
198  wxChoice* cbLegendStyle;
199  wxChoice* cbLinesPenStyle;
200  wxChoice* cbLinesPenWidth;
201  wxChoice* cbSeriesBrushStyle;
202  wxChoice* cbSeriesPenStyle;
203  wxChoice* cbSeriesPenWidth;
204  wxChoice* cbSeriesSymbolType;
205  wxNotebook* nbConfig;
206  wxPanel* Panel1;
207  wxPanel* Panel2;
208  wxPanel* Panel3;
209  wxPanel* Panel4;
210  wxPanel* Panel5;
211  wxPanel* pLines;
212  wxRadioButton* rbLinesDirection;
213  wxSpinCtrl* cbSeriesStep;
214  wxSpinCtrl* cbSeriesSymbolSize;
215  wxStaticText* StaticText10;
216  wxStaticText* StaticText11;
217  wxStaticText* StaticText12;
218  wxStaticText* StaticText13;
219  wxStaticText* StaticText14;
220  wxStaticText* StaticText16;
221  wxStaticText* StaticText17;
222  wxStaticText* StaticText18;
223  wxStaticText* StaticText19;
224  wxStaticText* StaticText1;
225  wxStaticText* StaticText20;
226  wxStaticText* StaticText21;
227  wxStaticText* StaticText22;
228  wxStaticText* StaticText23;
229  wxStaticText* StaticText24;
230  wxStaticText* StaticText25;
231  wxStaticText* StaticText26;
232  wxStaticText* StaticText27;
233  wxStaticText* StaticText28;
234  wxStaticText* StaticText29;
235  wxStaticText* StaticText2;
236  wxStaticText* StaticText30;
237  wxStaticText* StaticText31;
238  wxStaticText* StaticText32;
239  wxStaticText* StaticText33;
240  wxStaticText* StaticText34;
241  wxStaticText* StaticText35;
242  wxStaticText* StaticText36;
243  wxStaticText* StaticText37;
244  wxStaticText* StaticText38;
245  wxStaticText* StaticText39;
246  wxStaticText* StaticText3;
247  wxStaticText* StaticText40;
248  wxStaticText* StaticText41;
249  wxStaticText* StaticText4;
250  wxStaticText* StaticText5;
251  wxStaticText* StaticText6;
252  wxStaticText* StaticText7;
253  wxStaticText* StaticText8;
254  wxStaticText* StaticText9;
255  wxStaticText* stLinesYIndexLabel;
256  wxTextCtrl* edAxisName;
257  wxTextCtrl* edExtraMargin;
258  wxTextCtrl* edFormat;
259  wxTextCtrl* edLinesName;
260  wxTextCtrl* edLinesValue;
261  wxTextCtrl* edMarginBottom;
262  wxTextCtrl* edMarginLeft;
263  wxTextCtrl* edMarginRight;
264  wxTextCtrl* edMarginTop;
265  wxTextCtrl* edScaleMax;
266  wxTextCtrl* edScaleMin;
267  wxTextCtrl* edSeriesName;
268  wxTextCtrl* edTitle;
269  //*)
270 
271  void Apply(int pageIndex, bool updateFont = false);
272  void UpdateSelectedSerie(void);
273  void UpdateSelectedLine(void);
274  void UpdateAxis(void);
275  void FillYAxisList(wxChoice* yChoice, bool clearChoice = true);
276 
277  void DoButtonColour(wxButton* button, const wxColour& colour);
278  void DoApplyColour(const wxColour& colour);
279  void UpdateFont(mpLayer* layer, wxButton* button, bool get_set);
280  void SetFontChildren(wxButton* p, const wxFontData& fontdata);
281 
282  wxBrushStyle IdToBrushStyle(int id);
283  int BrushStyleToId(wxBrushStyle style);
284 
285  DECLARE_EVENT_TABLE()
286 };
287 
288 #ifdef ENABLE_MP_NAMESPACE
289  } // namespace MathPlot
290 #endif // ENABLE_MP_NAMESPACE
291 
292 #endif // MATHPLOTCONFIG_H_INCLUDED
MathPlotConfigSettings * GetSettingsHandle(void)
Give access to m_settings if we want to save some others parameters.
Definition: MathPlotConfig.h:89
Abstract class providing a line.
Definition: mathplot.h:1478
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2708
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1282
Implementing MathPlotConfigDialogBuilder.
Definition: MathPlotConfig.h:75
Helper class to save/restore configuration.
Definition: MathPlotConfig.h:48
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:1196
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1378
enum __ConfigPageIndex mpConfigPageId
The list of index of the page of the config window.
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:2208
Plot layer implementing a text string.
Definition: mathplot.h:3918
Plot layer, abstract base class.
Definition: mathplot.h:716