Lines Matching defs:search
416 * the search dialog box uses
424 * will search for a string in the main Text Widget.
427 * If the search was successful and the argument popdown is passed to
429 * search widget
442 if (DoSearch(tw->text.search) && popdown)
443 PopdownSearch(w, (XtPointer)tw->text.search, NULL);
452 * will popdown the search widget.
461 PopdownSearch(w, (XtPointer)tw->text.search, NULL);
470 * closure - pointer to the search structure
474 * Pops down the search widget and resets it
480 struct SearchAndReplace *search = (struct SearchAndReplace *)closure;
482 XtPopdown(search->search_popup);
483 SetSearchLabels(search, SEARCH_LABEL_1, SEARCH_LABEL_2, False);
492 * closure - pointer to the search info
496 * Performs a search when the button is clicked.
517 * it will popup the search dialog box.
524 * The first entry is the direction to search by default.
530 * string to search for.
581 if (ctx->text.search== NULL) {
582 ctx->text.search = XtNew(struct SearchAndReplace);
583 ctx->text.search->search_popup = CreateDialog(w, ptr, "search",
585 XtRealizeWidget(ctx->text.search->search_popup);
586 SetWMProtocolTranslations(ctx->text.search->search_popup);
589 XtVaSetValues(ctx->text.search->search_text, XtNstring, ptr, NULL);
594 InitializeSearchWidget(ctx->text.search, dir, (edit_mode == XawtextEdit));
596 CenterWidgetOnPoint(ctx->text.search->search_popup, event);
597 XtPopup(ctx->text.search->search_popup, XtGrabNone);
605 * search - search widget structure
606 * dir - direction to search
610 * This function initializes the search widget and
611 * is called each time the search widget is popped up.
614 InitializeSearchWidget(struct SearchAndReplace *search,
617 SetResource(search->rep_one, XtNsensitive, (XtArgVal)replace_active);
618 SetResource(search->rep_all, XtNsensitive, (XtArgVal)replace_active);
619 SetResource(search->rep_label, XtNsensitive, (XtArgVal)replace_active);
620 SetResource(search->rep_text, XtNsensitive, (XtArgVal)replace_active);
624 SetResource(search->left_toggle, XtNstate, (XtArgVal)True);
627 SetResource(search->right_toggle, XtNstate, (XtArgVal)True);
637 * form - form widget for the search widget
651 struct SearchAndReplace *search = ((TextWidget)tw)->text.search;
658 search->label1 = XtCreateManagedWidget("label1", labelWidgetClass, form,
662 XtSetArg(args[num_args], XtNfromVert, search->label1); num_args++;
667 search->label2 = XtCreateManagedWidget("label2", labelWidgetClass, form,
676 XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++;
681 search->left_toggle = XtCreateManagedWidget("backwards", toggleWidgetClass,
686 XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++;
687 XtSetArg(args[num_args], XtNfromHoriz, search->left_toggle); num_args++;
690 XtSetArg(args[num_args], XtNradioGroup, search->left_toggle); num_args++;
693 search->right_toggle = XtCreateManagedWidget("forwards", toggleWidgetClass,
700 XtOverrideTranslations(search->left_toggle, radio_translations);
701 XtOverrideTranslations(search->right_toggle, radio_translations);
708 XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++;
709 XtSetArg(args[num_args], XtNfromHoriz, search->right_toggle); num_args++;
713 search->case_sensitive = XtCreateManagedWidget("case", toggleWidgetClass,
717 search->case_sensitive = NULL;
721 XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++;
730 XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++;
739 search->search_text = s_text;
747 search->rep_label = XtCreateManagedWidget("replaceLabel", labelWidgetClass,
760 search->rep_text = r_text;
767 search_button = XtCreateManagedWidget("search", commandWidgetClass, form,
776 search->rep_one = XtCreateManagedWidget("replaceOne", commandWidgetClass,
782 XtSetArg(args[num_args], XtNfromHoriz, search->rep_one); num_args++;
785 search->rep_all = XtCreateManagedWidget("replaceAll", commandWidgetClass,
791 XtSetArg(args[num_args], XtNfromHoriz, search->rep_all); num_args++;
797 XtAddCallback(search_button, XtNcallback, SearchButton, (XtPointer)search);
798 XtAddCallback(search->rep_one, XtNcallback, DoReplaceOne, (XtPointer)search);
799 XtAddCallback(search->rep_all, XtNcallback, DoReplaceAll, (XtPointer)search);
800 XtAddCallback(cancel, XtNcallback, PopdownSearch, (XtPointer)search);
810 XtGetValues(search->rep_text, args, num_args);
813 XtSetValues(search->rep_text, args, num_args);
814 XtSetKeyboardFocus(form, search->search_text);
817 SetSearchLabels(search, SEARCH_LABEL_1, SEARCH_LABEL_2, False);
823 XtOverrideTranslations(search->search_text, trans);
826 XtOverrideTranslations(search->rep_text, trans);
834 * search - search structure
837 * Performs a search
844 DoSearch(struct SearchAndReplace *search)
847 Widget tw = XtParent(search->search_popup);
854 text.ptr = GetStringRaw(search->search_text);
861 if (search->case_sensitive) {
869 XtGetValues(search->case_sensitive, args, 1);
876 ((XPointer)XawToggleGetCurrent(search->left_toggle) - R_OFFSET);
887 ptr = GetString(search->search_text);
904 SetSearchLabels(search, "Could not find string", msg, True);
910 search->selection_changed = False; /* selection is good */
945 if (Replace( ctx->text.search, True, popdown) && popdown)
946 PopdownSearch(w, (XtPointer)ctx->text.search, NULL);
955 * closure - a pointer to the search structure
959 * Replaces the first instance of the string in the search
975 * closure - pointer to the search structure
979 * Replaces every instance of the string in the search dialog's
1006 Replace(struct SearchAndReplace *search, Bool once_only, Bool show_current)
1011 Widget tw = XtParent(search->search_popup);
1016 find.ptr = GetStringRaw(search->search_text);
1023 replace.ptr = GetStringRaw(search->rep_text);
1031 ((XPointer)XawToggleGetCurrent(search->left_toggle) - R_OFFSET);
1048 ptr = GetString(search->search_text);
1063 SetSearchLabels(search, "Could not find string", msg, True);
1082 if (search->selection_changed) {
1083 SetSearchLabels(search, "Selection modified, aborting.",
1103 SetSearchLabels(search, "Error while replacing.", "", True);
1121 DoSearch(search);
1149 * search - search structure
1150 * msg1 - message to put in each search label
1155 * Sets both the search labels, and also rings the bell.
1158 SetSearchLabels(struct SearchAndReplace *search, String msg1, String msg2,
1161 (void)SetResource(search->label1, XtNlabel, (XtArgVal)msg1);
1162 (void)SetResource(search->label2, XtNlabel, (XtArgVal)msg2);
1164 XBell(XtDisplay(search->search_popup), 0);
1183 struct SearchAndReplace *search;
1186 search = ((TextWidget)XtParent(XtParent(XtParent(w))))->text.search;
1189 SetSearchLabels(search, "Error: SetField Action must have",
1196 cnew = search->search_text;
1197 old = search->rep_text;
1201 old = search->search_text;
1202 cnew = search->rep_text;
1205 SetSearchLabels(search,
1316 * GetStringRaw: the exact buffer contents suitable for a search