1 /*****************************************************************************
5 ** Purpose: Header file for top-level routines of 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.cpp,v 1.4 2000/07/13 07:01:59 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 ******************************************************************************/
28 // For compilers that support precompilation, includes "wx/wx.h".
29 #include "wx/wxprec.h"
39 #if !wxUSE_DOC_VIEW_ARCHITECTURE
40 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
43 #include "wx/docview.h"
49 IMPLEMENT_APP(CTSimApp)
51 CTSimApp::CTSimApp(void)
52 : m_docManager(NULL), m_pFrame(NULL)
57 CTSimApp::OnInit(void)
59 m_docManager = new wxDocManager;
61 (void) new wxDocTemplate (m_docManager, "ImageFile", "*.if", "", "if", "ImageFile doc", "ImageFile View", CLASSINFO(ImageFileDocument), CLASSINFO(ImageFileView));
63 (void) new wxDocTemplate (m_docManager, "ProjectionFile", "*.pj", "", "pj", "ProjectionFile doc", "ProjectionFile View", CLASSINFO(ProjectionFileDocument), CLASSINFO(ProjectionFileView));
65 //// Create the main frame window
66 m_pFrame = new MainFrame(m_docManager, (wxFrame *) NULL, -1, "CTSim", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
69 wxMenu *file_menu = new wxMenu;
71 // file_menu->Append(wxID_NEW, "&New...");
72 file_menu->Append(wxID_OPEN, "&Open...");
74 file_menu->AppendSeparator();
75 file_menu->Append(MAINMENU_FILE_EXIT, "E&xit");
77 // A nice touch: a history of files visited. Use this menu.
78 m_docManager->FileHistoryUseMenu(file_menu);
80 wxMenu *help_menu = new wxMenu;
81 help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
83 wxMenuBar *menu_bar = new wxMenuBar;
85 menu_bar->Append(file_menu, "&File");
86 menu_bar->Append(help_menu, "&Help");
88 m_pFrame->SetMenuBar(menu_bar);
90 m_pFrame->Centre(wxBOTH);
93 SetTopWindow (m_pFrame);
98 CTSimApp::OnExit(void)
105 // Top-level window for CTSim
107 IMPLEMENT_CLASS(MainFrame, wxDocParentFrame)
108 BEGIN_EVENT_TABLE(MainFrame, wxDocParentFrame)
109 EVT_MENU(MAINMENU_HELP_ABOUT, MainFrame::OnAbout)
110 EVT_MENU(MAINMENU_FILE_EXIT, MainFrame::OnExit)
113 MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long type)
114 : wxDocParentFrame(manager, frame, id, title, pos, size, type)
117 SetStatusText ("Welcome to CTSim");
121 MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
123 wxMessageBox("CTSim\nAuthor: Kevin Rosenberg <kevin@rosenberg.net>\nUsage: ctsim", "About CTSim", wxOK | wxICON_INFORMATION, this);
127 MainFrame::OnExit (wxCommandEvent& WXUNUSED(event) )