+// Handled by wxTextWindow
+void TextFileView::OnDraw(wxDC *WXUNUSED(dc) )
+{
+}
+
+void TextFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
+{
+}
+
+bool
+TextFileView::OnClose (bool deleteWindow)
+{
+ // if (m_pFrame && m_pFrame->GetTitle() == "Log")
+ return false;
+
+ GetDocumentManager()->ActivateView (this, false, true);
+ if (! GetDocument() || ! GetDocument()->Close())
+ return false;
+
+ //m_pCanvas->Show(false);
+ //m_pFrame->Show(false);
+ Activate(false);
+
+ SetFrame(NULL);
+ m_pFrame->SetView(NULL);
+ if (deleteWindow) {
+ //delete m_pFrame;
+ m_pFrame->Destroy();
+ m_pFrame = NULL;
+
+ }
+
+ return TRUE;
+}
+
+#if CTSIM_MDI
+wxDocMDIChildFrame*
+#else
+wxDocChildFrame*
+#endif
+TextFileView::CreateChildFrame (wxDocument *doc, wxView *view)
+{
+#if CTSIM_MDI
+ wxDocMDIChildFrame* subframe = new wxDocMDIChildFrame (doc, view, theApp->getMainFrame(), -1, "TextFile Frame", wxPoint(-1, -1), wxSize(300, 150), wxDEFAULT_FRAME_STYLE);
+#else
+ wxDocChildFrame* subframe = new wxDocChildFrame (doc, view, theApp->getMainFrame(), -1, "TextFile Frame", wxPoint(-1, -1), wxSize(300, 150), wxDEFAULT_FRAME_STYLE);
+#endif
+ theApp->setIconForFrame (subframe);
+
+ wxMenu *m_pFileMenu = new wxMenu;
+
+ m_pFileMenu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...\tCtrl-P");
+ m_pFileMenu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter...\tCtrl-F");
+ m_pFileMenu->Append(wxID_OPEN, "&Open...\tCtrl-O");
+ m_pFileMenu->Append(wxID_SAVE, "&Save\tCtrl-S");
+ m_pFileMenu->Append(wxID_SAVEAS, "Save &As...");
+ // m_pFileMenu->Append(wxID_CLOSE, "&Close\tCtrl-W");
+
+ m_pFileMenu->AppendSeparator();
+ m_pFileMenu->Append(wxID_PRINT, "&Print...");
+ m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
+ m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+#ifdef CTSIM_MDI
+ m_pFileMenu->AppendSeparator();
+ m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
+#endif
+ GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
+ GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
+
+ wxMenu *help_menu = new wxMenu;
+ help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1");
+ help_menu->Append(MAINMENU_HELP_TOPICS, "&Topics\tCtrl-H");
+ help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
+
+ wxMenuBar *menu_bar = new wxMenuBar;
+
+ menu_bar->Append(m_pFileMenu, "&File");
+ menu_bar->Append(help_menu, "&Help");
+
+ subframe->SetMenuBar(menu_bar);
+ subframe->Centre(wxBOTH);
+
+ wxAcceleratorEntry accelEntries[5];
+ accelEntries[0].Set (wxACCEL_CTRL, static_cast<int>('O'), wxID_OPEN);
+ accelEntries[1].Set (wxACCEL_CTRL, static_cast<int>('S'), wxID_SAVE);
+ accelEntries[2].Set (wxACCEL_CTRL, static_cast<int>('W'), wxID_CLOSE);
+ accelEntries[3].Set (wxACCEL_CTRL, static_cast<int>('H'), MAINMENU_HELP_TOPICS);
+ accelEntries[4].Set (wxACCEL_NORMAL, WXK_F1, MAINMENU_HELP_CONTENTS);
+ wxAcceleratorTable accelTable (5, accelEntries);
+ subframe->SetAcceleratorTable (accelTable);
+
+ return subframe;
+}
+
+
+// Define a constructor for my text subwindow
+TextFileCanvas::TextFileCanvas (TextFileView* v, wxFrame* frame, const wxPoint& pos, const wxSize& size, long style)
+: wxTextCtrl (frame, -1, "", pos, size, style), m_pView(v)
+{
+}
+
+TextFileCanvas::~TextFileCanvas ()
+{
+ m_pView = NULL;
+}