r415: no message
[ctsim.git] / src / ctsim.cpp
index 190ad49e34a2649242725e45d386422864df0c1c..6408e67b30156b15646d75d8a5b6b689eb5d5351 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.cpp,v 1.31 2001/01/17 11:00:18 kevin Exp $
+**  $Id: ctsim.cpp,v 1.32 2001/01/17 13:03: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
@@ -25,6 +25,9 @@
 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ******************************************************************************/
 
+#ifdef MSVC
+#define strdup _strdup
+#endif
 
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
@@ -47,6 +50,7 @@
 
 #include "ct.h"
 #include "ctsim.h"
+#include "ctsim-map.h"
 #include "docs.h"
 #include "views.h"
 #include "dialogs.h"
@@ -65,7 +69,7 @@
 #endif
 #endif
 
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.31 2001/01/17 11:00:18 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.32 2001/01/17 13:03:24 kevin Exp $";
 
 struct option CTSimApp::ctsimOptions[] = 
 {
@@ -156,11 +160,13 @@ CTSimApp::OnInit()
   if (! m_pFrame->getHelpController().Initialize("ctsim"))
     ::wxMessageBox ("Cannot initialize the help system", "Error");
 
-  wxAcceleratorEntry accelEntries[3];
-  accelEntries[0].Set(wxACCEL_CTRL, WXK_F1, MAINMENU_HELP_TOPICS);
-  accelEntries[1].Set(wxACCEL_CTRL, (int) 'P', MAINMENU_FILE_CREATE_PHANTOM);
-  accelEntries[2].Set(wxACCEL_CTRL, (int) 'F', MAINMENU_FILE_CREATE_FILTER);
-  wxAcceleratorTable accelTable (2, accelEntries);
+  wxAcceleratorEntry accelEntries[5];
+  accelEntries[0].Set(wxACCEL_CTRL, (int) 'O', wxID_OPEN);
+  accelEntries[1].Set(wxACCEL_CTRL, (int) 'T', MAINMENU_HELP_TOPICS);
+  accelEntries[2].Set(wxACCEL_CTRL, (int) 'P', MAINMENU_FILE_CREATE_PHANTOM);
+  accelEntries[3].Set(wxACCEL_CTRL, (int) 'F', MAINMENU_FILE_CREATE_FILTER);
+  accelEntries[4].Set(wxACCEL_NORMAL, WXK_F1, MAINMENU_HELP_CONTENTS);
+  wxAcceleratorTable accelTable (4, accelEntries);
   m_pFrame->SetAcceleratorTable (accelTable);
 
   return true;
@@ -222,6 +228,7 @@ BEGIN_EVENT_TABLE(MainFrame, wxDocParentFrame)
 #endif
 
 EVT_MENU(MAINMENU_HELP_ABOUT, MainFrame::OnAbout)
+EVT_MENU(MAINMENU_HELP_CONTENTS, MainFrame::OnHelpContents)
 EVT_MENU(MAINMENU_HELP_TOPICS, MainFrame::OnHelpTopics)
 EVT_MENU(MAINMENU_FILE_CREATE_PHANTOM, MainFrame::OnCreatePhantom)
 EVT_MENU(MAINMENU_FILE_CREATE_FILTER, MainFrame::OnCreateFilter)
@@ -269,7 +276,7 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   
   file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...\tCtrl-P");
   file_menu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter...\tCtrl-F");
-  file_menu->Append(wxID_OPEN, "&Open...");
+  file_menu->Append(wxID_OPEN, "&Open...\tCtrl-O");
   
   file_menu->AppendSeparator();
   file_menu->Append(MAINMENU_FILE_EXIT, "E&xit");
@@ -281,8 +288,8 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   m_pWindowMenu->UpdateUI (this);
   
   wxMenu* help_menu = new wxMenu;
-  help_menu->Append(MAINMENU_HELP_TOPICS, "&Topics\tF1");
-  help_menu->AppendSeparator();
+  help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1");
+  help_menu->Append(MAINMENU_HELP_TOPICS, "&Topics\tCtrl-T");
   help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
   
   wxMenuBar* menu_bar = new wxMenuBar;
@@ -405,14 +412,23 @@ MainFrame::OnHelpTopics (wxCommandEvent& event)
    showHelp (event.GetId());
 }
 
+void 
+MainFrame::OnHelpContents (wxCommandEvent& event)
+{
+   showHelp (event.GetId());
+}
+
 void
 MainFrame::showHelp (int commandID)
 {
   m_help.LoadFile();
 
   switch (commandID) {
+  case MAINMENU_HELP_CONTENTS:
+     m_help.DisplayContents ();
+     break;
   case MAINMENU_HELP_TOPICS:
-     m_help.DisplayContents();
+     m_help.DisplaySection (if1);
      break;
 
   default: