1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich,
7 * Copyright 1995-2000 The LyX Team.
9 * ====================================================== */
14 #pragma implementation
19 #include "lyx_gui_misc.h"
22 // callbacks for form form_search
23 void SearchCancelCB(FL_OBJECT * ob, long)
25 fl_hide_form(ob->form);
29 void SearchForwardCB(FL_OBJECT * ob, long)
31 LyXFindReplace * lfr = static_cast<LyXFindReplace*>(ob->form->u_vdata);
36 void SearchBackwardCB(FL_OBJECT * ob, long)
38 LyXFindReplace * lfr = static_cast<LyXFindReplace*>(ob->form->u_vdata);
43 void SearchReplaceAllCB(FL_OBJECT * ob, long)
45 LyXFindReplace * lfr = static_cast<LyXFindReplace*>(ob->form->u_vdata);
46 lfr->SearchReplaceAllCB();
50 void SearchReplaceCB(FL_OBJECT * ob, long)
52 LyXFindReplace * lfr = static_cast<LyXFindReplace*>(ob->form->u_vdata);
53 lfr->SearchReplaceCB();
58 SearchForm::SearchForm()
63 SearchForm::~SearchForm()
65 // The search_form should be closed and freed when SearchForm
70 void SearchForm::SearchCancelCB()
72 fl_hide_form(search_form->form_search);
76 void SearchForm::StartSearch(LyXFindReplace * lfr)
78 static int ow = -1, oh;
81 search_form = create_form_form_search();
82 fl_set_form_atclose(search_form->form_search,
86 search_form->form_search->u_vdata = lfr;
89 if (search_form->form_search->visible) {
90 fl_raise_form(search_form->form_search);
92 fl_show_form(search_form->form_search,
93 FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
94 _("Find & Replace")); // RVDK_PATCH_5
96 ow = search_form->form_search->w;
97 oh = search_form->form_search->h;
99 fl_set_form_minsize(search_form->form_search, ow, oh);
104 // Returns the value of the replace string in the form
105 string SearchForm::ReplaceString() const
107 return fl_get_input(search_form->input_replace);
111 void SearchForm::replaceEnabled(bool fEnable)
113 fReplaceEnabled = fEnable;
115 fl_activate_object(search_form->replace_button);
116 fl_activate_object(search_form->replaceall_button);
117 fl_activate_object(search_form->input_replace);
118 fl_set_object_lcol(search_form->replace_button, FL_BLACK);
119 fl_set_object_lcol(search_form->replaceall_button, FL_BLACK);
120 fl_set_object_lcol(search_form->input_replace, FL_BLACK);
122 fl_deactivate_object(search_form->replace_button);
123 fl_deactivate_object(search_form->replaceall_button);
124 fl_deactivate_object(search_form->input_replace);
125 fl_set_object_lcol(search_form->replace_button, FL_INACTIVE);
126 fl_set_object_lcol(search_form->replaceall_button, FL_INACTIVE);
127 fl_set_object_lcol(search_form->input_replace, FL_INACTIVE);
132 void SearchForm::SetSearchString(string const & ls)
134 fl_set_input(search_form->input_search, ls.c_str());