int IndexOld = m_IndexCnt,
ContentsOld = m_ContentsCnt;
- if (! path.IsEmpty())
+ if (!path.IsEmpty())
fsys.ChangePathTo(path, TRUE);
- bookr = new wxHtmlBookRecord(fsys.GetPath(), title, deftopic);
+ size_t booksCnt = m_BookRecords.GetCount();
+ for (size_t i = 0; i < booksCnt; i++)
+ {
+ if ( m_BookRecords[i].GetBookFile() == bookfile.GetLocation() )
+ return TRUE; // book is (was) loaded
+ }
+ bookr = new wxHtmlBookRecord(bookfile.GetLocation(), fsys.GetPath(), title, deftopic);
+
if (m_ContentsCnt % wxHTML_REALLOC_STEP == 0)
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
m_Contents[m_ContentsCnt].m_Level = 0;