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 mpSettings : public wxFileConfig
49 {
50  public:
51  mpSettings(const wxString& localFilename) :
52  wxFileConfig(wxEmptyString, wxEmptyString, localFilename) {}
53  virtual ~mpSettings() {}
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 = _(""), int level = 0);
60 };
61 
65 typedef enum __ConfigPageIndex
66 {
67  mpcpiNone = -1,
68  mpcpiGeneral = 0,
69  mpcpiLegend,
70  mpcpiAxis,
71  mpcpiSeries,
72  mpcpiLines
73 } mpConfigPageId;
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  mpSettings* 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  unsigned int int_top, int_bottom, int_left, int_right, int_extra;
110  int scale_offset;
111  double scale_min, scale_max;
112  double line_value;
113  bool CheckBar;
114  bool SerieVisibleChange;
115 
116  //(*Handlers(MathPlotConfigDialog)
117  void OnQuit(wxCommandEvent& event);
118  void OnnbConfigPageChanged(wxNotebookEvent& event);
119  void OnbColorClick(wxCommandEvent& event);
120  void OnChoiceSeries(wxCommandEvent& event);
121  void OnAxisSelect(wxCommandEvent& event);
122  void OncbFormatSelect(wxCommandEvent& event);
123  void OncbAutoScaleClick(wxCommandEvent& event);
124  void OnbApplyClick(wxCommandEvent& event);
125  void OnbFontClick(wxCommandEvent& event);
126  void OnbDelSeriesClick(wxCommandEvent& event);
127  void OnbAddAxisClick(wxCommandEvent& event);
128  void OnChoiceLinesSelect(wxCommandEvent& event);
129  void OnbAddLinesClick(wxCommandEvent& event);
130  void OnbDelLinesClick(wxCommandEvent& event);
131  void OnbDelAxisClick(wxCommandEvent& event);
132  //*)
133 
134  //(*Identifiers(MathPlotConfigDialog)
135  //*)
136 
137  //(*Declarations(MathPlotConfigDialog)
138  wxBoxSizer* sizerAxis;
139  wxBoxSizer* sizerLines;
140  wxBoxSizer* sizerMain;
141  wxButton* bAddLines;
142  wxButton* bAddXAxis;
143  wxButton* bAddYAxis;
144  wxButton* bApply;
145  wxButton* bAxisPenColor;
146  wxButton* bBGColor;
147  wxButton* bClose;
148  wxButton* bCoordBrushColor;
149  wxButton* bDelAxis;
150  wxButton* bDelLines;
151  wxButton* bDelSeries;
152  wxButton* bFontAxis;
153  wxButton* bFontLegend;
154  wxButton* bFontTitle;
155  wxButton* bLegendBrushColor;
156  wxButton* bLinesPenColor;
157  wxButton* bSeriesBrushColor;
158  wxButton* bSeriesPenColor;
159  wxCheckBox* cbAutoScale;
160  wxCheckBox* cbAxisOutside;
161  wxCheckBox* cbAxisVisible;
162  wxCheckBox* cbBar;
163  wxCheckBox* cbCoordOutside;
164  wxCheckBox* cbCoordVisible;
165  wxCheckBox* cbCoordinates;
166  wxCheckBox* cbDrawBox;
167  wxCheckBox* cbGridVisible;
168  wxCheckBox* cbLegendVisible;
169  wxCheckBox* cbLinesOutside;
170  wxCheckBox* cbLinesShowName;
171  wxCheckBox* cbLinesVisible;
172  wxCheckBox* cbLogAxis;
173  wxCheckBox* cbMagnetize;
174  wxCheckBox* cbSeriesContinuity;
175  wxCheckBox* cbSeriesOutside;
176  wxCheckBox* cbSeriesShowName;
177  wxCheckBox* cbSeriesVisible;
178  wxCheckBox* cbTitleVisible;
179  wxCheckBox* cbTractable;
180  wxChoice* ChoiceAxis;
181  wxChoice* ChoiceLeftMouseAction;
182  wxChoice* ChoiceLines;
183  wxChoice* ChoiceLinesYAxis;
184  wxChoice* ChoiceSeries;
185  wxChoice* ChoiceSeriesYAxis;
186  wxChoice* cbAxisPenStyle;
187  wxChoice* cbAxisPenWidth;
188  wxChoice* cbAxisPosition;
189  wxChoice* cbCoord;
190  wxChoice* cbCoordBrushStyle;
191  wxChoice* cbFormat;
192  wxChoice* cbLegendBrushStyle;
193  wxChoice* cbLegendDirection;
194  wxChoice* cbLegendPosition;
195  wxChoice* cbLegendStyle;
196  wxChoice* cbLinesPenStyle;
197  wxChoice* cbLinesPenWidth;
198  wxChoice* cbSeriesBrushStyle;
199  wxChoice* cbSeriesPenStyle;
200  wxChoice* cbSeriesPenWidth;
201  wxChoice* cbSeriesSymbolType;
202  wxNotebook* nbConfig;
203  wxPanel* Panel1;
204  wxPanel* Panel2;
205  wxPanel* Panel3;
206  wxPanel* Panel4;
207  wxPanel* Panel5;
208  wxPanel* pLines;
209  wxRadioButton* rbLinesDirection;
210  wxSpinCtrl* cbSeriesStep;
211  wxSpinCtrl* cbSeriesSymbolSize;
212  wxStaticText* StaticText10;
213  wxStaticText* StaticText11;
214  wxStaticText* StaticText12;
215  wxStaticText* StaticText13;
216  wxStaticText* StaticText14;
217  wxStaticText* StaticText16;
218  wxStaticText* StaticText17;
219  wxStaticText* StaticText18;
220  wxStaticText* StaticText19;
221  wxStaticText* StaticText1;
222  wxStaticText* StaticText20;
223  wxStaticText* StaticText21;
224  wxStaticText* StaticText22;
225  wxStaticText* StaticText23;
226  wxStaticText* StaticText24;
227  wxStaticText* StaticText25;
228  wxStaticText* StaticText26;
229  wxStaticText* StaticText27;
230  wxStaticText* StaticText28;
231  wxStaticText* StaticText29;
232  wxStaticText* StaticText2;
233  wxStaticText* StaticText30;
234  wxStaticText* StaticText31;
235  wxStaticText* StaticText32;
236  wxStaticText* StaticText33;
237  wxStaticText* StaticText34;
238  wxStaticText* StaticText35;
239  wxStaticText* StaticText36;
240  wxStaticText* StaticText37;
241  wxStaticText* StaticText38;
242  wxStaticText* StaticText39;
243  wxStaticText* StaticText3;
244  wxStaticText* StaticText40;
245  wxStaticText* StaticText41;
246  wxStaticText* StaticText4;
247  wxStaticText* StaticText5;
248  wxStaticText* StaticText6;
249  wxStaticText* StaticText7;
250  wxStaticText* StaticText8;
251  wxStaticText* StaticText9;
252  wxStaticText* stLinesYIndexLabel;
253  wxTextCtrl* edAxisName;
254  wxTextCtrl* edExtraMargin;
255  wxTextCtrl* edFormat;
256  wxTextCtrl* edLinesName;
257  wxTextCtrl* edLinesValue;
258  wxTextCtrl* edMarginBottom;
259  wxTextCtrl* edMarginLeft;
260  wxTextCtrl* edMarginRight;
261  wxTextCtrl* edMarginTop;
262  wxTextCtrl* edScaleMax;
263  wxTextCtrl* edScaleMin;
264  wxTextCtrl* edSeriesName;
265  wxTextCtrl* edTitle;
266  //*)
267 
268  void Apply(int pageIndex, bool updateFont = false);
269  void UpdateSelectedSerie(void);
270  void UpdateSelectedLine(void);
271  void UpdateAxis(void);
272  void FillYAxisList(wxChoice* yChoice, bool clearChoice = true);
273 
274  void DoButtonColour(wxButton* button, const wxColour& colour);
275  void DoApplyColour(const wxColour& colour);
276  void UpdateFont(mpLayer* layer, wxButton* button, bool get_set);
277  void SetFontChildren(wxButton* p, const wxFontData& fontdata);
278 
279  wxBrushStyle IdToBrushStyle(int id);
280  int BrushStyleToId(wxBrushStyle style);
281 
282  DECLARE_EVENT_TABLE()
283 };
284 
285 #ifdef ENABLE_MP_NAMESPACE
286  } // namespace MathPlot
287 #endif // ENABLE_MP_NAMESPACE
288 
289 #endif // MATHPLOTCONFIG_H_INCLUDED
Abstract class providing a line.
Definition: mathplot.h:1438
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2666
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1242
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:1156
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1338
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:2168
Plot layer implementing a text string.
Definition: mathplot.h:3822
mpSettings * GetSettingsHandle(void)
Give access to m_settings if we want to save some others parameters.
Definition: MathPlotConfig.h:89
Plot layer, abstract base class.
Definition: mathplot.h:676