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-2000 Kevin Rosenberg
12 ** $Id: ctsim.h,v 1.29 2001/01/20 08:10:33 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 ******************************************************************************/
42 #if defined(CTSIM_MDI) && !wxUSE_MDI_ARCHITECTURE
43 #error You must set wxUSE_MDI_ARCHITECTURE to 1 in setup.h!
46 #include "wx/docmdi.h"
52 class ImageFileDocument;
60 #include "wx/docview.h"
61 #include "wx/textctrl.h"
64 #include "wx/html/helpctrl.h"
65 #include "dlgezplot.h"
68 #if defined(__WXMSW__)
69 #define CTSIM_WINHELP 1
72 // Define a new frame for main window
74 class MainFrame: public wxMDIParentFrame
76 class MainFrame: public wxDocParentFrame
79 DECLARE_CLASS(MainFrame)
82 wxMenu* m_pWindowMenu;
84 enum { MAX_WINDOW_MENUITEMS = 20 };
85 wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
86 wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
88 int m_iDefaultPhantomID;
89 int m_iDefaultFilterID;
90 int m_iDefaultFilterDomainID;
91 unsigned int m_iDefaultFilterXSize;
92 unsigned int m_iDefaultFilterYSize;
93 double m_dDefaultFilterParam;
94 double m_dDefaultFilterBandwidth;
95 double m_dDefaultFilterInputScale;
96 double m_dDefaultFilterOutputScale;
99 wxWinHelpController m_winHelp;
101 wxHtmlHelpController m_htmlHelp;
104 MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type);
106 void OnMRUFile (wxCommandEvent& event);
108 void OnSize (wxSizeEvent& event);
111 wxWinHelpController& getWinHelpController()
114 wxHtmlHelpController& getHtmlHelpController()
115 { return m_htmlHelp; }
117 void showHelp (int commandID);
119 void OnAbout (wxCommandEvent& event);
120 void OnHelpTopics (wxCommandEvent& event);
121 void OnHelpContents (wxCommandEvent& event);
122 void OnCreatePhantom (wxCommandEvent& event);
124 #if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
125 void OnHelpSecondary (wxCommandEvent& event);
128 void OnCreateFilter (wxCommandEvent& event);
129 void OnExit (wxCommandEvent& event);
131 void OnUpdateUI (wxUpdateUIEvent& event);
136 void OnWindowMenu0 (wxCommandEvent& event);
137 void OnWindowMenu1 (wxCommandEvent& event);
138 void OnWindowMenu2 (wxCommandEvent& event);
139 void OnWindowMenu3 (wxCommandEvent& event);
140 void OnWindowMenu4 (wxCommandEvent& event);
141 void OnWindowMenu5 (wxCommandEvent& event);
142 void OnWindowMenu6 (wxCommandEvent& event);
143 void OnWindowMenu7 (wxCommandEvent& event);
144 void OnWindowMenu8 (wxCommandEvent& event);
145 void OnWindowMenu9 (wxCommandEvent& event);
146 void OnWindowMenu10 (wxCommandEvent& event);
147 void OnWindowMenu11 (wxCommandEvent& event);
148 void OnWindowMenu12 (wxCommandEvent& event);
149 void OnWindowMenu13 (wxCommandEvent& event);
150 void OnWindowMenu14 (wxCommandEvent& event);
151 void OnWindowMenu15 (wxCommandEvent& event);
152 void OnWindowMenu16 (wxCommandEvent& event);
153 void OnWindowMenu17 (wxCommandEvent& event);
154 void OnWindowMenu18 (wxCommandEvent& event);
155 void OnWindowMenu19 (wxCommandEvent& event);
157 void DoWindowMenu (int iMenuPosition, wxCommandEvent& event);
159 DECLARE_EVENT_TABLE()
164 class CTSimApp: public wxApp
170 MainFrame* getMainFrame() const
174 { return m_pFrame->getLog(); }
176 wxDocManager* getDocManager()
177 { return m_docManager; }
179 wxString getUntitledFilename();
181 EZPlotDialog* makeEZPlotDialog()
182 { return new EZPlotDialog (m_pFrame); }
184 void getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF);
186 bool getSetModifyNewDocs() const
189 void setIconForFrame (wxFrame* pFrame);
192 wxDocManager* m_docManager;
195 void usage (const char* program);
197 static struct option ctsimOptions[];
199 enum { O_HELP, O_VERSION };
202 DECLARE_APP(CTSimApp)
204 extern class CTSimApp* theApp;
207 MAINMENU_WINDOW_BASE = 500,
208 MAINMENU_HELP_ABOUT = 600,
209 MAINMENU_HELP_CONTENTS,
210 MAINMENU_HELP_TOPICS,
211 MAINMENU_HELP_SECONDARY,
212 MAINMENU_FILE_CREATE_PHANTOM,
214 MAINMENU_FILE_CREATE_FILTER,
217 PJMENU_FILE_PROPERTIES,
218 PJMENU_RECONSTRUCT_FBP,
219 PJMENU_RECONSTRUCT_FOURIER,
220 PJMENU_CONVERT_POLAR,
221 PJMENU_CONVERT_FFT_POLAR,
224 IFMENU_FILE_PROPERTIES,
230 IFMENU_PLOT_HISTOGRAM,
232 IFMENU_VIEW_SCALE_AUTO,
233 IFMENU_VIEW_SCALE_MINMAX,
234 IFMENU_VIEW_SCALE_FULL,
236 IFMENU_COMPARE_IMAGES,
239 IFMENU_IMAGE_SCALESIZE,
241 IFMENU_IMAGE_SUBTRACT,
242 IFMENU_IMAGE_MULTIPLY,
245 IFMENU_FILTER_INVERTVALUES,
247 IFMENU_FILTER_SQUARE,
250 IFMENU_FILTER_FOURIER,
251 IFMENU_FILTER_INVERSE_FOURIER,
254 IFMENU_FILTER_FFT_ROWS,
255 IFMENU_FILTER_FFT_COLS,
256 IFMENU_FILTER_IFFT_ROWS,
257 IFMENU_FILTER_IFFT_COLS,
258 IFMENU_FILTER_MAGNITUDE,
260 IFMENU_FILTER_SHUFFLENATURALTOFOURIERORDER,
261 IFMENU_FILTER_SHUFFLEFOURIERTONATURALORDER,
263 PHMMENU_FILE_PROPERTIES,
264 PHMMENU_PROCESS_RASTERIZE,
265 PHMMENU_PROCESS_PROJECTIONS,
267 PLOTMENU_VIEW_SCALE_MINMAX,
268 PLOTMENU_VIEW_SCALE_AUTO,
269 PLOTMENU_VIEW_SCALE_FULL,