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.44 2001/02/11 21:57:08 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"
42 #include "wx/msw/helpchm.h"
47 #define CTSIM_CUSTOM_MRU 1
49 #if defined(CTSIM_MDI) && !wxUSE_MDI_ARCHITECTURE
50 #error You must set wxUSE_MDI_ARCHITECTURE to 1 in setup.h!
53 #include "wx/docmdi.h"
58 class ImageFileDocument;
59 class ProjectionFileDocument;
60 class PhantomFileDocument;
61 class PlotFileDocument;
62 class TextFileDocument;
64 class Graph3dFileDocument;
68 #include "wx/docview.h"
69 #include "wx/textctrl.h"
72 #include "wx/html/helpctrl.h"
73 #include "dlgezplot.h"
76 #if defined(__WXMSW__) || defined (MSVC)
77 #define CTSIM_WINHELP 1
80 // Define a new frame for main window
82 class MainFrame: public wxDocMDIParentFrame
84 class MainFrame: public wxDocParentFrame
88 DECLARE_CLASS(MainFrame)
92 wxMenu* m_pWindowMenu;
95 enum { MAX_WINDOW_MENUITEMS = 20 };
96 wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
97 wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
99 int m_iDefaultPhantomID;
100 int m_iDefaultFilterID;
101 int m_iDefaultFilterDomainID;
102 unsigned int m_iDefaultFilterXSize;
103 unsigned int m_iDefaultFilterYSize;
104 double m_dDefaultFilterParam;
105 double m_dDefaultFilterBandwidth;
106 double m_dDefaultFilterInputScale;
107 double m_dDefaultFilterOutputScale;
109 bool m_bShuttingDown;
112 wxCHMHelpController m_winHelp;
114 wxHtmlHelpController m_htmlHelp;
117 MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
118 virtual ~MainFrame();
120 #ifdef CTSIM_CUSTOM_MRU
121 void OnMRUFile (wxCommandEvent& event);
123 void OnSize (wxSizeEvent& event);
126 wxCHMHelpController& getWinHelpController()
129 wxHtmlHelpController& getHtmlHelpController()
130 { return m_htmlHelp; }
132 void showHelp (int commandID);
134 void OnAbout (wxCommandEvent& event);
135 void OnHelpTopics (wxCommandEvent& event);
136 void OnHelpContents (wxCommandEvent& event);
137 void OnCreatePhantom (wxCommandEvent& event);
138 void OnPreferences (wxCommandEvent& event);
140 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
141 void OnHelpSecondary (wxCommandEvent& event);
144 void OnCreateFilter (wxCommandEvent& event);
145 void OnExit (wxCommandEvent& event);
147 void OnUpdateUI (wxUpdateUIEvent& event);
149 void OnWindowMenu0 (wxCommandEvent& event);
150 void OnWindowMenu1 (wxCommandEvent& event);
151 void OnWindowMenu2 (wxCommandEvent& event);
152 void OnWindowMenu3 (wxCommandEvent& event);
153 void OnWindowMenu4 (wxCommandEvent& event);
154 void OnWindowMenu5 (wxCommandEvent& event);
155 void OnWindowMenu6 (wxCommandEvent& event);
156 void OnWindowMenu7 (wxCommandEvent& event);
157 void OnWindowMenu8 (wxCommandEvent& event);
158 void OnWindowMenu9 (wxCommandEvent& event);
159 void OnWindowMenu10 (wxCommandEvent& event);
160 void OnWindowMenu11 (wxCommandEvent& event);
161 void OnWindowMenu12 (wxCommandEvent& event);
162 void OnWindowMenu13 (wxCommandEvent& event);
163 void OnWindowMenu14 (wxCommandEvent& event);
164 void OnWindowMenu15 (wxCommandEvent& event);
165 void OnWindowMenu16 (wxCommandEvent& event);
166 void OnWindowMenu17 (wxCommandEvent& event);
167 void OnWindowMenu18 (wxCommandEvent& event);
168 void OnWindowMenu19 (wxCommandEvent& event);
170 void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
172 bool getShuttingDown() const { return m_bShuttingDown; }
177 class CTSimApp: public wxApp
180 enum { O_HELP, O_VERSION };
181 static struct option ctsimOptions[];
183 bool m_bAdvancedOptions;
184 bool m_bSetModifyNewDocs;
186 wxDocManager* m_docManager;
190 wxDocTemplate* m_pDocTemplImage;
191 wxDocTemplate* m_pDocTemplProjection;
192 wxDocTemplate* m_pDocTemplPhantom;
193 wxDocTemplate* m_pDocTemplPlot;
194 wxDocTemplate* m_pDocTemplText;
196 wxDocTemplate* m_pDocTemplGraph3d;
199 TextFileDocument* m_pLogDoc;
201 void usage (const char* program);
209 MainFrame* getMainFrame() const
215 wxDocManager* getDocManager()
216 { return m_docManager; }
218 wxString getUntitledFilename();
220 EZPlotDialog* makeEZPlotDialog()
221 { return new EZPlotDialog (m_pFrame); }
223 void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
224 bool getAdvancedOptions() const { return m_bAdvancedOptions; }
225 void setAdvancedOptions (bool bAdv) { m_bAdvancedOptions = bAdv; }
227 void setIconForFrame (wxFrame* pFrame);
228 wxConfig* getConfig()
229 { return m_pConfig; }
230 bool getAskDeleteNewDocs() const { return m_bSetModifyNewDocs; }
231 void setAskDeleteNewDocs(bool bAsk) { m_bSetModifyNewDocs = bAsk; }
233 wxDocTemplate* getDocTemplImage() { return m_pDocTemplImage; }
234 wxDocTemplate* getDocTemplProjection() { return m_pDocTemplProjection; }
235 wxDocTemplate* getDocTemplPhantom() { return m_pDocTemplPhantom; }
236 wxDocTemplate* getDocTemplPlot() { return m_pDocTemplPlot; }
237 wxDocTemplate* getDocTemplText() { return m_pDocTemplText; }
239 wxDocTemplate* getDocTemplGraph3d() { return m_pDocTemplGraph3d; }
241 TextFileDocument* getLogDoc() { return m_pLogDoc; }
243 ProjectionFileDocument* newProjectionDoc();
244 ImageFileDocument* newImageDoc();
245 PhantomFileDocument* newPhantomDoc();
246 PlotFileDocument* newPlotDoc();
247 TextFileDocument* newTextDoc();
249 Graph3dFileDocument* newGraph3dDoc();
253 DECLARE_APP(CTSimApp)
255 extern class CTSimApp* theApp;
258 MAINMENU_WINDOW_BASE = 500,
259 MAINMENU_HELP_ABOUT = 600,
260 MAINMENU_HELP_CONTENTS,
261 MAINMENU_HELP_TOPICS,
262 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
263 MAINMENU_HELP_SECONDARY,
265 MAINMENU_FILE_CREATE_PHANTOM,
267 MAINMENU_FILE_CREATE_FILTER,
269 MAINMENU_FILE_PREFERENCES,
271 PJMENU_FILE_PROPERTIES,
272 PJMENU_RECONSTRUCT_FBP,
273 PJMENU_RECONSTRUCT_FOURIER,
274 PJMENU_CONVERT_POLAR,
275 PJMENU_CONVERT_FFT_POLAR,
278 IFMENU_FILE_PROPERTIES,
284 IFMENU_PLOT_HISTOGRAM,
286 IFMENU_VIEW_SCALE_AUTO,
287 IFMENU_VIEW_SCALE_MINMAX,
288 IFMENU_VIEW_SCALE_FULL,
290 IFMENU_COMPARE_IMAGES,
293 IFMENU_IMAGE_SCALESIZE,
295 IFMENU_IMAGE_SUBTRACT,
296 IFMENU_IMAGE_MULTIPLY,
299 IFMENU_IMAGE_CONVERT3D,
302 IFMENU_FILTER_INVERTVALUES,
304 IFMENU_FILTER_SQUARE,
307 IFMENU_FILTER_FOURIER,
308 IFMENU_FILTER_INVERSE_FOURIER,
311 IFMENU_FILTER_FFT_ROWS,
312 IFMENU_FILTER_FFT_COLS,
313 IFMENU_FILTER_IFFT_ROWS,
314 IFMENU_FILTER_IFFT_COLS,
315 IFMENU_FILTER_MAGNITUDE,
317 IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
318 IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
320 PHMMENU_FILE_PROPERTIES,
321 PHMMENU_PROCESS_RASTERIZE,
322 PHMMENU_PROCESS_PROJECTIONS,
324 PLOTMENU_VIEW_SCALE_MINMAX,
325 PLOTMENU_VIEW_SCALE_AUTO,
326 PLOTMENU_VIEW_SCALE_FULL,
328 GRAPH3D_VIEW_SURFACE,
330 GRAPH3D_VIEW_LIGHTING,
332 GRAPH3D_VIEW_SCALE_AUTO,
333 GRAPH3D_VIEW_SCALE_MINMAX,
334 GRAPH3D_VIEW_SCALE_FULL,