~ubuntu-branches/ubuntu/utopic/cba/utopic

« back to all changes in this revision

Viewing changes to src/gui/cbaGUI.h

  • Committer: Bazaar Package Importer
  • Author(s): Ferdinand Griffon
  • Date: 2010-07-23 11:21:59 UTC
  • Revision ID: james.westby@ubuntu.com-20100723112159-w679eznj51p9vca8
Tags: upstream-0.3.6
ImportĀ upstreamĀ versionĀ 0.3.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//cbaGUI.h
 
2
 
 
3
/*
 
4
 
 
5
cbeam_gui    0.3.6    07/2010    G.P.L.
 
6
 
 
7
this is a small frontend for the cbeam_class (continuous beam analysis)
 
8
cbeam_class has to be included
 
9
 
 
10
This program is free software: you can redistribute it and/or modify
 
11
it under the terms of the GNU General Public License as published by
 
12
the Free Software Foundation, either version 3 of the License, or
 
13
(at your option) any later version.
 
14
 
 
15
This program is distributed in the hope that it will be useful,
 
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
GNU General Public License for more details.
 
19
 
 
20
You should have received a copy of the GNU General Public License
 
21
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
22
 
 
23
*/
 
24
 
 
25
#ifndef cbeam_gui
 
26
#define cbeam_gui
 
27
 
 
28
#include <wx/wx.h>
 
29
#include <wx/notebook.h>
 
30
#include <wx/imaglist.h>
 
31
#include <wx/grid.h>
 
32
#include <wx/filename.h>
 
33
#include <wx/textfile.h>
 
34
 
 
35
#include <clocale>
 
36
 
 
37
#include "cbeam_class.h"
 
38
#include "cbaGUI_dialogs.h"
 
39
#include "cbaGUI_drawings.h"
 
40
#include "cbaGUI_bitmaps.h"
 
41
 
 
42
 
 
43
//--------------- MainApp ---------------
 
44
 
 
45
class MainApp: public wxApp
 
46
{
 
47
    virtual bool OnInit();
 
48
    int OnExit();
 
49
 
 
50
};
 
51
 
 
52
 
 
53
//--------------- MainFrame ---------------
 
54
class MainFrame: public wxFrame
 
