r435: *** empty log message ***
[ctsim.git] / src / ctsim.cpp
index ee7b4a8ab62285de8560f3d6e53e6322d73ee2f9..d0cc8c686c28072b085a780b62a4c5d216163ef0 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.cpp,v 1.40 2001/01/20 17:43:41 kevin Exp $
+**  $Id: ctsim.cpp,v 1.41 2001/01/26 00:45:24 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -70,7 +70,7 @@
 #endif
 #endif
 
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.40 2001/01/20 17:43:41 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.41 2001/01/26 00:45:24 kevin Exp $";
 
 struct option CTSimApp::ctsimOptions[] = 
 {
@@ -207,6 +207,11 @@ CTSimApp::usage(const char* program)
 int
 CTSimApp::OnExit()
 {
+    if (theApp->getConfig())
+      theApp->getDocManager()->FileHistorySave (*theApp->getConfig());
+    delete theApp->getDocManager();
+  m_docManager = NULL;
+
 #ifdef HAVE_DMALLOC
   dmalloc_shutdown();
 #endif
@@ -293,6 +298,7 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   file_menu->Append(MAINMENU_FILE_EXIT, "E&xit");
   
   //  history of files visited
+  theApp->getDocManager()->FileHistoryAddFilesToMenu(file_menu);
   theApp->getDocManager()->FileHistoryUseMenu(file_menu);
 
 #ifndef CTSIM_MDI
@@ -355,9 +361,6 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
 
 MainFrame::~MainFrame()
 {
-    if (theApp->getConfig())
-      theApp->getDocManager()->FileHistorySave (*theApp->getConfig());
-    delete theApp->getDocManager();
 }
 
 void
@@ -546,7 +549,7 @@ MainFrame::OnUpdateUI (wxUpdateUIEvent& rEvent)
 void 
 MainFrame::OnMRUFile (wxCommandEvent& event)
 {
-   wxString fileName (theApp->getDocManager()->GetHistoryFile(event.GetSelection()));
+   wxString fileName (theApp->getDocManager()->GetHistoryFile(event.GetId() - wxID_FILE1));
    if (fileName != "")
      theApp->getDocManager()->CreateDocument(fileName, wxDOC_SILENT);
 }