r387: 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.23 2001/01/13 03:51:35 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 "dlgezplot.h"
58
59
60 // Define a new frame for main window
61 #if CTSIM_MDI
62 class MainFrame: public wxMDIParentFrame
63 #else
64 class MainFrame: public wxDocParentFrame
65 #endif
66 {
67   DECLARE_CLASS(MainFrame)
68 private:
69   wxTextCtrl* m_pLog;
70   wxMenu* m_pWindowMenu;
71   
72   enum { MAX_WINDOW_MENUITEMS = 20 };
73   wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
74   wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
75   
76   int m_iDefaultPhantomID;
77   int m_iDefaultFilterID;
78   int m_iDefaultFilterDomainID;
79   unsigned int m_iDefaultFilterXSize;    
80   unsigned int m_iDefaultFilterYSize;
81   double m_dDefaultFilterParam;
82   double m_dDefaultFilterBandwidth;
83   double m_dDefaultFilterInputScale;
84   double m_dDefaultFilterOutputScale;
85   
86   
87 public:
88   MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
89   
90   void OnAbout (wxCommandEvent& event);
91   void OnHelpContents (wxCommandEvent& event);
92   void OnCreatePhantom (wxCommandEvent& event);
93   
94   void OnCreateFilter (wxCommandEvent& event);
95   void OnExit (wxCommandEvent& event);
96   
97   void OnUpdateUI (wxUpdateUIEvent& event);
98   
99   wxTextCtrl* getLog() 
100   { return m_pLog; }
101   
102   void OnWindowMenu0 (wxCommandEvent& event);
103   void OnWindowMenu1 (wxCommandEvent& event);
104   void OnWindowMenu2 (wxCommandEvent& event);
105   void OnWindowMenu3 (wxCommandEvent& event);
106   void OnWindowMenu4 (wxCommandEvent& event);
107   void OnWindowMenu5 (wxCommandEvent& event);
108   void OnWindowMenu6 (wxCommandEvent& event);
109   void OnWindowMenu7 (wxCommandEvent& event);
110   void OnWindowMenu8 (wxCommandEvent& event);
111   void OnWindowMenu9 (wxCommandEvent& event);
112   void OnWindowMenu10 (wxCommandEvent& event);
113   void OnWindowMenu11 (wxCommandEvent& event);
114   void OnWindowMenu12 (wxCommandEvent& event);
115   void OnWindowMenu13 (wxCommandEvent& event);
116   void OnWindowMenu14 (wxCommandEvent& event);
117   void OnWindowMenu15 (wxCommandEvent& event);
118   void OnWindowMenu16 (wxCommandEvent& event);
119   void OnWindowMenu17 (wxCommandEvent& event);
120   void OnWindowMenu18 (wxCommandEvent& event);
121   void OnWindowMenu19 (wxCommandEvent& event);
122   
123   void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
124   
125   DECLARE_EVENT_TABLE()
126 };
127
128
129 class wxDocManager;
130 class CTSimApp: public wxApp
131 {
132 public:
133   CTSimApp();
134   bool OnInit();
135   int OnExit();
136   MainFrame* getMainFrame() const
137   { return m_pFrame; }
138   wxTextCtrl* getLog()
139   { return m_pFrame->getLog(); }
140   wxDocManager* getDocManager() 
141   { return m_docManager; }
142   
143   wxString getUntitledFilename();
144   
145   EZPlotDialog* makeEZPlotDialog()
146   { return new EZPlotDialog (m_pFrame); }
147   
148   void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
149   
150   bool getSetModifyNewDocs() const
151   { return true; }
152   
153 private:
154   wxDocManager* m_docManager;
155   MainFrame* m_pFrame;
156   
157   void usage (const char* program);
158   
159   static struct option ctsimOptions[];
160   
161   enum { O_HELP, O_VERSION };
162 };
163
164 DECLARE_APP(CTSimApp)
165
166 extern class CTSimApp* theApp;
167
168
169 enum {
170   MAINMENU_HELP_ABOUT = 500,
171     MAINMENU_WINDOW_BASE,
172     MAINMENU_HELP_CONTENTS,
173     MAINMENU_FILE_CREATE_PHANTOM,
174     
175     MAINMENU_FILE_CREATE_FILTER,
176     MAINMENU_FILE_EXIT,
177     
178     PJMENU_FILE_PROPERTIES,
179     PJMENU_RECONSTRUCT_FBP,
180     PJMENU_RECONSTRUCT_FOURIER,
181     PJMENU_CONVERT_POLAR,
182     PJMENU_CONVERT_FFT_POLAR,
183     
184     IFMENU_FILE_EXPORT,
185     IFMENU_FILE_PROPERTIES,
186     
187     IFMENU_PLOT_ROW,
188     IFMENU_PLOT_COL,
189     IFMENU_PLOT_FFT_ROW,
190     IFMENU_PLOT_FFT_COL,
191     IFMENU_PLOT_HISTOGRAM,
192     
193     IFMENU_VIEW_SCALE_AUTO,
194     IFMENU_VIEW_SCALE_MINMAX,
195     IFMENU_VIEW_SCALE_FULL,
196     
197     IFMENU_COMPARE_IMAGES,
198     IFMENU_COMPARE_ROW,
199     IFMENU_COMPARE_COL,
200     IFMENU_IMAGE_SCALESIZE,
201     IFMENU_IMAGE_ADD,
202     IFMENU_IMAGE_SUBTRACT,
203     IFMENU_IMAGE_MULTIPLY,
204     IFMENU_IMAGE_DIVIDE,
205     
206     IFMENU_FILTER_INVERTVALUES,
207     IFMENU_FILTER_SQRT,
208     IFMENU_FILTER_SQUARE,
209     IFMENU_FILTER_LOG,
210     IFMENU_FILTER_EXP,
211     IFMENU_FILTER_FOURIER,
212     IFMENU_FILTER_INVERSE_FOURIER,
213     IFMENU_FILTER_FFT,
214     IFMENU_FILTER_IFFT,
215     IFMENU_FILTER_FFT_ROWS,
216     IFMENU_FILTER_FFT_COLS,
217     IFMENU_FILTER_IFFT_ROWS,
218     IFMENU_FILTER_IFFT_COLS,
219     IFMENU_FILTER_MAGNITUDE,
220     IFMENU_FILTER_PHASE,
221     IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
222     IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
223     
224     PHMMENU_FILE_PROPERTIES,
225     PHMMENU_PROCESS_RASTERIZE,
226     PHMMENU_PROCESS_PROJECTIONS,
227     
228     PLOTMENU_VIEW_SCALE_MINMAX,
229     PLOTMENU_VIEW_SCALE_AUTO,
230     PLOTMENU_VIEW_SCALE_FULL,
231     
232 };
233
234 #endif