void SelectionWindow::MessageReceived(BMessage *message) { switch (message->what) { case kSelectButtonPressed: { Hide(); // Order of posting and hiding important // since we want to activate the target // window when the message arrives. // (Hide is synhcronous, while PostMessage is not.) // See PoseView::SelectMatchingEntries(). BMessage *selectionInfo = new BMessage(kSelectMatchingEntries); selectionInfo->AddInt32("ExpressionType", ExpressionType()); BString expression; Expression(expression); selectionInfo->AddString("Expression", expression.String()); selectionInfo->AddBool("InvertSelection", Invert()); selectionInfo->AddBool("IgnoreCase", IgnoreCase()); fParentWindow->PostMessage(selectionInfo); } break; default: _inherited::MessageReceived(message); } }
static int substr(MENU *m, char *s1, char *s2) { if (IgnoreCase(m)) { while (*s1 && *s2) { if (toupper(*s1++) != toupper(*s2++)) { return (FALSE); } } } else { while (*s1 && *s2) { if (*s1++ != *s2++) { return (FALSE); } } } if (*s1) { return (FALSE); } return (TRUE); }