r426: Updated online help, html help now working
[ctsim.git] / src / ctsim.cpp
index 32873df061766e66a6cfdaa188beca6478315486..a34339ca2e1c7cb7ce04de0893a1eeb7c8d0d7cd 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.cpp,v 1.37 2001/01/19 22:53:57 kevin Exp $
+**  $Id: ctsim.cpp,v 1.38 2001/01/20 02:25:45 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
@@ -69,7 +69,7 @@
 #endif
 #endif
 
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.37 2001/01/19 22:53:57 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.38 2001/01/20 02:25:45 kevin Exp $";
 
 struct option CTSimApp::ctsimOptions[] = 
 {
@@ -157,9 +157,12 @@ CTSimApp::OnInit()
   
   setIconForFrame (m_pFrame);
   
-  if (! m_pFrame->getHelpController().Initialize("ctsim"))
+#ifdef CTSIM_WINHELP
+  if (! m_pFrame->getWinHelpController().Initialize("ctsim"))
+    ::wxMessageBox ("Cannot initialize the help system", "Error");
+#endif
+  if (! m_pFrame->getHtmlHelpController().Initialize(::wxGetCwd() + "/ctsim"))
     ::wxMessageBox ("Cannot initialize the help system", "Error");
-  
   
   return true;
 }
@@ -222,6 +225,9 @@ BEGIN_EVENT_TABLE(MainFrame, wxDocParentFrame)
 EVT_MENU(MAINMENU_HELP_ABOUT, MainFrame::OnAbout)
 EVT_MENU(MAINMENU_HELP_CONTENTS, MainFrame::OnHelpContents)
 EVT_MENU(MAINMENU_HELP_TOPICS, MainFrame::OnHelpTopics)
+#if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
+EVT_MENU(MAINMENU_HELP_SECONDARY, MainFrame::OnHelpSecondary)
+#endif
 EVT_MENU(MAINMENU_FILE_CREATE_PHANTOM, MainFrame::OnCreatePhantom)
 EVT_MENU(MAINMENU_FILE_CREATE_FILTER, MainFrame::OnCreateFilter)
 EVT_MENU(MAINMENU_FILE_EXIT, MainFrame::OnExit)
@@ -282,6 +288,9 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   wxMenu* help_menu = new wxMenu;
   help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents\tF1");
   help_menu->Append(MAINMENU_HELP_TOPICS, "&Topics\tCtrl-T");
+#if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
+  help_menu->Append(MAINMENU_HELP_SECONDARY, "&Secondary Help");
+#endif
   help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
   
   wxMenuBar* menu_bar = new wxMenuBar;
@@ -404,19 +413,41 @@ MainFrame::OnHelpContents (wxCommandEvent& event)
   showHelp (event.GetId());
 }
 
+#if defined(CTSIM_WINHELP) && (defined(DEBUG) || defined(_DEBUG))
+void
+MainFrame::OnHelpSecondary (wxCommandEvent& event)
+{
+    m_htmlHelp.DisplayContents();
+}
+#endif
+
 void
 MainFrame::showHelp (int commandID)
 {
-  m_help.LoadFile();
+#ifdef CTSIM_WINHELP
+  m_winHelp.LoadFile();
+#else
+  m_htmlHelp.LoadFile();
+#endif
   
   switch (commandID) {
+
   case MAINMENU_HELP_CONTENTS:
-    m_help.DisplayContents ();
+#ifdef CTSIM_WINHELP
+    m_winHelp.DisplayContents ();
+#else
+    m_htmlHelp.DisplayContents ();
+#endif
     break;
+
   case MAINMENU_HELP_TOPICS:
-    m_help.DisplaySection (introduction);
+#ifdef CTSIM_WINHELP
+    m_winHelp.DisplaySection (introduction);
+#else
+    m_htmlHelp.DisplayIndex();
+#endif
     break;
-    
+
   default:
     *getLog() << "Unknown help command # " << commandID << "\n";
     break;
@@ -600,12 +631,12 @@ private:
   BitmapControl* m_pBitmapCtrl;
   
 public:
-  BitmapDialog (wxBitmap* pBitmap);
+  BitmapDialog (wxBitmap* pBitmap, char const* pszTitle);
   virtual ~BitmapDialog();
 };
 
-BitmapDialog::BitmapDialog (wxBitmap* pBitmap)
-: wxDialog(theApp->getMainFrame(), -1, wxString("About"), wxDefaultPosition, wxDefaultSize, wxDIALOG_MODAL)
+BitmapDialog::BitmapDialog (wxBitmap* pBitmap, char const* pszTitle)
+: wxDialog(theApp->getMainFrame(), -1, wxString(pszTitle), wxDefaultPosition, wxDefaultSize, wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
   
@@ -626,17 +657,14 @@ BitmapDialog::BitmapDialog (wxBitmap* pBitmap)
 BitmapDialog::~BitmapDialog()
 {}
 
-#include "./splash.xpm"
 
+#include "./splash.xpm"
 void 
 MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
 {
-  //
-  //  wxImage image;
-  //  if (wxFile::image.LoadFile ("/splash.png")) {
   wxBitmap bmp (splash);
   if (bmp.Ok()) {
-    BitmapDialog dlg (&bmp);
+    BitmapDialog dlg (&bmp, "About CTSim");
     dlg.Show(true);
   } else {
     wxString msg = "CTSim\nThe Open Source Computed Tomography Simulator\n";