r413: no message
[ctsim.git] / src / ctsim.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          ctsim.cpp
5 **   Purpose:       Top-level routines for CTSim program
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2000 Kevin Rosenberg
11 **
12 **  $Id: ctsim.h,v 1.25 2001/01/17 11:00:18 kevin Exp $
13 **
14 **  This program is free software; you can redistribute it and/or modify
15 **  it under the terms of the GNU General Public License (version 2) as
16 **  published by the Free Software Foundation.
17 **
18 **  This program is distributed in the hope that it will be useful,
19 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 **  GNU General Public License for more details.
22 **
23 **  You should have received a copy of the GNU General Public License
24 **  along with this program; if not, write to the Free Software
25 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 ******************************************************************************/
27
28 #ifndef __CTSIMH__
29 #define __CTSIMH__
30
31 #ifdef HAVE_CONFIG_H
32 #include "config.h"
33 #endif
34 #ifdef HAVE_DMALLOC
35 #include <dmalloc.h>
36 #endif
37
38 #ifdef MSVC
39 // #define CTSIM_MDI 1
40 #endif
41
42
43 class wxMenu;
44 class wxDocument;
45
46 class ImageFileDocument;
47
48 #include <vector>
49
50 #ifndef WX_PRECOMP
51 #include "wx/wx.h"
52 #endif
53
54 #include "wx/docview.h"
55 #include "wx/textctrl.h"
56 #include "wx/menu.h"
57 #include "wx/help.h"
58 #include "wx/html/helpctrl.h"
59 #include "dlgezplot.h"
60
61
62 // Define a new frame for main window
63 #if CTSIM_MDI
64 class MainFrame: public wxMDIParentFrame
65 #else
66 class MainFrame: public wxDocParentFrame
67 #endif
68 {
69   DECLARE_CLASS(MainFrame)
70 private:
71   wxTextCtrl* m_pLog;
72   wxMenu* m_pWindowMenu;
73   
74   enum { MAX_WINDOW_MENUITEMS = 20 };
75   wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
76   wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
77   
78   int m_iDefaultPhantomID;
79   int m_iDefaultFilterID;
80   int m_iDefaultFilterDomainID;
81   unsigned int m_iDefaultFilterXSize;    
82   unsigned int m_iDefaultFilterYSize;
83   double m_dDefaultFilterParam;
84   double m_dDefaultFilterBandwidth;
85   double m_dDefaultFilterInputScale;
86   double m_dDefaultFilterOutputScale;
87   
88 #ifdef __WXMSW__
89   wxWinHelpController      m_help;
90 #else
91   wxHtmlHelpController     m_help;
92 #endif
93
94   
95 public:
96   MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
97   
98 #ifdef __WXMSW__
99   wxWinHelpController&   getHelpController()
100   {return m_help; }
101 #else
102   wxHtmlHelpController&  getHelpController()
103   { return m_help; }
104 #endif
105   void showHelp (int commandID);
106
107   void OnAbout (wxCommandEvent& event);
108   void OnHelpTopics (wxCommandEvent& event);
109   void OnCreatePhantom (wxCommandEvent& event);
110   
111   void OnCreateFilter (wxCommandEvent& event);
112   void OnExit (wxCommandEvent& event);
113   
114   void OnUpdateUI (wxUpdateUIEvent& event);
115   
116   wxTextCtrl* getLog() 
117   { return m_pLog; }
118   
119   void OnWindowMenu0 (wxCommandEvent& event);
120   void OnWindowMenu1 (wxCommandEvent& event);
121   void OnWindowMenu2 (wxCommandEvent& event);
122   void OnWindowMenu3 (wxCommandEvent& event);
123   void OnWindowMenu4 (wxCommandEvent& event);
124   void OnWindowMenu5 (wxCommandEvent& event);
125   void OnWindowMenu6 (wxCommandEvent& event);
126   void OnWindowMenu7 (wxCommandEvent& event);
127   void OnWindowMenu8 (wxCommandEvent& event);
128   void OnWindowMenu9 (wxCommandEvent& event);
129   void OnWindowMenu10 (wxCommandEvent& event);
130   void OnWindowMenu11 (wxCommandEvent& event);
131   void OnWindowMenu12 (wxCommandEvent& event);
132   void OnWindowMenu13 (wxCommandEvent& event);
133   void OnWindowMenu14 (wxCommandEvent& event);
134   void OnWindowMenu15 (wxCommandEvent& event);
135   void OnWindowMenu16 (wxCommandEvent& event);
136   void OnWindowMenu17 (wxCommandEvent& event);
137   void OnWindowMenu18 (wxCommandEvent& event);
138   void OnWindowMenu19 (wxCommandEvent& event);
139   
140   void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
141   
142   DECLARE_EVENT_TABLE()
143 };
144
145
146 class wxDocManager;
147 class CTSimApp: public wxApp
148 {
149 public:
150   CTSimApp();
151   bool OnInit();
152   int OnExit();
153   MainFrame* getMainFrame() const
154   { return m_pFrame; }
155   wxTextCtrl* getLog()
156   { return m_pFrame->getLog(); }
157   wxDocManager* getDocManager() 
158   { return m_docManager; }
159   
160   wxString getUntitledFilename();
161   
162   EZPlotDialog* makeEZPlotDialog()
163   { return new EZPlotDialog (m_pFrame); }
164   
165   void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
166   
167   bool getSetModifyNewDocs() const
168   { return true; }
169   
170   void setIconForFrame (wxFrame* pFrame);
171
172 private:
173   wxDocManager* m_docManager;
174   MainFrame* m_pFrame;
175   
176   void usage (const char* program);
177   
178   static struct option ctsimOptions[];
179   
180   enum { O_HELP, O_VERSION };
181 };
182
183 DECLARE_APP(CTSimApp)
184
185 extern class CTSimApp* theApp;
186
187
188 enum {
189   MAINMENU_HELP_ABOUT = 500,
190     MAINMENU_WINDOW_BASE,
191     MAINMENU_HELP_TOPICS,
192     MAINMENU_FILE_CREATE_PHANTOM,
193     
194     MAINMENU_FILE_CREATE_FILTER,
195     MAINMENU_FILE_EXIT,
196     
197     PJMENU_FILE_PROPERTIES,
198     PJMENU_RECONSTRUCT_FBP,
199     PJMENU_RECONSTRUCT_FOURIER,
200     PJMENU_CONVERT_POLAR,
201     PJMENU_CONVERT_FFT_POLAR,
202     
203     IFMENU_FILE_EXPORT,
204     IFMENU_FILE_PROPERTIES,
205     
206     IFMENU_PLOT_ROW,
207     IFMENU_PLOT_COL,
208     IFMENU_PLOT_FFT_ROW,
209     IFMENU_PLOT_FFT_COL,
210     IFMENU_PLOT_HISTOGRAM,
211     
212     IFMENU_VIEW_SCALE_AUTO,
213     IFMENU_VIEW_SCALE_MINMAX,
214     IFMENU_VIEW_SCALE_FULL,
215     
216     IFMENU_COMPARE_IMAGES,
217     IFMENU_COMPARE_ROW,
218     IFMENU_COMPARE_COL,
219     IFMENU_IMAGE_SCALESIZE,
220     IFMENU_IMAGE_ADD,
221     IFMENU_IMAGE_SUBTRACT,
222     IFMENU_IMAGE_MULTIPLY,
223     IFMENU_IMAGE_DIVIDE,
224     
225     IFMENU_FILTER_INVERTVALUES,
226     IFMENU_FILTER_SQRT,
227     IFMENU_FILTER_SQUARE,
228     IFMENU_FILTER_LOG,
229     IFMENU_FILTER_EXP,
230     IFMENU_FILTER_FOURIER,
231     IFMENU_FILTER_INVERSE_FOURIER,
232     IFMENU_FILTER_FFT,
233     IFMENU_FILTER_IFFT,
234     IFMENU_FILTER_FFT_ROWS,
235     IFMENU_FILTER_FFT_COLS,
236     IFMENU_FILTER_IFFT_ROWS,
237     IFMENU_FILTER_IFFT_COLS,
238     IFMENU_FILTER_MAGNITUDE,
239     IFMENU_FILTER_PHASE,
240     IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
241     IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
242     
243     PHMMENU_FILE_PROPERTIES,
244     PHMMENU_PROCESS_RASTERIZE,
245     PHMMENU_PROCESS_PROJECTIONS,
246     
247     PLOTMENU_VIEW_SCALE_MINMAX,
248     PLOTMENU_VIEW_SCALE_AUTO,
249     PLOTMENU_VIEW_SCALE_FULL,
250     
251 };
252
253 #endif