1 /*****************************************************************************
5 ** Purpose: Top-level routines for CTSim program
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: July 2000
9 ** This is part of the CTSim program
10 ** Copyright (c) 1983-2001 Kevin Rosenberg
12 ** $Id: ctsim.h,v 1.45 2001/02/11 22:23:03 kevin Exp $
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.
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.
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 ******************************************************************************/
41 #include "wx/config.h"
43 #include "wx/msw/helpchm.h"
49 #define CTSIM_CUSTOM_MRU 1
51 #if defined(CTSIM_MDI) && !wxUSE_MDI_ARCHITECTURE
52 #error You must set wxUSE_MDI_ARCHITECTURE to 1 in setup.h!
55 #include "wx/docmdi.h"
60 class ImageFileDocument;
61 class ProjectionFileDocument;
62 class PhantomFileDocument;
63 class PlotFileDocument;
64 class TextFileDocument;
66 class Graph3dFileDocument;
70 #include "wx/docview.h"
71 #include "wx/textctrl.h"
74 #include "wx/html/helpctrl.h"
75 #include "dlgezplot.h"
78 #if defined(__WXMSW__) || defined (MSVC)
79 #define CTSIM_WINHELP 1
82 // Define a new frame for main window
84 class MainFrame: public wxDocMDIParentFrame
86 class MainFrame: public wxDocParentFrame
90 DECLARE_CLASS(MainFrame)
94 wxMenu* m_pWindowMenu;
97 enum { MAX_WINDOW_MENUITEMS = 20 };
98 wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
99 wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
101 int m_iDefaultPhantomID;
102 int m_iDefaultFilterID;
103 int m_iDefaultFilterDomainID;
104 unsigned int m_iDefaultFilterXSize;
105 unsigned int m_iDefaultFilterYSize;
106 double m_dDefaultFilterParam;
107 double m_dDefaultFilterBandwidth;
108 double m_dDefaultFilterInputScale;
109 double m_dDefaultFilterOutputScale;
111 bool m_bShuttingDown;
114 wxCHMHelpController m_winHelp;
116 wxHtmlHelpController m_htmlHelp;
119 MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
120 virtual ~MainFrame();
122 #ifdef CTSIM_CUSTOM_MRU
123 void OnMRUFile (wxCommandEvent& event);
125 void OnSize (wxSizeEvent& event);
128 wxCHMHelpController& getWinHelpController()
131 wxHtmlHelpController& getHtmlHelpController()
132 { return m_htmlHelp; }
134 void showHelp (int commandID);
136 void OnAbout (wxCommandEvent& event);
137 void OnHelpTopics (wxCommandEvent& event);
138 void OnHelpContents (wxCommandEvent& event);
139 void OnCreatePhantom (wxCommandEvent& event);
140 void OnPreferences (wxCommandEvent& event);
142 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
143 void OnHelpSecondary (wxCommandEvent& event);
146 void OnCreateFilter (wxCommandEvent& event);
147 void OnExit (wxCommandEvent& event);
149 void OnUpdateUI (wxUpdateUIEvent& event);
151 void OnWindowMenu0 (wxCommandEvent& event);
152 void OnWindowMenu1 (wxCommandEvent& event);
153 void OnWindowMenu2 (wxCommandEvent& event);
154 void OnWindowMenu3 (wxCommandEvent& event);
155 void OnWindowMenu4 (wxCommandEvent& event);
156 void OnWindowMenu5 (wxCommandEvent& event);
157 void OnWindowMenu6 (wxCommandEvent& event);
158 void OnWindowMenu7 (wxCommandEvent& event);
159 void OnWindowMenu8 (wxCommandEvent& event);
160 void OnWindowMenu9 (wxCommandEvent& event);
161 void OnWindowMenu10 (wxCommandEvent& event);
162 void OnWindowMenu11 (wxCommandEvent& event);
163 void OnWindowMenu12 (wxCommandEvent& event);
164 void OnWindowMenu13 (wxCommandEvent& event);
165 void OnWindowMenu14 (wxCommandEvent& event);
166 void OnWindowMenu15 (wxCommandEvent& event);
167 void OnWindowMenu16 (wxCommandEvent& event);
168 void OnWindowMenu17 (wxCommandEvent& event);
169 void OnWindowMenu18 (wxCommandEvent& event);
170 void OnWindowMenu19 (wxCommandEvent& event);
172 void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
174 bool getShuttingDown() const { return m_bShuttingDown; }
179 class CTSimApp: public wxApp
182 enum { O_HELP, O_VERSION };
183 static struct option ctsimOptions[];
185 bool m_bAdvancedOptions;
186 bool m_bSetModifyNewDocs;
188 wxDocManager* m_docManager;
192 wxDocTemplate* m_pDocTemplImage;
193 wxDocTemplate* m_pDocTemplProjection;
194 wxDocTemplate* m_pDocTemplPhantom;
195 wxDocTemplate* m_pDocTemplPlot;
196 wxDocTemplate* m_pDocTemplText;
198 wxDocTemplate* m_pDocTemplGraph3d;
201 TextFileDocument* m_pLogDoc;
203 void usage (const char* program);
211 MainFrame* getMainFrame() const
217 wxDocManager* getDocManager()
218 { return m_docManager; }
220 wxString getUntitledFilename();
222 EZPlotDialog* makeEZPlotDialog()
223 { return new EZPlotDialog (m_pFrame); }
225 void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
226 bool getAdvancedOptions() const { return m_bAdvancedOptions; }
227 void setAdvancedOptions (bool bAdv) { m_bAdvancedOptions = bAdv; }
229 void setIconForFrame (wxFrame* pFrame);
230 wxConfig* getConfig()
231 { return m_pConfig; }
232 bool getAskDeleteNewDocs() const { return m_bSetModifyNewDocs; }
233 void setAskDeleteNewDocs(bool bAsk) { m_bSetModifyNewDocs = bAsk; }
235 wxDocTemplate* getDocTemplImage() { return m_pDocTemplImage; }
236 wxDocTemplate* getDocTemplProjection() { return m_pDocTemplProjection; }
237 wxDocTemplate* getDocTemplPhantom() { return m_pDocTemplPhantom; }
238 wxDocTemplate* getDocTemplPlot() { return m_pDocTemplPlot; }
239 wxDocTemplate* getDocTemplText() { return m_pDocTemplText; }
241 wxDocTemplate* getDocTemplGraph3d() { return m_pDocTemplGraph3d; }
243 TextFileDocument* getLogDoc() { return m_pLogDoc; }
245 ProjectionFileDocument* newProjectionDoc();
246 ImageFileDocument* newImageDoc();
247 PhantomFileDocument* newPhantomDoc();
248 PlotFileDocument* newPlotDoc();
249 TextFileDocument* newTextDoc();
251 Graph3dFileDocument* newGraph3dDoc();
255 DECLARE_APP(CTSimApp)
257 extern class CTSimApp* theApp;
260 MAINMENU_WINDOW_BASE = 500,
261 MAINMENU_HELP_ABOUT = 600,
262 MAINMENU_HELP_CONTENTS,
263 MAINMENU_HELP_TOPICS,
264 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
265 MAINMENU_HELP_SECONDARY,
267 MAINMENU_FILE_CREATE_PHANTOM,
269 MAINMENU_FILE_CREATE_FILTER,
271 MAINMENU_FILE_PREFERENCES,
273 PJMENU_FILE_PROPERTIES,
274 PJMENU_RECONSTRUCT_FBP,
275 PJMENU_RECONSTRUCT_FOURIER,
276 PJMENU_CONVERT_POLAR,
277 PJMENU_CONVERT_FFT_POLAR,
280 IFMENU_FILE_PROPERTIES,
286 IFMENU_PLOT_HISTOGRAM,
288 IFMENU_VIEW_SCALE_AUTO,
289 IFMENU_VIEW_SCALE_MINMAX,
290 IFMENU_VIEW_SCALE_FULL,
292 IFMENU_COMPARE_IMAGES,
295 IFMENU_IMAGE_SCALESIZE,
297 IFMENU_IMAGE_SUBTRACT,
298 IFMENU_IMAGE_MULTIPLY,
301 IFMENU_IMAGE_CONVERT3D,
304 IFMENU_FILTER_INVERTVALUES,
306 IFMENU_FILTER_SQUARE,
309 IFMENU_FILTER_FOURIER,
310 IFMENU_FILTER_INVERSE_FOURIER,
313 IFMENU_FILTER_FFT_ROWS,
314 IFMENU_FILTER_FFT_COLS,
315 IFMENU_FILTER_IFFT_ROWS,
316 IFMENU_FILTER_IFFT_COLS,
317 IFMENU_FILTER_MAGNITUDE,
319 IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
320 IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
322 PHMMENU_FILE_PROPERTIES,
323 PHMMENU_PROCESS_RASTERIZE,
324 PHMMENU_PROCESS_PROJECTIONS,
326 PLOTMENU_VIEW_SCALE_MINMAX,
327 PLOTMENU_VIEW_SCALE_AUTO,
328 PLOTMENU_VIEW_SCALE_FULL,
330 GRAPH3D_VIEW_SURFACE,
332 GRAPH3D_VIEW_LIGHTING,
334 GRAPH3D_VIEW_SCALE_AUTO,
335 GRAPH3D_VIEW_SCALE_MINMAX,
336 GRAPH3D_VIEW_SCALE_FULL,