MathPlot
MathPlotConfig.h
Go to the documentation of this file.
1 #ifndef __MathPlotConfig__
2 #define __MathPlotConfig__
3 
9 #include "MathPlotConfigBuilder.h"
10 
12 
13 #include <wx/colordlg.h>
14 #include <wx/fontdlg.h>
15 #include <wx/fileconf.h>
16 #include "mathplot.h"
17 
18 #ifdef ENABLE_MP_NAMESPACE
19  namespace MathPlot {
20 #endif // ENABLE_MP_NAMESPACE
21 
22 class WXDLLIMPEXP_MATHPLOT mpWindow;
23 class WXDLLIMPEXP_MATHPLOT mpLayer;
24 class WXDLLIMPEXP_MATHPLOT mpFunction;
25 class WXDLLIMPEXP_MATHPLOT mpLine;
26 class WXDLLIMPEXP_MATHPLOT mpInfoCoords;
27 class WXDLLIMPEXP_MATHPLOT mpInfoLegend;
28 class WXDLLIMPEXP_MATHPLOT mpScale;
29 class WXDLLIMPEXP_MATHPLOT mpText;
30 
34 class MathPlotConfigSettings : public wxFileConfig
35 {
36  public:
37  MathPlotConfigSettings(const wxString& localFilename) :
38  wxFileConfig(wxEmptyString, wxEmptyString, localFilename) {}
39  virtual ~MathPlotConfigSettings() {}
40 
41  void SetSettings(wxWindow* win);
42  void GetSettings(wxWindow* win);
43  protected:
44  void DoPosition(bool set, wxWindow *win);
45  void DoRecursiveSearch(bool set, wxWindow *win, const wxString &path = wxEmptyString, int level = 0);
46 };
47 
51 typedef enum __ConfigPageIndex
52 {
53  mpcpiNone = -1,
54  mpcpiGeneral = 0,
55  mpcpiLegend,
56  mpcpiAxis,
57  mpcpiSeries,
58  mpcpiLines
60 
63 {
64  public:
66  MathPlotConfigDialog( wxWindow* parent );
68 
69  virtual ~MathPlotConfigDialog();
70 
71  void Initialize(mpConfigPageId id = mpcpiNone);
72  void SelectChoiceSerie(unsigned int serie);
73  void CreateSettingsFile(const wxString& filename, const wxString& path = wxEmptyString, bool apply = false);
74  void ApplySettings(void);
79  {
80  return m_settings;
81  }
82 
83  protected:
84  // Handlers for MathPlotConfigDialogBuilder events.
85  void OnnbConfigPageChanged( wxNotebookEvent& event );
86  void OnbFontClick( wxCommandEvent& event );
87  void OnbColorClick( wxCommandEvent& event );
88  void OnAxisSelect( wxCommandEvent& event );
89  void OnbAddAxisClick( wxCommandEvent& event );
90  void OnbDelAxisClick( wxCommandEvent& event );
91  void OncbAutoScaleClick( wxCommandEvent& event );
92  void OncbFormatSelect( wxCommandEvent& event );
93  void OnChoiceSeries( wxCommandEvent& event );
94  void OnbDelSeriesClick( wxCommandEvent& event );
95  void OnChoiceLinesSelect( wxCommandEvent& event );
96  void OnbAddLinesClick( wxCommandEvent& event );
97  void OnbDelLinesClick( wxCommandEvent& event );
98  void OnbApplyClick( wxCommandEvent& event );
99  void OnQuit( wxCommandEvent& event );
100 
101  private:
102  mpWindow* m_plot;
103  MathPlotConfigSettings* m_settings;
104  wxButton* colourButton;
105  mpText* CurrentTitle;
106  mpInfoLegend* CurrentLegend;
107  mpInfoCoords* CurrentCoords;
108  mpScale* CurrentScale;
109  mpFunction* CurrentSerie;
110  mpLine* CurrentLine;
111  wxChoice* CurrentChoice;
112  bool fontTitleChanged;
113  bool fontLegendChanged;
114  bool fontAxisChanged;
115  int scale_offset;
116  bool CheckBar;
117  bool SerieVisibleChange;
118 
119  void Apply(int pageIndex, bool updateFont = false);
120  void UpdateSelectedSerie(void);
121  void UpdateSelectedLine(void);
122  void UpdateAxis(void);
123  void FillYAxisList(wxChoice* yChoice, bool clearChoice = true);
124 
125  void DoButtonColour(wxButton* button, const wxColour& colour);
126  void DoApplyColour(const wxColour& colour);
127  void UpdateFont(mpLayer* layer, wxButton* button, bool get_set);
128  void SetFontChildren(wxButton* p, const wxFontData& fontdata);
129 
130  wxBrushStyle IdToBrushStyle(int id);
131  int BrushStyleToId(wxBrushStyle style);
132 };
133 
134 #ifdef ENABLE_MP_NAMESPACE
135  } // namespace MathPlot
136 #endif // ENABLE_MP_NAMESPACE
137 
138 #endif // __MathPlotConfig__
MathPlotConfigSettings * GetSettingsHandle(void)
Give access to m_settings if we want to save some others parameters.
Definition: MathPlotConfig.h:78
Class MathPlotConfigDialogBuilder.
Definition: MathPlotConfigBuilder.h:50
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