- wxBusyCursor b; // display a busy cursor
- compA = k; compA.LowerCase(); // we compare case insensitive
- while(node)
- {
- entry = (wxExtHelpMapEntry *)node->GetData();
- compB = entry->doc; compB.LowerCase();
- if((showAll || compB.Contains(k)) && ! compB.empty())
- {
- urls[idx] = entry->url;
- // doesn't work:
- // choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
- //if(choices[idx].empty()) // didn't contain the ';'
- // choices[idx] = (**i).doc;
- choices[idx] = wxEmptyString;
- 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->GetNext();
- }
- }
-
- if(idx == 1)
- rc = DisplayHelp(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 = DisplayHelp(urls[idx]);
- else
- rc = false;
- }
- delete[] urls;
- delete[] choices;
-
- return rc;
+ // display a busy cursor
+ wxBusyCursor b;
+ wxString compA, compB;
+ wxExtHelpMapEntry *entry;
+
+ // we compare case insensitive
+ if (! showAll)
+ {
+ compA = k;
+ compA.LowerCase();
+ }
+
+ while (node)
+ {
+ entry = (wxExtHelpMapEntry *)node->GetData();
+ compB = entry->doc;
+
+ bool testTarget = ! compB.empty();
+ if (testTarget && ! showAll)
+ {
+ compB.LowerCase();
+ testTarget = compB.Contains(compA);
+ }
+
+ if (testTarget)
+ {
+ urls[idx] = entry->url;
+ // doesn't work:
+ // choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
+ //if (choices[idx].empty()) // didn't contain the ';'
+ // choices[idx] = (**i).doc;
+ choices[idx] = wxEmptyString;
+ for (int j=0; ; j++)
+ {
+ wxChar targetChar = entry->doc.c_str()[j];
+ if ((targetChar == 0) || (targetChar == WXEXTHELP_COMMENTCHAR))
+ break;
+
+ choices[idx] << targetChar;
+ }
+
+ idx++;
+ }
+
+ node = node->GetNext();
+ }
+ }
+
+ switch (idx)
+ {
+ case 0:
+ wxMessageBox(_("No entries found."));
+ break;
+
+ case 1:
+ rc = DisplayHelp(urls[0]);
+ break;
+
+ default:
+ if (showAll)
+ idx = wxGetSingleChoiceIndex(_("Help Index"),
+ _("Help Index"),
+ idx, choices);
+ else
+ idx = wxGetSingleChoiceIndex(_("Relevant entries:"),
+ _("Entries found"),
+ idx, choices);
+
+ if (idx >= 0)
+ rc = DisplayHelp(urls[idx]);
+ break;
+ }
+
+ delete [] urls;
+ delete [] choices;
+
+ return rc;