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;
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);
};
-// Utility function
-wxString wxAddBasePath(const wxString& basePath, const wxString& path) ;
-
#endif
#endif
// 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()
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));
if (f)
{
- url = wxAddBasePath(m_BookRecords[i].GetBasePath(), x);
+ url = m_BookRecords[i].GetFullPath(x);
delete f;
return url;
}
{
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());
return url;
}
}
{
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();
return url;
}
}
{
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();
return url;
}
}
{
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();
return url;
}
}
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 (file)
{
- 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;
return found;
}
-// Utility function
-wxString wxAddBasePath(const wxString& basePath, const wxString& path)
-{
- if (wxIsAbsolutePath(path))
- return path;
- else
- return basePath + path;
-}
-
#endif
{
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()));
}
return TRUE;
}
{
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()));
}
return TRUE;
}
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());
NotifyPageChanged();
}
}
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)
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());
NotifyPageChanged();
}
}
{
if (it->m_Page[0] != 0)
{
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
NotifyPageChanged();
}
}
{
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)
{
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
NotifyPageChanged();
}
}
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;
}
}
{
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());
NotifyPageChanged();
}
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;
}
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;
}
if (it)
{
if (it->m_Page[0] != 0)
- m_HtmlWin->LoadPage(wxAddBasePath(it->m_Book->GetBasePath(), it->m_Page));
+ m_HtmlWin->LoadPage(it->GetFullPath());
NotifyPageChanged();
}
}