-bool
-wxExtHelpController::DisplayContents(void)
-{
- if(! m_NumOfEntries)
- return false;
- wxBusyCursor b; // display a busy cursor
- return KeywordSearch("");
-}
-
-bool
-wxExtHelpController::DisplaySection(int sectionNo)
-{
- if(! m_NumOfEntries)
- return false;
-
- wxBusyCursor b; // display a busy cursor
- wxNode *node = m_MapList->First();
- wxExtHelpMapEntry *entry;
- while(node)
- {
- entry = (wxExtHelpMapEntry *)node->Data();
- if(entry->id == sectionNo)
- return CallBrowser(entry->url);
- node = node->Next();
- }
- return false;
-}
-
-bool
-wxExtHelpController::DisplayBlock(long blockNo)
-{
- return DisplaySection((int)blockNo);
-}
-
-bool
-wxExtHelpController::KeywordSearch(const wxString& k)
-{
- if(! m_NumOfEntries)
- return false;
-
- wxBusyCursor b; // display a busy cursor
- wxString *choices = new wxString[m_NumOfEntries];
- wxString *urls = new wxString[m_NumOfEntries];
- wxString compA, compB;
-
- int idx = 0, j;
- bool rc;
- bool showAll = k.IsEmpty();
- wxNode *node = m_MapList->First();
- wxExtHelpMapEntry *entry;
-
- compA = k; compA.LowerCase(); // we compare case insensitive
- while(node)
- {
- entry = (wxExtHelpMapEntry *)node->Data();
- compB = entry->doc; compB.LowerCase();
- if((showAll || compB.Contains(k)) && ! compB.IsEmpty())
- {
- urls[idx] = entry->url;
- // doesn't work:
- // choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
- //if(choices[idx].IsEmpty()) // didn't contain the ';'
- // choices[idx] = (**i).doc;
- choices[idx] = "";
- for(j=0;entry->doc.c_str()[j]
- && entry->doc.c_str()[j] != WXEXTHELP_COMMENTCHAR; j++)
- choices[idx] << entry->doc.c_str()[j];
- idx++;
- }
- node = node->Next();
- }
-
- if(idx == 1)
- rc = CallBrowser(urls[0]);
- else if(idx == 0)
- {
- wxMessageBox(_("No entries found."));
- rc = false;
- }
- else
- {
- idx = wxGetSingleChoiceIndex(showAll ? _("Help Index") : _("Relevant entries:"),
- showAll ? _("Help Index") : _("Entries found"),
- idx,choices);
- if(idx != -1)
- rc = CallBrowser(urls[idx]);
- else
- rc = false;
- }
- delete[] urls;
- delete[] choices;
-
- return rc;
-}
-
-
-bool
-wxExtHelpController::Quit(void)
-{
- return true;
-}
-
-void
-wxExtHelpController::OnQuit(void)
-{
-}