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 
30 
34 class MathPlotConfigSettings : public wxFileConfig
35 {
36  public:
41  MathPlotConfigSettings(const wxString& localFilename) :
42  wxFileConfig(wxEmptyString, wxEmptyString, localFilename) {}
43  virtual ~MathPlotConfigSettings() {}
44 
49  void SetSettings(wxWindow* win);
50 
55  void GetSettings(wxWindow* win);
56 
57  protected:
63  void DoPosition(bool set, wxWindow *win);
64 
72  void DoRecursiveSearch(bool set, wxWindow *win, const wxString &path = wxEmptyString, int level = 0);
73 };
74 
79 class wxMultiTextCtrlDialog: public wxDialog
80 {
81  public:
92  wxMultiTextCtrlDialog(wxWindow* parent, const wxString& title,
93  const wxString& message, long size, const wxString prompt[], double *values,
94  const wxPoint& pos = wxDefaultPosition)
95  {
96  Create(parent, title, message, size, prompt, values, pos);
97  }
98 
103  bool Create(wxWindow* parent, const wxString& title,
104  const wxString& message, long size, const wxString prompt[], double *values,
105  const wxPoint& pos = wxDefaultPosition);
106 
107  protected:
108  void OnOK(wxCommandEvent& event);
109  void OnCancel(wxCommandEvent& event);
110 
111  private:
112  std::vector<wxTextCtrl *> m_ctrls;
113  wxDECLARE_EVENT_TABLE();
114 };
115 
116 
120 typedef enum __ConfigPageIndex
121 {
122  mpcpiNone = -1,
123  mpcpiGeneral = 0,
124  mpcpiLegend,
125  mpcpiAxis,
126  mpcpiSeries,
127  mpcpiLines
129 
141 {
142  public:
149  MathPlotConfigDialog( wxWindow* parent );
151 
152  virtual ~MathPlotConfigDialog();
153 
158  void Initialize(mpConfigPageId id = mpcpiNone);
159 
164  void SelectChoiceSerie(unsigned int serie);
165 
172  void CreateSettingsFile(const wxString& filename, const wxString& path = wxEmptyString, bool apply = false);
173 
177  void ApplySettings(void);
178 
183  {
184  return m_settings;
185  }
186 
187  protected:
188  // Handlers for MathPlotConfigDialogBuilder events.
189  void OnnbConfigPageChanged( wxNotebookEvent& event );
190  void OnbFontClick( wxCommandEvent& event );
191  void OnbColorClick( wxCommandEvent& event );
192  void OnAxisSelect( wxCommandEvent& event );
193  void OnbAddAxisClick( wxCommandEvent& event );
194  void OnbDelAxisClick( wxCommandEvent& event );
195  void OncbAutoScaleClick( wxCommandEvent& event );
196  void OncbFormatSelect( wxCommandEvent& event );
197  void OnChoiceSeries( wxCommandEvent& event );
198  void OnbDelSeriesClick( wxCommandEvent& event );
199  void OncbSeriesShowNameClick( wxCommandEvent& event );
200  void OncbAutoStepClick( wxCommandEvent& event );
201  void OnChoiceLinesSelect( wxCommandEvent& event );
202  void OnbAddLinesClick( wxCommandEvent& event );
203  void OnbDelLinesClick( wxCommandEvent& event );
204  void OnbApplyClick( wxCommandEvent& event );
205  void OnbApplyAndFitClick( wxCommandEvent& event );
206  void OnQuit( wxCommandEvent& event );
207 
208  private:
209  mpWindow* m_plot;
210  MathPlotConfigSettings* m_settings;
211  wxButton* colourButton;
212  mpText* CurrentTitle;
213  mpInfoLegend* CurrentLegend;
214  mpInfoCoords* CurrentCoords;
215  mpScale* CurrentScale;
216  mpFunction* CurrentSerie;
217  mpLine* CurrentLine;
218  wxChoice* CurrentChoice;
219  bool fontTitleChanged;
220  bool fontLegendChanged;
221  bool fontAxisChanged;
222  int scale_offset;
223  bool CheckBar;
224  bool SerieVisibleChange;
225 
226  void Apply(int pageIndex, bool updateFont = false);
227  void UpdateSelectedSerie(void);
228  void UpdateSelectedLine(void);
229  void UpdateAxis(void);
230  void FillYAxisList(wxChoice* yChoice, bool clearChoice = true);
231  void UpdateSeriesStep(void);
232 
233  void DoButtonColour(wxButton* button, const wxColour& colour);
234  void DoApplyColour(const wxColour& colour);
235  void UpdateFont(mpLayer* layer, wxButton* button, bool get_set);
236  void SetFontChildren(wxButton* p, const wxFontData& fontdata);
237 
238  wxBrushStyle IdToBrushStyle(int id);
239  int BrushStyleToId(wxBrushStyle style);
240 };
241 
242 #ifdef ENABLE_MP_NAMESPACE
243  } // namespace MathPlot
244 #endif // ENABLE_MP_NAMESPACE
245 
246 #endif // __MathPlotConfig__
MathPlotConfigSettings * GetSettingsHandle(void)
Give access to m_settings if we want to save some others parameters.
Definition: MathPlotConfig.h:182
Class MathPlotConfigDialogBuilder.
Definition: MathPlotConfigBuilder.h:41
Abstract class providing a line.
Definition: mathplot.h:1795
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:3361
Implement the legend to be added to the plot This layer allows you to add a legend to describe the pl...
Definition: mathplot.h:1493
Dialog box for configuring the plot&#39;s layer objects In this dialog, you can configure: ...
Definition: MathPlotConfig.h:154
MathPlotConfigSettings(const wxString &localFilename)
Manages the backup of configuration window data.
Definition: MathPlotConfig.h:41
#define WXDLLIMPEXP_MATHPLOT
Definition uses windows dll to export function.
Definition: mathplot.h:77
Helper class to save/restore configuration.
Definition: MathPlotConfig.h:49
wxMultiTextCtrlDialog(wxWindow *parent, const wxString &title, const wxString &message, long size, const wxString prompt[], double *values, const wxPoint &pos=wxDefaultPosition)
Constructor.
Definition: MathPlotConfig.h:92
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:1371
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1641
wxMultiTextCtrlDialog class A simple text control dialog window that support several text control ...
Definition: MathPlotConfig.h:94
enum __ConfigPageIndex mpConfigPageId
The list of index of the page of the config window.
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:2736
Plot layer implementing a text string.
Definition: mathplot.h:4738
Plot layer, abstract base class.
Definition: mathplot.h:867