git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9934
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void SetBasePath(const wxString& path) { m_BasePath = path; }
void SetStart(const wxString& start) { m_Start = start; }
void SetBasePath(const wxString& path) { m_BasePath = path; }
void SetStart(const wxString& start) { m_Start = start; }
+ // returns full filename of page (which is part of the book),
+ // i.e. with book's basePath prepended. If page is already absolute
+ // path, basePath is _not_ prepended.
+ wxString GetFullPath(const wxString &page) const;
+
protected:
wxString m_BasePath;
wxString m_Title;
protected:
wxString m_BasePath;
wxString m_Title;
wxChar* m_Name;
wxChar* m_Page;
wxHtmlBookRecord *m_Book;
wxChar* m_Name;
wxChar* m_Page;
wxHtmlBookRecord *m_Book;
+
+ // returns full filename of m_Page, i.e. with book's basePath prepended
+ wxString GetFullPath() const { return m_Book->GetFullPath(m_Page); }
};
//------------------------------------------------------------------------------
};
//------------------------------------------------------------------------------
bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f);
};
bool SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f);
};
-// Utility function
-wxString wxAddBasePath(const wxString& basePath, const wxString& path) ;
-
// wxHtmlHelpData
//-----------------------------------------------------------------------------
// wxHtmlHelpData
//-----------------------------------------------------------------------------
+wxString wxHtmlBookRecord::GetFullPath(const wxString &page) const
+{
+ if (wxIsAbsolutePath(page))
+ return page;
+ else
+ return m_BasePath + page;
+}
+
+
+
IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpData, wxObject)
wxHtmlHelpData::wxHtmlHelpData()
IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpData, wxObject)
wxHtmlHelpData::wxHtmlHelpData()
cnt = m_BookRecords.GetCount();
for (i = 0; i < cnt; i++)
{
cnt = m_BookRecords.GetCount();
for (i = 0; i < cnt; i++)
{
- f = fsys.OpenFile(wxAddBasePath(m_BookRecords[i].GetBasePath(), x));
+ f = fsys.OpenFile(m_BookRecords[i].GetFullPath(x));
- url = wxAddBasePath(m_BookRecords[i].GetBasePath(), x);
+ url = m_BookRecords[i].GetFullPath(x);
{
if (m_BookRecords[i].GetTitle() == x)
{
{
if (m_BookRecords[i].GetTitle() == x)
{
- url = wxAddBasePath(m_BookRecords[i].GetBasePath(), m_BookRecords[i].GetStart());
+ url = m_BookRecords[i].GetFullPath(m_BookRecords[i].GetStart());
{
if (wxStrcmp(m_Contents[i].m_Name, x) == 0)
{
{
if (wxStrcmp(m_Contents[i].m_Name, x) == 0)
{
- url = wxAddBasePath(m_Contents[i].m_Book->GetBasePath(), m_Contents[i].m_Page);
+ url = m_Contents[i].GetFullPath();
{
if (wxStrcmp(m_Index[i].m_Name, x) == 0)
{
{
if (wxStrcmp(m_Index[i].m_Name, x) == 0)
{
- url = wxAddBasePath(m_Index[i].m_Book->GetBasePath(), m_Index[i].m_Page);
+ url = m_Index[i].GetFullPath();
{
if (m_Contents[i].m_ID == id)
{
{
if (m_Contents[i].m_ID == id)
{
- url = wxAddBasePath(m_Contents[i].m_Book->GetBasePath(), m_Contents[i].m_Page);
+ url = m_Contents[i].GetFullPath();
else m_LastPage = thepage;
wxFileSystem fsys;
else m_LastPage = thepage;
wxFileSystem fsys;
- file = fsys.OpenFile(wxAddBasePath(m_Data->m_Contents[i].m_Book->GetBasePath(), thepage));
+ file = fsys.OpenFile(m_Data->m_Contents[i].m_Book->GetFullPath(thepage));
- if (m_Engine.Scan(file->GetStream())) {
+ if (m_Engine.Scan(file->GetStream()))
+ {
m_Name = m_Data->m_Contents[i].m_Name;
m_ContentsItem = m_Data->m_Contents + i;
found = TRUE;
m_Name = m_Data->m_Contents[i].m_Name;
m_ContentsItem = m_Data->m_Contents + i;
found = TRUE;
-// Utility function
-wxString wxAddBasePath(const wxString& basePath, const wxString& path)
-{
- if (wxIsAbsolutePath(path))
- return path;
- else
- return basePath + path;
-}
-
{
wxHtmlBookRecord& book = m_Data->GetBookRecArray()[0];
if (!book.GetStart().IsEmpty())
{
wxHtmlBookRecord& book = m_Data->GetBookRecArray()[0];
if (!book.GetStart().IsEmpty())
- m_HtmlWin->LoadPage(wxAddBasePath(book.GetBasePath(), book.GetStart()));
+ m_HtmlWin->LoadPage(book.GetFullPath(book.GetStart()));
{
wxHtmlBookRecord& book = m_Data->GetBookRecArray()[0];
if (!book.GetStart().IsEmpty())
{
wxHtmlBookRecord& book = m_Data->GetBookRecArray()[0];
if (!book.GetStart().IsEmpty())
- m_HtmlWin->LoadPage(wxAddBasePath(book.GetBasePath(), book.GetStart()));
+ m_HtmlWin->LoadPage(book.GetFullPath(book.GetStart()));
wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
if (it)
{
wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
if (it)
{
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
roots[it->m_Level + 1] = m_ContentsBox->AppendItem(
roots[it->m_Level], it->m_Name, IMG_Page, -1,
new wxHtmlHelpTreeItemData(i));
roots[it->m_Level + 1] = m_ContentsBox->AppendItem(
roots[it->m_Level], it->m_Name, IMG_Page, -1,
new wxHtmlHelpTreeItemData(i));
- m_PagesHash->Put(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page),
+ m_PagesHash->Put(it->GetFullPath(),
new wxHtmlHelpHashData(i, roots[it->m_Level + 1]));
if (it->m_Level == 0)
new wxHtmlHelpHashData(i, roots[it->m_Level + 1]));
if (it->m_Level == 0)
wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index - 1);
if (it->m_Page[0] != 0)
{
wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index - 1);
if (it->m_Page[0] != 0)
{
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
{
if (it->m_Page[0] != 0)
{
{
if (it->m_Page[0] != 0)
{
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
{
wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index + 1);
{
wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index + 1);
- while (wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page) == adr) it++;
+ while (it->GetFullPath() == adr) it++;
if (it->m_Page[0] != 0)
{
if (it->m_Page[0] != 0)
{
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
it = m_Data->GetContents() + (pg->m_Id);
m_UpdateContents = FALSE;
if (it->m_Page[0] != 0)
it = m_Data->GetContents() + (pg->m_Id);
m_UpdateContents = FALSE;
if (it->m_Page[0] != 0)
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
m_UpdateContents = TRUE;
}
}
m_UpdateContents = TRUE;
}
}
{
wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexList->GetClientData(m_IndexList->GetSelection());
if (it->m_Page[0] != 0)
{
wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexList->GetClientData(m_IndexList->GetSelection());
if (it->m_Page[0] != 0)
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
if (first)
{
if (index[i].m_Page[0] != 0)
if (first)
{
if (index[i].m_Page[0] != 0)
- m_HtmlWin->LoadPage(wxAddBasePath(index[i].m_Book->GetBasePath(), index[i].m_Page));
+ m_HtmlWin->LoadPage(index[i].GetFullPath());
NotifyPageChanged();
first = FALSE;
}
NotifyPageChanged();
first = FALSE;
}
if (first)
{
if (index[i].m_Page[0] != 0)
if (first)
{
if (index[i].m_Page[0] != 0)
- m_HtmlWin->LoadPage(wxAddBasePath(index[i].m_Book->GetBasePath(), index[i].m_Page));
+ m_HtmlWin->LoadPage(index[i].GetFullPath());
NotifyPageChanged();
first = FALSE;
}
NotifyPageChanged();
first = FALSE;
}
if (it)
{
if (it->m_Page[0] != 0)
if (it)
{
if (it->m_Page[0] != 0)
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());