File: wx_gui.h

package info (click to toggle)
fityk 0.4.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,472 kB
  • ctags: 2,617
  • sloc: cpp: 19,705; sh: 5,965; xml: 2,325; yacc: 356; makefile: 183; lex: 178
file content (239 lines) | stat: -rw-r--r-- 8,141 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// This file is part of fityk program. Copyright (C) Marcin Wojdyr
// $Id: wx_gui.h,v 1.19 2005/03/04 14:28:47 wojdyr Exp $

#ifndef WX_GUI__H__
#define WX_GUI__H__

#include "common.h"
#include "pag.h"
#include "wx_common.h"  // Output_style_enum
#include <list>
#include <wx/spinctrl.h>
#include <wx/html/helpctrl.h>
#ifdef __WXMSW__
#  include <wx/msw/helpbest.h>
#endif

class wxCmdLineParser;
//struct z_names_type;
struct f_names_type;
class ApplicationLogic;
class FDXLoadDlg;
class PlotPane;
class IOPane;
class DataPane;
class ProportionalSplitter;
class DataEditorDlg;

extern std::vector<fp> params4plot;

//status bar fields
enum StatusBarField { sbf_text, sbf_hint1, sbf_hint2, sbf_coord, sbf_max };  

class FApp: public wxApp
{
public:
    wxString conf_filename, alt_conf_filename;

    bool OnInit(void);
    int OnExit();

private:
    bool is_fityk_script(std::string filename);
    void process_argv(wxCmdLineParser &cmdLineParser);
};

DECLARE_APP(FApp)

class DotSet;

class FSetDlg : public wxDialog
{
public:
    std::vector<std::string>& opt_names;
    std::vector<std::string>& opt_values;
    std::vector<wxControl*> tc_v;
    FSetDlg(wxWindow* parent, const wxWindowID id, const wxString& title,
             std::vector<std::string>& names, std::vector<std::string>& vals,
             std::vector<std::string>& types, DotSet* myset);
};


class FToolBar : public wxToolBar
{
public:
    FToolBar (wxFrame *parent, wxWindowID id); 
    void update_peak_type(); 

    void OnIdle(wxIdleEvent &event);
    void OnPeakChoice (wxCommandEvent& event);
    void OnChangeMouseMode (wxCommandEvent& event);
    void OnSwitchDPane (wxCommandEvent& event);
    void OnClickTool (wxCommandEvent& event);

private:
    wxChoice *peak_choice; 

    DECLARE_EVENT_TABLE()
};

class FStatusBar: public wxStatusBar 
{
public:
    FStatusBar(wxWindow *parent);
    void OnSize(wxSizeEvent& event);
    void set_hint(const char *left, const char *right);
private:
    wxStaticBitmap *statbmp1, *statbmp2;
    DECLARE_EVENT_TABLE()
};


// Define a new frame
class FFrame: public wxFrame
{
    friend class FToolBar;
    friend class FApp;
public:
    FFrame(wxWindow *parent, const wxWindowID id, const wxString& title, 
            const long style);
    ~FFrame();
    //void OnSize (wxSizeEvent& event);

    void OnIdle(wxIdleEvent &event); 
    void OnShowHelp (wxCommandEvent& event);
    void OnTipOfTheDay (wxCommandEvent& event);
    void OnAbout (wxCommandEvent& event);
    void OnQuit (wxCommandEvent& event);

    void OnDLoad         (wxCommandEvent& event);   
    void OnDXLoad        (wxCommandEvent& event);   
    void OnDRecent       (wxCommandEvent& event);
    void OnDEditor       (wxCommandEvent& event);
    void OnDInfo         (wxCommandEvent& event);
    void OnDDeviation    (wxCommandEvent& event);
    void OnDRange        (wxCommandEvent& event);
    void OnDBInfo        (wxCommandEvent& event);
    void OnDBClear       (wxCommandEvent& event);
    void OnDCalibrate    (wxCommandEvent& event); 
    void OnDExport       (wxCommandEvent& event);
    void OnDSet          (wxCommandEvent& event); 

    void OnSHistory      (wxCommandEvent& event);            
    void OnSInfo         (wxCommandEvent& event);         
    void OnSAdd          (wxCommandEvent& event);        
    void OnSRemove       (wxCommandEvent& event);           
    void OnSChange       (wxCommandEvent& event);           
    void OnSValue        (wxCommandEvent& event);          
    void OnSExport       (wxCommandEvent& event);           
    void OnSSet          (wxCommandEvent& event);        

    void OnMFindpeak     (wxCommandEvent& event);        
    void OnMSet          (wxCommandEvent& event);        

