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.35 2001/01/29 23:11:32 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;
64 #include "wx/docview.h"
65 #include "wx/textctrl.h"
68 #include "wx/html/helpctrl.h"
69 #include "dlgezplot.h"
72 #if defined(__WXMSW__)
73 #define CTSIM_WINHELP 1
76 // Define a new frame for main window
78 class MainFrame: public wxDocMDIParentFrame
80 class MainFrame: public wxDocParentFrame
84 DECLARE_CLASS(MainFrame)
88 wxMenu* m_pWindowMenu;
91 enum { MAX_WINDOW_MENUITEMS = 20 };
92 wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
93 wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
95 int m_iDefaultPhantomID;
96 int m_iDefaultFilterID;
97 int m_iDefaultFilterDomainID;
98 unsigned int m_iDefaultFilterXSize;
99 unsigned int m_iDefaultFilterYSize;
100 double m_dDefaultFilterParam;
101 double m_dDefaultFilterBandwidth;
102 double m_dDefaultFilterInputScale;
103 double m_dDefaultFilterOutputScale;
106 wxWinHelpController m_winHelp;
108 wxHtmlHelpController m_htmlHelp;
111 MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
112 virtual ~MainFrame();
114 #ifdef CTSIM_CUSTOM_MRU
115 void OnMRUFile (wxCommandEvent& event);
117 void OnSize (wxSizeEvent& event);
120 wxWinHelpController& getWinHelpController()
123 wxHtmlHelpController& getHtmlHelpController()
124 { return m_htmlHelp; }
126 void showHelp (int commandID);
128 void OnAbout (wxCommandEvent& event);
129 void OnHelpTopics (wxCommandEvent& event);
130 void OnHelpContents (wxCommandEvent& event);
131 void OnCreatePhantom (wxCommandEvent& event);
133 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
134 void OnHelpSecondary (wxCommandEvent& event);
137 void OnCreateFilter (wxCommandEvent& event);
138 void OnExit (wxCommandEvent& event);
140 void OnUpdateUI (wxUpdateUIEvent& event);
142 void OnWindowMenu0 (wxCommandEvent& event);
143 void OnWindowMenu1 (wxCommandEvent& event);
144 void OnWindowMenu2 (wxCommandEvent& event);
145 void OnWindowMenu3 (wxCommandEvent& event);
146 void OnWindowMenu4 (wxCommandEvent& event);
147 void OnWindowMenu5 (wxCommandEvent& event);
148 void OnWindowMenu6 (wxCommandEvent& event);
149 void OnWindowMenu7 (wxCommandEvent& event);
150 void OnWindowMenu8 (wxCommandEvent& event);
151 void OnWindowMenu9 (wxCommandEvent& event);
152 void OnWindowMenu10 (wxCommandEvent& event);
153 void OnWindowMenu11 (wxCommandEvent& event);
154 void OnWindowMenu12 (wxCommandEvent& event);
155 void OnWindowMenu13 (wxCommandEvent& event);
156 void OnWindowMenu14 (wxCommandEvent& event);
157 void OnWindowMenu15 (wxCommandEvent& event);
158 void OnWindowMenu16 (wxCommandEvent& event);
159 void OnWindowMenu17 (wxCommandEvent& event);
160 void OnWindowMenu18 (wxCommandEvent& event);
161 void OnWindowMenu19 (wxCommandEvent& event);
163 void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
168 class CTSimApp: public wxApp
171 enum { O_HELP, O_VERSION };
172 static struct option ctsimOptions[];
174 wxDocManager* m_docManager;
178 wxDocTemplate* m_pDocTemplImage;
179 wxDocTemplate* m_pDocTemplProjection;
180 wxDocTemplate* m_pDocTemplPhantom;
181 wxDocTemplate* m_pDocTemplPlot;
182 wxDocTemplate* m_pDocTemplText;
183 TextFileDocument* m_pLogDoc;
185 void usage (const char* program);
191 MainFrame* getMainFrame() const
197 wxDocManager* getDocManager()
198 { return m_docManager; }
200 wxString getUntitledFilename();
202 EZPlotDialog* makeEZPlotDialog()
203 { return new EZPlotDialog (m_pFrame); }
205 void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
207 void setIconForFrame (wxFrame* pFrame);
208 wxConfig* getConfig()
209 { return m_pConfig; }
211 wxDocTemplate* getDocTemplImage() { return m_pDocTemplImage; }
212 wxDocTemplate* getDocTemplProjection() { return m_pDocTemplProjection; }
213 wxDocTemplate* getDocTemplPhantom() { return m_pDocTemplPhantom; }
214 wxDocTemplate* getDocTemplPlot() { return m_pDocTemplPlot; }
215 wxDocTemplate* getDocTemplText() { return m_pDocTemplText; }
216 TextFileDocument* getLogDoc() { return m_pLogDoc; }
218 ProjectionFileDocument* newProjectionDoc();
219 ImageFileDocument* newImageDoc();
220 PhantomFileDocument* newPhantomDoc();
221 PlotFileDocument* newPlotDoc();
222 TextFileDocument* newTextDoc();
226 DECLARE_APP(CTSimApp)
228 extern class CTSimApp* theApp;
231 MAINMENU_WINDOW_BASE = 500,
232 MAINMENU_HELP_ABOUT = 600,
233 MAINMENU_HELP_CONTENTS,
234 MAINMENU_HELP_TOPICS,
235 MAINMENU_HELP_SECONDARY,
236 MAINMENU_FILE_CREATE_PHANTOM,
238 MAINMENU_FILE_CREATE_FILTER,
241 PJMENU_FILE_PROPERTIES,
242 PJMENU_RECONSTRUCT_FBP,
243 PJMENU_RECONSTRUCT_FOURIER,
244 PJMENU_CONVERT_POLAR,
245 PJMENU_CONVERT_FFT_POLAR,
248 IFMENU_FILE_PROPERTIES,
254 IFMENU_PLOT_HISTOGRAM,
256 IFMENU_VIEW_SCALE_AUTO,
257 IFMENU_VIEW_SCALE_MINMAX,
258 IFMENU_VIEW_SCALE_FULL,
260 IFMENU_COMPARE_IMAGES,
263 IFMENU_IMAGE_SCALESIZE,
265 IFMENU_IMAGE_SUBTRACT,
266 IFMENU_IMAGE_MULTIPLY,
269 IFMENU_FILTER_INVERTVALUES,
271 IFMENU_FILTER_SQUARE,
274 IFMENU_FILTER_FOURIER,
275 IFMENU_FILTER_INVERSE_FOURIER,
278 IFMENU_FILTER_FFT_ROWS,
279 IFMENU_FILTER_FFT_COLS,
280 IFMENU_FILTER_IFFT_ROWS,
281 IFMENU_FILTER_IFFT_COLS,
282 IFMENU_FILTER_MAGNITUDE,
284 IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
285 IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
287 PHMMENU_FILE_PROPERTIES,
288 PHMMENU_PROCESS_RASTERIZE,
289 PHMMENU_PROCESS_PROJECTIONS,
291 PLOTMENU_VIEW_SCALE_MINMAX,
292 PLOTMENU_VIEW_SCALE_AUTO,
293 PLOTMENU_VIEW_SCALE_FULL,