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.41 2001/02/04 21:28:19 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"
46 #define CTSIM_CUSTOM_MRU 1
48 #if defined(CTSIM_MDI) && !wxUSE_MDI_ARCHITECTURE
49 #error You must set wxUSE_MDI_ARCHITECTURE to 1 in setup.h!
52 #include "wx/docmdi.h"
57 class ImageFileDocument;
58 class ProjectionFileDocument;
59 class PhantomFileDocument;
60 class PlotFileDocument;
61 class TextFileDocument;
63 class Graph3dFileDocument;
67 #include "wx/docview.h"
68 #include "wx/textctrl.h"
71 #include "wx/html/helpctrl.h"
72 #include "dlgezplot.h"
75 #if defined(__WXMSW__)
76 #define CTSIM_WINHELP 1
79 // Define a new frame for main window
81 class MainFrame: public wxDocMDIParentFrame
83 class MainFrame: public wxDocParentFrame
87 DECLARE_CLASS(MainFrame)
91 wxMenu* m_pWindowMenu;
94 enum { MAX_WINDOW_MENUITEMS = 20 };
95 wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
96 wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
98 int m_iDefaultPhantomID;
99 int m_iDefaultFilterID;
100 int m_iDefaultFilterDomainID;
101 unsigned int m_iDefaultFilterXSize;
102 unsigned int m_iDefaultFilterYSize;
103 double m_dDefaultFilterParam;
104 double m_dDefaultFilterBandwidth;
105 double m_dDefaultFilterInputScale;
106 double m_dDefaultFilterOutputScale;
108 bool m_bShuttingDown;
111 wxWinHelpController m_winHelp;
113 wxHtmlHelpController m_htmlHelp;
116 MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
117 virtual ~MainFrame();
119 #ifdef CTSIM_CUSTOM_MRU
120 void OnMRUFile (wxCommandEvent& event);
122 void OnSize (wxSizeEvent& event);
125 wxWinHelpController& getWinHelpController()
128 wxHtmlHelpController& getHtmlHelpController()
129 { return m_htmlHelp; }
131 void showHelp (int commandID);
133 void OnAbout (wxCommandEvent& event);
134 void OnHelpTopics (wxCommandEvent& event);
135 void OnHelpContents (wxCommandEvent& event);
136 void OnCreatePhantom (wxCommandEvent& event);
138 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
139 void OnHelpSecondary (wxCommandEvent& event);
142 void OnCreateFilter (wxCommandEvent& event);
143 void OnExit (wxCommandEvent& event);
145 void OnUpdateUI (wxUpdateUIEvent& event);
147 void OnWindowMenu0 (wxCommandEvent& event);
148 void OnWindowMenu1 (wxCommandEvent& event);
149 void OnWindowMenu2 (wxCommandEvent& event);
150 void OnWindowMenu3 (wxCommandEvent& event);
151 void OnWindowMenu4 (wxCommandEvent& event);
152 void OnWindowMenu5 (wxCommandEvent& event);
153 void OnWindowMenu6 (wxCommandEvent& event);
154 void OnWindowMenu7 (wxCommandEvent& event);
155 void OnWindowMenu8 (wxCommandEvent& event);
156 void OnWindowMenu9 (wxCommandEvent& event);
157 void OnWindowMenu10 (wxCommandEvent& event);
158 void OnWindowMenu11 (wxCommandEvent& event);
159 void OnWindowMenu12 (wxCommandEvent& event);
160 void OnWindowMenu13 (wxCommandEvent& event);
161 void OnWindowMenu14 (wxCommandEvent& event);
162 void OnWindowMenu15 (wxCommandEvent& event);
163 void OnWindowMenu16 (wxCommandEvent& event);
164 void OnWindowMenu17 (wxCommandEvent& event);
165 void OnWindowMenu18 (wxCommandEvent& event);
166 void OnWindowMenu19 (wxCommandEvent& event);
168 void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
170 bool getShuttingDown() const { return m_bShuttingDown; }
175 class CTSimApp: public wxApp
178 enum { O_HELP, O_VERSION };
179 static struct option ctsimOptions[];
181 wxDocManager* m_docManager;
185 wxDocTemplate* m_pDocTemplImage;
186 wxDocTemplate* m_pDocTemplProjection;
187 wxDocTemplate* m_pDocTemplPhantom;
188 wxDocTemplate* m_pDocTemplPlot;
189 wxDocTemplate* m_pDocTemplText;
191 wxDocTemplate* m_pDocTemplGraph3d;
194 TextFileDocument* m_pLogDoc;
196 void usage (const char* program);
202 MainFrame* getMainFrame() const
208 wxDocManager* getDocManager()
209 { return m_docManager; }
211 wxString getUntitledFilename();
213 EZPlotDialog* makeEZPlotDialog()
214 { return new EZPlotDialog (m_pFrame); }
216 void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
218 void setIconForFrame (wxFrame* pFrame);
219 wxConfig* getConfig()
220 { return m_pConfig; }
222 wxDocTemplate* getDocTemplImage() { return m_pDocTemplImage; }
223 wxDocTemplate* getDocTemplProjection() { return m_pDocTemplProjection; }
224 wxDocTemplate* getDocTemplPhantom() { return m_pDocTemplPhantom; }
225 wxDocTemplate* getDocTemplPlot() { return m_pDocTemplPlot; }
226 wxDocTemplate* getDocTemplText() { return m_pDocTemplText; }
228 wxDocTemplate* getDocTemplGraph3d() { return m_pDocTemplGraph3d; }
230 TextFileDocument* getLogDoc() { return m_pLogDoc; }
232 ProjectionFileDocument* newProjectionDoc();
233 ImageFileDocument* newImageDoc();
234 PhantomFileDocument* newPhantomDoc();
235 PlotFileDocument* newPlotDoc();
236 TextFileDocument* newTextDoc();
238 Graph3dFileDocument* newGraph3dDoc();
242 DECLARE_APP(CTSimApp)
244 extern class CTSimApp* theApp;
247 MAINMENU_WINDOW_BASE = 500,
248 MAINMENU_HELP_ABOUT = 600,
249 MAINMENU_HELP_CONTENTS,
250 MAINMENU_HELP_TOPICS,
251 MAINMENU_HELP_SECONDARY,
252 MAINMENU_FILE_CREATE_PHANTOM,
254 MAINMENU_FILE_CREATE_FILTER,
257 PJMENU_FILE_PROPERTIES,
258 PJMENU_RECONSTRUCT_FBP,
259 PJMENU_RECONSTRUCT_FOURIER,
260 PJMENU_CONVERT_POLAR,
261 PJMENU_CONVERT_FFT_POLAR,
264 IFMENU_FILE_PROPERTIES,
270 IFMENU_PLOT_HISTOGRAM,
272 IFMENU_VIEW_SCALE_AUTO,
273 IFMENU_VIEW_SCALE_MINMAX,
274 IFMENU_VIEW_SCALE_FULL,
276 IFMENU_COMPARE_IMAGES,
279 IFMENU_IMAGE_SCALESIZE,
281 IFMENU_IMAGE_SUBTRACT,
282 IFMENU_IMAGE_MULTIPLY,
285 IFMENU_IMAGE_CONVERT3D,
288 IFMENU_FILTER_INVERTVALUES,
290 IFMENU_FILTER_SQUARE,
293 IFMENU_FILTER_FOURIER,
294 IFMENU_FILTER_INVERSE_FOURIER,
297 IFMENU_FILTER_FFT_ROWS,
298 IFMENU_FILTER_FFT_COLS,
299 IFMENU_FILTER_IFFT_ROWS,
300 IFMENU_FILTER_IFFT_COLS,
301 IFMENU_FILTER_MAGNITUDE,
303 IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
304 IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
306 PHMMENU_FILE_PROPERTIES,
307 PHMMENU_PROCESS_RASTERIZE,
308 PHMMENU_PROCESS_PROJECTIONS,
310 PLOTMENU_VIEW_SCALE_MINMAX,
311 PLOTMENU_VIEW_SCALE_AUTO,
312 PLOTMENU_VIEW_SCALE_FULL,
314 GRAPH3D_VIEW_SURFACE,
316 GRAPH3D_VIEW_LIGHTING,
318 GRAPH3D_VIEW_SCALE_AUTO,
319 GRAPH3D_VIEW_SCALE_MINMAX,
320 GRAPH3D_VIEW_SCALE_FULL,