r415: 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.26 2001/01/17 13:03:24 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 OnHelpContents (wxCommandEvent& event);
110   void OnCreatePhantom (wxCommandEvent& event);
111   
112   void OnCreateFilter (wxCommandEvent& event);
113   void OnExit (wxCommandEvent& event);
114   
115   void OnUpdateUI (wxUpdateUIEvent& event);
116   
117   wxTextCtrl* getLog() 
118   { return m_pLog; }
119   
120   void OnWindowMenu0 (wxCommandEvent& event);
121   void OnWindowMenu1 (wxCommandEvent& event);
122   void OnWindowMenu2 (wxCommandEvent& event);
123   void OnWindowMenu3 (wxCommandEvent& event);
124   void OnWindowMenu4 (wxCommandEvent& event);
125   void OnWindowMenu5 (wxCommandEvent& event);
126   void OnWindowMenu6 (wxCommandEvent& event);
127   void OnWindowMenu7 (wxCommandEvent& event);
128   void OnWindowMenu8 (wxCommandEvent& event);
129   void OnWindowMenu9 (wxCommandEvent& event);
130   void OnWindowMenu10 (wxCommandEvent& event);
131   void OnWindowMenu11 (wxCommandEvent& event);
132   void OnWindowMenu12 (wxCommandEvent& event);
133   void OnWindowMenu13 (wxCommandEvent& event);
134   void OnWindowMenu14 (wxCommandEvent& event);
135   void OnWindowMenu15 (wxCommandEvent& event);
136   void OnWindowMenu16 (wxCommandEvent& event);
137   void OnWindowMenu17 (wxCommandEvent& event);
138   void OnWindowMenu18 (wxCommandEvent& event);
139   void OnWindowMenu19 (wxCommandEvent& event);
140   
141   void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
142   
143   DECLARE_EVENT_TABLE()
144 };
145
146
147 class wxDocManager;
148 class CTSimApp: public wxApp
149 {
150 public:
151   CTSimApp();
152   bool OnInit();
153   int OnExit();
154   MainFrame* getMainFrame() const
155   { return m_pFrame; }
156   wxTextCtrl* getLog()
157   { return m_pFrame->getLog(); }
158   wxDocManager* getDocManager() 
159   { return m_docManager; }
160   
161   wxString getUntitledFilename();
162   
163   EZPlotDialog* makeEZPlotDialog()
164   { return new EZPlotDialog (m_pFrame); }
165   
166   void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
167   
168   bool getSetModifyNewDocs() const
169   { return true; }
170   
171   void setIconForFrame (wxFrame* pFrame);
172
173 private:
174   wxDocManager* m_docManager;
175   MainFrame* m_pFrame;
176   
177   void usage (const char* program);
178   
179   static struct option ctsimOptions[];
180   
181   enum { O_HELP, O_VERSION };
182 };
183
184 DECLARE_APP(CTSimApp)
185
186 extern class CTSimApp* theApp;
187
188
189 enum {
190   MAINMENU_HELP_ABOUT = 500,
191     MAINMENU_WINDOW_BASE,
192     MAINMENU_HELP_CONTENTS,
193     MAINMENU_HELP_TOPICS,
194     MAINMENU_FILE_CREATE_PHANTOM,
195     
196     MAINMENU_FILE_CREATE_FILTER,
197     MAINMENU_FILE_EXIT,
198     
199     PJMENU_FILE_PROPERTIES,
200     PJMENU_RECONSTRUCT_FBP,
201     PJMENU_RECONSTRUCT_FOURIER,
202     PJMENU_CONVERT_POLAR,
203     PJMENU_CONVERT_FFT_POLAR,
204     
205     IFMENU_FILE_EXPORT,
206     IFMENU_FILE_PROPERTIES,
207     
208     IFMENU_PLOT_ROW,
209     IFMENU_PLOT_COL,
210     IFMENU_PLOT_FFT_ROW,
211     IFMENU_PLOT_FFT_COL,
212     IFMENU_PLOT_HISTOGRAM,
213     
214     IFMENU_VIEW_SCALE_AUTO,
215     IFMENU_VIEW_SCALE_MINMAX,
216     IFMENU_VIEW_SCALE_FULL,
217     
218     IFMENU_COMPARE_IMAGES,
219     IFMENU_COMPARE_ROW,
220     IFMENU_COMPARE_COL,
221     IFMENU_IMAGE_SCALESIZE,
222     IFMENU_IMAGE_ADD,
223     IFMENU_IMAGE_SUBTRACT,
224     IFMENU_IMAGE_MULTIPLY,
225     IFMENU_IMAGE_DIVIDE,
226     
227     IFMENU_FILTER_INVERTVALUES,
228     IFMENU_FILTER_SQRT,
229     IFMENU_FILTER_SQUARE,
230     IFMENU_FILTER_LOG,
231     IFMENU_FILTER_EXP,
232     IFMENU_FILTER_FOURIER,
233     IFMENU_FILTER_INVERSE_FOURIER,
234     IFMENU_FILTER_FFT,
235     IFMENU_FILTER_IFFT,
236     IFMENU_FILTER_FFT_ROWS,
237     IFMENU_FILTER_FFT_COLS,
238     IFMENU_FILTER_IFFT_ROWS,
239     IFMENU_FILTER_IFFT_COLS,
240     IFMENU_FILTER_MAGNITUDE,
241     IFMENU_FILTER_PHASE,
242     IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
243     IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
244     
245     PHMMENU_FILE_PROPERTIES,
246     PHMMENU_PROCESS_RASTERIZE,
247     PHMMENU_PROCESS_PROJECTIONS,
248     
249     PLOTMENU_VIEW_SCALE_MINMAX,
250     PLOTMENU_VIEW_SCALE_AUTO,
251     PLOTMENU_VIEW_SCALE_FULL,
252     
253 };
254
255 #endif