Lines Matching defs:search

391  * the search dialog box uses.
397 * Text Widget that will search for a string in the main
404 * If the search was sucessful and the argument popdown is passed to
406 * search widget.
424 if (DoSearch(tw->text.search) && popdown)
425 PopdownSearch(w, (XtPointer) tw->text.search, (XtPointer)NULL);
430 * Text Widget that will popdown the search widget.
445 PopdownSearch(w, (XtPointer) tw->text.search, (XtPointer)NULL);
449 * Description: Pops down the search widget and resets it.
451 * closure - a pointer to the search structure.
463 struct SearchAndReplace * search = (struct SearchAndReplace *) closure;
465 XtPopdown( search->search_popup );
466 SetSearchLabels(search, SEARCH_LABEL_1, SEARCH_LABEL_2, FALSE);
470 * Description: Performs a search when the button is clicked.
472 * closure - a pointer to the search info.
489 * it will popup the search dialog box.
499 * First Entry: The first entry is the direction to search by default.
504 * string to search for.
564 if (ctx->text.search== NULL) {
565 ctx->text.search = XtNew(struct SearchAndReplace);
566 ctx->text.search->search_popup = CreateDialog(w, ptr, "search",
568 XtRealizeWidget(ctx->text.search->search_popup);
569 SetWMProtocolTranslations(ctx->text.search->search_popup);
572 XtVaSetValues(ctx->text.search->search_text, XtNstring, ptr, NULL);
578 InitializeSearchWidget(ctx->text.search, dir, (edit_mode == XawtextEdit));
580 CenterWidgetOnPoint(ctx->text.search->search_popup, event);
581 XtPopup(ctx->text.search->search_popup, XtGrabNone);
585 * Description: This function initializes the search widget and
586 * is called each time the search widget is poped up.
587 * Arguments: search - the search widget structure.
588 * dir - direction to search.
595 InitializeSearchWidget(search, dir, replace_active)
596 struct SearchAndReplace * search;
600 SetResource(search->rep_one, XtNsensitive, (XtArgVal) replace_active);
601 SetResource(search->rep_all, XtNsensitive, (XtArgVal) replace_active);
602 SetResource(search->rep_label, XtNsensitive, (XtArgVal) replace_active);
603 SetResource(search->rep_text, XtNsensitive, (XtArgVal) replace_active);
607 SetResource(search->left_toggle, XtNstate, (XtArgVal) TRUE);
610 SetResource(search->right_toggle, XtNstate, (XtArgVal) TRUE);
619 * Arguments: form - the form widget for the search widget.
634 struct SearchAndReplace * search = ((TextWidget) tw)->text.search;
641 search->label1 = XtCreateManagedWidget("label1", labelWidgetClass, form,
645 XtSetArg(args[num_args], XtNfromVert, search->label1); num_args++;
650 search->label2 = XtCreateManagedWidget("label2", labelWidgetClass, form,
660 XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++;
665 search->left_toggle = XtCreateManagedWidget("backwards", toggleWidgetClass,
670 XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++;
671 XtSetArg(args[num_args], XtNfromHoriz, search->left_toggle); num_args++;
674 XtSetArg(args[num_args], XtNradioGroup, search->left_toggle); num_args++;
677 search->right_toggle = XtCreateManagedWidget("forwards", toggleWidgetClass,
684 XtOverrideTranslations(search->left_toggle, radio_translations);
685 XtOverrideTranslations(search->right_toggle, radio_translations);
689 XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++;
698 XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++;
708 search->search_text = s_text;
716 search->rep_label = XtCreateManagedWidget("replaceLabel", labelWidgetClass,
730 search->rep_text = r_text;
737 search_button = XtCreateManagedWidget("search", commandWidgetClass, form,
746 search->rep_one = XtCreateManagedWidget("replaceOne", commandWidgetClass,
752 XtSetArg(args[num_args], XtNfromHoriz, search->rep_one); num_args++;
755 search->rep_all = XtCreateManagedWidget("replaceAll", commandWidgetClass,
761 XtSetArg(args[num_args], XtNfromHoriz, search->rep_all); num_args++;
767 XtAddCallback(search_button, XtNcallback, SearchButton, (XtPointer) search);
768 XtAddCallback(search->rep_one, XtNcallback, DoReplaceOne, (XtPointer) search);
769 XtAddCallback(search->rep_all, XtNcallback, DoReplaceAll, (XtPointer) search);
770 XtAddCallback(cancel, XtNcallback, PopdownSearch, (XtPointer) search);
780 XtGetValues(search->rep_text, args, num_args);
783 XtSetValues(search->rep_text, args, num_args);
784 XtSetKeyboardFocus(form, search->search_text);
787 SetSearchLabels(search, SEARCH_LABEL_1, SEARCH_LABEL_2, FALSE);
794 XtOverrideTranslations(search->search_text, trans);
797 XtOverrideTranslations(search->rep_text, trans);
801 * Description: Performs a search.
802 * Arguments: search - the serach structure.
808 DoSearch(search)
809 struct SearchAndReplace * search;
811 Widget tw = XtParent(search->search_popup);
818 text.ptr = GetStringRaw(search->search_text);
825 dir = (XawTextScanDirection)(int) ((XPointer)XawToggleGetCurrent(search->left_toggle) -
838 int len = strlen (fmt) + strlen (GetString (search->search_text));
846 (void) sprintf (msg, fmt, GetString (search->search_text));
848 SetSearchLabels(search, msg, "", TRUE);
858 search->selection_changed = FALSE; /* selection is good. */
892 if (Replace( ctx->text.search, TRUE, popdown) && popdown)
893 PopdownSearch(w, (XtPointer) ctx->text.search, (XtPointer)NULL);
898 * in the search dialog's text widget
901 * closure - a pointer to the search structure.
918 * in the search dialog's text widget
921 * closure - a pointer to the search structure.
949 Replace(search, once_only, show_current)
950 struct SearchAndReplace * search;
956 Widget tw = XtParent(search->search_popup);
961 find.ptr = GetStringRaw( search->search_text);
968 replace.ptr = GetStringRaw(search->rep_text);
975 dir = (XawTextScanDirection)(int) ((XPointer)XawToggleGetCurrent(search->left_toggle) -
989 len = strlen (fmt) + strlen (GetString (search->search_text));
996 (void) sprintf (msg, fmt, GetString (search->search_text));
997 SetSearchLabels(search, msg, "", TRUE);
1010 if (search->selection_changed) {
1011 SetSearchLabels(search, "Selection has been modified, aborting.",
1033 SetSearchLabels(search, "*** Error while replacing", msg, TRUE);
1047 DoSearch(search);
1062 * Description: Sets both the search labels, and also rings the bell
1063 * Arguments: search - the search structure.
1064 * msg1, msg2 - message to put in each search label.
1070 SetSearchLabels(search, msg1, msg2, bell)
1071 struct SearchAndReplace * search;
1075 (void) SetResource( search->label1, XtNlabel, (XtArgVal) msg1);
1076 (void) SetResource( search->label2, XtNlabel, (XtArgVal) msg2);
1078 XBell(XtDisplay(search->search_popup), 0);
1104 struct SearchAndReplace * search;
1107 search = ((TextWidget) XtParent(XtParent(XtParent(w))))->text.search;
1110 SetSearchLabels(search, "*** Error: SetField Action must have",
1117 new = search->search_text;
1118 old = search->rep_text;
1122 old = search->search_text;
1123 new = search->rep_text;
1126 SetSearchLabels(search, "*** Error: SetField Action's first Argument must",
1229 * GetStringRaw returns the exact buffer contents suitable for a search.