    void OnFMethodUpdate (wxUpdateUIEvent& event);           
    void OnFOneOfMethods (wxCommandEvent& event);
    void OnFRun          (wxCommandEvent& event);        
    void OnFContinue     (wxCommandEvent& event);             
    void OnFInfo         (wxCommandEvent& event);         
    void OnFSet          (wxCommandEvent& event);        

    void OnCWavelength   (wxCommandEvent& event);               
    void OnCAdd          (wxCommandEvent& event);        
    void OnCInfo         (wxCommandEvent& event);         
    void OnCRemove       (wxCommandEvent& event);           
    void OnCEstimate     (wxCommandEvent& event);             
    void OnCSet          (wxCommandEvent& event);        

    void OnOLog          (wxCommandEvent& event);        
    void OnOInclude      (wxCommandEvent& event);            
    void OnOReInclude    (wxCommandEvent& event);            
    void OnO_Reset       (wxCommandEvent& event);
    void OnOWait         (wxCommandEvent& event);         
    void OnODump         (wxCommandEvent& event);         
    void OnOSet          (wxCommandEvent& event);        
    void OnPrintPreview  (wxCommandEvent& event);
    void OnPrintSetup    (wxCommandEvent& event);
    void OnPrint         (wxCommandEvent& event);
    void OnChangeMouseMode (wxCommandEvent& event);
    void OnModePeak      (wxUpdateUIEvent& event);
    void OnChangePeakType(wxCommandEvent& event);
    void OnGViewAll      (wxCommandEvent& event);
    void OnGFitHeight    (wxCommandEvent& event);
    void OnGScrollLeft   (wxCommandEvent& event);
    void OnGScrollRight  (wxCommandEvent& event);
    void OnPreviousZoom  (wxCommandEvent& event);
    void OnConfigRead    (wxCommandEvent& event);
    void OnConfigBuiltin (wxCommandEvent& event);
    void OnConfigSave    (wxCommandEvent& event);
    void OnGuiShowUpdate (wxUpdateUIEvent& event);
    void SwitchDPane(bool show);
    void OnSwitchDPane(wxCommandEvent& ev) {SwitchDPane(ev.IsChecked());}
    void OnSwitchAuxPlot(wxCommandEvent& ev);
    void SwitchIOPane(bool show);
    void OnSwitchIOPane(wxCommandEvent& ev) {SwitchIOPane(ev.IsChecked());}
    void SwitchToolbar(bool show);
    void OnSwitchToolbar(wxCommandEvent& ev) {SwitchToolbar(ev.IsChecked());}
    void SwitchStatbar(bool show);
    void OnSwitchStatbar(wxCommandEvent& ev) {SwitchStatbar(ev.IsChecked());}
    void SwitchCrosshair(bool show);
    void OnSwitchCrosshair(wxCommandEvent& ev){SwitchCrosshair(ev.IsChecked());}
    void OnShowMenuZoomPrev(wxUpdateUIEvent& event);
    void save_all_settings(wxConfigBase *cf) const;
    void save_settings(wxConfigBase *cf) const;
    void read_all_settings(wxConfigBase *cf);
    void read_settings(wxConfigBase *cf);
    const FToolBar* get_toolbar() const { return toolbar; }
    const f_names_type& get_peak_type() const;
    void set_status_hint(const char *left, const char *right);
    void output_text(OutputStyle style, const std::string& str);
    void change_zoom(const std::string& s);
    void scroll_view_horizontally(fp step);
    void refresh_plots(bool refresh=true, bool update=false);
    void draw_crosshair(int X, int Y);
    void focus_input();
    void set_status_text(const wxString &text, StatusBarField field=sbf_text) 
            { if (status_bar) SetStatusText(text, field); }

protected:
    ProportionalSplitter *main_pane;
    PlotPane *plot_pane;
    IOPane *io_pane;
    DataPane *data_pane;
    FStatusBar *status_bar;

    int peak_type_nr;
    FToolBar *toolbar;
    FDXLoadDlg *dxload_dialog;
    DataEditorDlg *data_editor;
    ProportionalSplitter *v_splitter;
    wxPrintData *print_data;
    wxPageSetupData* page_setup_data;
#ifdef __WXMSW__
    wxBestHelpController help;
#else
    wxHtmlHelpController help; 
#endif
    std::string last_include_path;
    std::list<wxFileName> recent_data_files;
    wxMenu *data_menu_recent;

    void place_plot_and_io_windows(wxWindow *parent);
    void create_io_panel(wxWindow *parent);
    void OnXSet (std::string name, char letter);
    void set_menubar();
    void not_implemented_menu_item (const std::string &command) const; 
    void read_recent_data_files();
    void write_recent_data_files();
    void add_recent_data_file(wxString filename);

DECLARE_EVENT_TABLE()
};


void add_peak(fp height, fp ctr, fp hwhm);
void add_peak_in_range(fp xmin, fp xmax);
extern FFrame *frame;

#endif //WXGUI__H__