55
{
 
56
 public:
 
57
 
 
58
        MainFrame(const wxString& title);
 
59
    virtual ~MainFrame();
 
60
    int Draw(wxDC&, wxRect, int);
 
61
 
 
62
    DECLARE_EVENT_TABLE()
 
63
 
 
64
 private:
 
65
 
 
66
    void CreateGUIControls();
 
67
 
 
68
    void OnQuit(wxCommandEvent&);
 
69
    void OnInfo(wxCommandEvent&);
 
70
    void OnNewBeam(wxCommandEvent&);
 
71
    void OnOpenFile(wxCommandEvent&);
 
72
    void OnSaveInput(wxCommandEvent&);
 
73
    void OnSettings(wxCommandEvent&);
 
74
    void SetDefaults(wxArrayString);
 
75
 
 
76
    void OnSpanAdd(wxCommandEvent&);
 
77
    void OnSpanDel(wxCommandEvent&);
 
78
    void OnSetEI(wxCommandEvent&);
 
79
    void SetMatSec(wxArrayString);
 
80
    void OnSetRst(wxCommandEvent&);
 
81
 
 
82
    void OnLoadAdd(wxCommandEvent&);
 
83
    void OnLoadDel(wxCommandEvent&);
 
84
    void OnSetLF(wxCommandEvent&);
 
85
    void OnChkSw(wxCommandEvent&);
 
86
 
 
87
    void OnClipRes(wxCommandEvent&);
 
88
    void OnSaveRes(wxCommandEvent&);
 
89
    void OnPrint(wxCommandEvent&);
 
90
 
 
91
    void OnSysPage(wxNotebookEvent&);
 
92
    void OnLoadPage(wxNotebookEvent&);
 
93
    void OnRadioButton(wxCommandEvent&);
 
94
    void OnCellInputGrid(wxGridEvent&);
 
95
 
 
96
    void Solve();
 
97
    vector< vector<double> > ReadInput();
 
98
    void UpdateResultText(wxArrayString, wxArrayString, wxString);
 
99
    wxArrayString lmSort(vector< vector<double> >);
 
100
    wxArrayString resOut(vector< vector<double> >, vector< vector <double> >) ;
 
101
    wxString strOut(vector< vector<double> >);
 
102
    wxArrayString CreatePlotTable();
 
103
 
 
104
    void FillInputGrids();
 
105
    void addCols(wxGrid*, int);
 
106
    void addRows(int);
 
107
    wxString ChkValue(wxString valStr);
 
108
 
 
109
    wxGrid *udl_Grid, *pl_Grid, *pudl_Grid, *ml_Grid, *tz_Grid, *ptr_Grid;
 
110
    wxGrid *grid;
 
111
    wxNotebook *NbInp, *NbRes;
 
112
    wxTextCtrl *TcRes;
 
113
 
 
114
    wxButton *BtLdAdd, *BtLdDel, *BtLdFac;
 
115
    wxButton *BtEI, *BtRst, *BtSpAdd, *BtSpDel;
 
116
    wxCheckBox *ChkSw;
 
117
 
 
118
    wxBitmapButton *BtCopy, *BtSave, *BtPrint;
 
119
    wxRadioButton *BtFc, *BtSt;
 
120
 
 
121
    GraphFrame *system, *graph;
 
122
 
 
123
 
 
124
    class Store_values
 
125
    {
 
126
      public:
 
127
 
 
128
        vector<double> L;
 
129
        vector<double> R;
 
130
        double E,I;
 
131
        double Wy,Az;
 
132
        double g0;
 
133
 
 
134
        vector< vector<double> > LMg;
 
135
        vector< vector<double> > LMq;
 
136
 
 
137
        wxArrayString resTxt;
 
138
 
 
139
        wxString Mat, Sec;
 
140
        wxString dbMat, dbSec;
 
141
        wxString fcUnit, lnUnit;
 
142
        wxString ldFac;
 
143
 
 
144
        wxString Head;
 
145
 
 
146
    };
 
147
 
 
148
    Store_values Store;
 
149
 
 
150
    enum
 
151
    {
 
152
        ID_QUIT = wxID_HIGHEST,
 
153
        ID_INFO,
 
154
        ID_NEW,
 
155
        ID_OPEN,
 
156
        ID_SAVE,
 
157
        ID_SET,
 
158
 
 
159
        ID_NB_INP,
 
160
        ID_IGRID,
 
161
 
 
162
        ID_BT_LD_ADD,
 
163
        ID_BT_LD_DEL,
 
164
        ID_BT_LD_FAC,
 
165
 
 
166
        ID_BT_EI,
 
167
        ID_BT_RST,
 
168
 
 
169
        ID_BT_SP_ADD,
 
170
        ID_BT_SP_DEL,
 
171
 
 
172
        ID_CHK_SW,
 
173
 
 
174
        ID_NB_RES,
 
175
        ID_TC_RES,
 
176
 
 
177
        ID_BT_FC,
 
178
        ID_BT_ST,
 
179
 
 
180
        ID_BT_COPY,
 
181
        ID_BT_SAVE,
 
182
        ID_BT_PRINT,
 
183
 
 
184
    };
 
185
 
 
186
};
 
187
 
 
188
 
 
189
//---------------- declare the main frame -------------------------
 
190
MainFrame *frame;
 
191
 
 
192
 
 
193
//---------------- PrintFrame -------------------------
 
194
 
 
195
class PrintFrame: public wxPrintout
 
196
{
 
197
 public:
 
198
 
 
199
  PrintFrame(const wxChar *title = _T("cba")) : wxPrintout(title) {}
 
200
  virtual ~PrintFrame() {}
 
201
 
 
202
  void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
 
203
  bool HasPage(int page);
 
204
  bool OnBeginDocument(int startPage, int endPage);
 
205
  bool OnPrintPage(int page);
 
206
 
 
207
 private:
 
208
 
 
209
  int resNo;
 
210
 
 
211
};
 
212
 
 
213
 
 
214
 
 
215
 
 
216
#endif
 
217