bool wxExtHelpController::DisplayContents() { if (! m_NumOfEntries) return false; wxString contents; wxList::compatibility_iterator node = m_MapList->GetFirst(); wxExtHelpMapEntry *entry; while (node) { entry = (wxExtHelpMapEntry *)node->GetData(); if (entry->id == CONTENTS_ID) { contents = entry->url; break; } node = node->GetNext(); } bool rc = false; wxString file; file << m_helpDir << wxFILE_SEP_PATH << contents; if (file.Contains(wxT('#'))) file = file.BeforeLast(wxT('#')); if (contents.length() && wxFileExists(file)) rc = DisplaySection(CONTENTS_ID); // if not found, open homemade toc: return rc ? true : KeywordSearch(wxEmptyString); }
bool wxExtHelpController::DisplaySection(const wxString& section) { bool isFilename = (section.Find(wxT(".htm")) != -1); if (isFilename) return DisplayHelp(section); else return KeywordSearch(section); }
void wxHtmlHelpController::Display(const wxString& x) { int cnt; int i; wxFileSystem fsys; wxFSFile *f; CreateHelpWindow(); /* 1. try to open given file: */ cnt = m_BookRecords.GetCount(); for (i = 0; i < cnt; i++) { f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x); if (f) { m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + x); delete f; return; } } /* 2. try to find a book: */ for (i = 0; i < cnt; i++) { if (m_BookRecords[i].GetTitle() == x) { m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + m_BookRecords[i].GetStart()); return; } } /* 3. try to find in contents: */ cnt = m_ContentsCnt; for (i = 0; i < cnt; i++) { if (strcmp(m_Contents[i].m_Name, x) == 0) { m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page); return; } } /* 4. try to find in index: */ cnt = m_IndexCnt; for (i = 0; i < cnt; i++) { if (strcmp(m_Index[i].m_Name, x) == 0) { m_HtmlWin -> LoadPage(m_Index[i].m_Book -> GetBasePath() + m_Index[i].m_Page); return; } } /* 5. if everything failed, search the documents: */ KeywordSearch(x); }
// Use topic or HTML filename bool wxCHMHelpController::DisplaySection(const wxString& section) { if (m_helpFile.IsEmpty()) return false; // Is this an HTML file or a keyword? if ( section.Find(wxT(".htm")) != wxNOT_FOUND ) { // interpret as a file name return CallHtmlHelp(HH_DISPLAY_TOPIC, wxMSW_CONV_LPCTSTR(section)); } return KeywordSearch(section); }
// Use topic or HTML filename bool wxCHMHelpController::DisplaySection(const wxString& section) { if (m_helpFile.IsEmpty()) return false; wxString str = GetValidFilename(m_helpFile); // Is this an HTML file or a keyword? if ( section.Find(wxT(".htm")) != wxNOT_FOUND ) { // interpret as a file name return CallHtmlHelpFunction(GetParentWindow(), str, HH_DISPLAY_TOPIC, wxPtrToUInt(section.c_str())); } return KeywordSearch(section); }
void wxHtmlHelpController::OnSearch(wxCommandEvent& event) { wxString sr = m_SearchText -> GetLineText(0); if (sr != wxEmptyString) KeywordSearch(sr); }