]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/helpfrm.cpp
Implement wxRB_GROUP
[wxWidgets.git] / src / html / helpfrm.cpp
index 9914d5817ff3c8e263827e2ed38f3d84404d62ae..c10b8254c5ab0c63351732783d293c596e2d7f5d 100644 (file)
@@ -601,6 +601,12 @@ bool wxHtmlHelpFrame::DisplayContents()
         m_Cfg.navig_on = TRUE;
     }
     m_NavigPan->SetSelection(0);
+    if (m_Data->GetBookRecArray().GetCount() > 0)
+    {
+        wxHtmlBookRecord& book = m_Data->GetBookRecArray()[0];
+        if (!book.GetStart().IsEmpty())
+            m_HtmlWin->LoadPage(wxAddBasePath(book.GetBasePath(), book.GetStart()));
+    }
     return TRUE;
 }
 
@@ -617,6 +623,12 @@ bool wxHtmlHelpFrame::DisplayIndex()
         m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
     }
     m_NavigPan->SetSelection(1);
+    if (m_Data->GetBookRecArray().GetCount() > 0)
+    {
+        wxHtmlBookRecord& book = m_Data->GetBookRecArray()[0];
+        if (!book.GetStart().IsEmpty())
+            m_HtmlWin->LoadPage(wxAddBasePath(book.GetBasePath(), book.GetStart()));
+    }
     return TRUE;
 }
 
@@ -674,7 +686,7 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
         wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
         if (it)
         {
-            m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
+            m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
             NotifyPageChanged();
         }
     }
@@ -713,7 +725,7 @@ void wxHtmlHelpFrame::CreateContents()
         roots[it->m_Level + 1] =  m_ContentsBox->AppendItem(
                                        roots[it->m_Level], it->m_Name, IMG_Page, -1,
                                        new wxHtmlHelpTreeItemData(i));
-        m_PagesHash->Put(it->m_Book->GetBasePath() + it->m_Page,
+        m_PagesHash->Put(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page),
                            new wxHtmlHelpHashData(i, roots[it->m_Level + 1]));
 
         if (it->m_Level == 0)
@@ -1100,8 +1112,11 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
                 if (ha && ha->m_Index > 0)
                 {
                     wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index - 1);
-                    m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
-                    NotifyPageChanged();
+                    if (it->m_Page[0] != 0)
+                    {
+                        m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+                        NotifyPageChanged();
+                    }
                 }
             }
             break;
@@ -1125,8 +1140,11 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
                     while (ind >= 0 && it->m_Level != level) ind--, it--;
                     if (ind >= 0)
                     {
-                        m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
-                        NotifyPageChanged();
+                        if (it->m_Page[0] != 0)
+                        {
+                            m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+                            NotifyPageChanged();
+                        }
                     }
                 }
             }
@@ -1148,9 +1166,13 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
                 {
                     wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index + 1);
 
-                    while (it->m_Book->GetBasePath() + it->m_Page == adr) it++;
-                    m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
-                    NotifyPageChanged();
+                    while (wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page) == adr) it++;
+
+                    if (it->m_Page[0] != 0)
+                    {
+                        m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+                        NotifyPageChanged();
+                    }
                 }
             }
             break;
@@ -1270,7 +1292,8 @@ void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event)
     {
         it = m_Data->GetContents() + (pg->m_Id);
         m_UpdateContents = FALSE;
-        m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
+        if (it->m_Page[0] != 0)
+            m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
         m_UpdateContents = TRUE;
     }
 }
@@ -1280,7 +1303,8 @@ void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event)
 void wxHtmlHelpFrame::OnIndexSel(wxCommandEvent& WXUNUSED(event))
 {
     wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexList->GetClientData(m_IndexList->GetSelection());
-    m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
+    if (it->m_Page[0] != 0)
+        m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
     NotifyPageChanged();
 }
 
@@ -1318,7 +1342,8 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event)
                 displ++;
                 if (first)
                        {
-                    m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
+                    if (index[i].m_Page[0] != 0)
+                        m_HtmlWin->LoadPage(wxAddBasePath(index[i].m_Book->GetBasePath(), index[i].m_Page));
                     NotifyPageChanged();
                     first = FALSE;
                 }
@@ -1348,7 +1373,8 @@ void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event))
         m_IndexList->Append(index[i].m_Name, (char*)(index + i));
         if (first)
            {
-            m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
+            if (index[i].m_Page[0] != 0)
+                m_HtmlWin->LoadPage(wxAddBasePath(index[i].m_Book->GetBasePath(), index[i].m_Page));
             NotifyPageChanged();
             first = FALSE;
         }
@@ -1365,7 +1391,8 @@ void wxHtmlHelpFrame::OnSearchSel(wxCommandEvent& WXUNUSED(event))
     wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(m_SearchList->GetSelection());
     if (it)
     {
-        m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
+        if (it->m_Page[0] != 0)
+            m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
         NotifyPageChanged();
     }
 }