]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/helpfrm.cpp
Conditional compilation fix.
[wxWidgets.git] / src / html / helpfrm.cpp
index 61d4a1b72ce67fb65c20146f04490abd4020b3ae..fca7231c10e8d357d1e7afc053da39a589afcc22 100644 (file)
@@ -328,6 +328,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
 
     wxMenu* helpMenu = new wxMenu;
     helpMenu->Append(wxID_ABOUT, _("&About..."));
 
     wxMenu* helpMenu = new wxMenu;
     helpMenu->Append(wxID_ABOUT, _("&About..."));
+    // Ensures we don't get an empty help menu
+    helpMenu->Append(wxID_HELP_CONTENTS, _("&About..."));
 
     menuBar->Append(fileMenu,_("&File"));
     menuBar->Append(helpMenu,_("&Help"));
 
     menuBar->Append(fileMenu,_("&File"));
     menuBar->Append(helpMenu,_("&Help"));
@@ -336,7 +338,9 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
 
     int notebook_page = 0;
 
 
     int notebook_page = 0;
 
+#if wxUSE_STATUSBAR
     CreateStatusBar();
     CreateStatusBar();
+#endif // wxUSE_STATUSBAR
 
 #if wxUSE_TOOLBAR
     // toolbar?
 
 #if wxUSE_TOOLBAR
     // toolbar?
@@ -375,7 +379,9 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
     }
 
     m_HtmlWin->SetRelatedFrame(this, m_TitleFormat);
     }
 
     m_HtmlWin->SetRelatedFrame(this, m_TitleFormat);
+#if wxUSE_STATUSBAR
     m_HtmlWin->SetRelatedStatusBar(0);
     m_HtmlWin->SetRelatedStatusBar(0);
+#endif // wxUSE_STATUSBAR
     if ( m_Config )
         m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);
 
     if ( m_Config )
         m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);
 
@@ -553,6 +559,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
 
 wxHtmlHelpFrame::~wxHtmlHelpFrame()
 {
 
 wxHtmlHelpFrame::~wxHtmlHelpFrame()
 {
+    delete m_mergedIndex;
+    
     // PopEventHandler(); // wxhtmlhelpcontroller (not any more!)
     if (m_DataCreated)
         delete m_Data;
     // PopEventHandler(); // wxhtmlhelpcontroller (not any more!)
     if (m_DataCreated)
         delete m_Data;
@@ -1271,7 +1279,7 @@ void wxHtmlHelpFrame::OptionsDialog()
         enu.EnumerateFacenames();
         m_NormalFonts = new wxArrayString;
         *m_NormalFonts = *enu.GetFacenames();
         enu.EnumerateFacenames();
         m_NormalFonts = new wxArrayString;
         *m_NormalFonts = *enu.GetFacenames();
-        m_NormalFonts->Sort(wxStringSortAscending);
+        m_NormalFonts->Sort(); // ascending sort
     }
     if (m_FixedFonts == NULL)
     {
     }
     if (m_FixedFonts == NULL)
     {
@@ -1279,7 +1287,7 @@ void wxHtmlHelpFrame::OptionsDialog()
         enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, true /*enum fixed width only*/);
         m_FixedFonts = new wxArrayString;
         *m_FixedFonts = *enu.GetFacenames();
         enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, true /*enum fixed width only*/);
         m_FixedFonts = new wxArrayString;
         *m_FixedFonts = *enu.GetFacenames();
-        m_FixedFonts->Sort(wxStringSortAscending);
+        m_FixedFonts->Sort(); // ascending sort
     }
 
     // VS: We want to show the font that is actually used by wxHtmlWindow.
     }
 
     // VS: We want to show the font that is actually used by wxHtmlWindow.
@@ -1626,8 +1634,13 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event)
 
                 if (displ++ == 0)
                 {
 
                 if (displ++ == 0)
                 {
-                    m_IndexList->SetSelection(0);
-                    DisplayIndexItem(&index[i]);
+                    // don't automatically show topic selector if this
+                    // item points to multiple pages:
+                    if (index[i].items.size() == 1)
+                    {
+                        m_IndexList->SetSelection(0);
+                        DisplayIndexItem(&index[i]);
+                    }
                 }
 
                 // if this is nested item of the index, show its parent(s)
                 }
 
                 // if this is nested item of the index, show its parent(s)
@@ -1671,7 +1684,12 @@ void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event))
         m_IndexList->Append(index[i].name, (char*)(&index[i]));
         if (first)
         {
         m_IndexList->Append(index[i].name, (char*)(&index[i]));
         if (first)
         {
-            DisplayIndexItem(&index[i]);
+            // don't automatically show topic selector if this
+            // item points to multiple pages:
+            if (index[i].items.size() == 1)
+            {
+                DisplayIndexItem(&index[i]);
+            }
             first = false;
         }
     }
             first = false;
         }
     }
@@ -1768,6 +1786,7 @@ BEGIN_EVENT_TABLE(wxHtmlHelpFrame, wxFrame)
 #ifdef __WXMAC__
     EVT_MENU(wxID_CLOSE, wxHtmlHelpFrame::OnClose)
     EVT_MENU(wxID_ABOUT, wxHtmlHelpFrame::OnAbout)
 #ifdef __WXMAC__
     EVT_MENU(wxID_CLOSE, wxHtmlHelpFrame::OnClose)
     EVT_MENU(wxID_ABOUT, wxHtmlHelpFrame::OnAbout)
+    EVT_MENU(wxID_HELP_CONTENTS, wxHtmlHelpFrame::OnAbout)
 #endif
 
 END_EVENT_TABLE()
 #endif
 
 END_EVENT_TABLE()