]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormSearch.C
Yet more dialog tweaking from Rob.
[lyx.git] / src / frontends / xforms / FormSearch.C
index 78ffcf5ab93a27c03f4db33855af39b1304518a0..cd578cb3b201a22f80f909e0b659505e0b77ba34 100644 (file)
@@ -1,10 +1,11 @@
-// -*- C++ -*-
 /**
  * \file FormSearch.C
- * Copyright 2001 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Edwin Leuven
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 #include "xformsBC.h"
 #include "ControlSearch.h"
 #include "FormSearch.h"
-#include "form_search.h"
+#include "forms/form_search.h"
+#include FORMS_H_LOCATION
 
-typedef FormCB<ControlSearch, FormDB<FD_form_search> > base_class;
+typedef FormCB<ControlSearch, FormDB<FD_search> > base_class;
 
-FormSearch::FormSearch(ControlSearch & c)
-       : base_class(c, _("LyX: Find and Replace"))
+FormSearch::FormSearch()
+       : base_class(_("Find and Replace"))
 {}
 
 
 void FormSearch::build()
 {
-       dialog_.reset(build_search());
-       
+       dialog_.reset(build_search(this));
+
        // Manage the ok, apply and cancel/close buttons
-       bc().setCancel(dialog_->button_cancel);
+       bc().setCancel(dialog_->button_close);
        bc().addReadOnly(dialog_->input_replace);
-       bc().addReadOnly(dialog_->replace);
-       bc().addReadOnly(dialog_->replaceall);
+       bc().addReadOnly(dialog_->button_replace);
+       bc().addReadOnly(dialog_->button_replaceall);
+}
+
+
+void FormSearch::update()
+{
+       fl_set_input_selected(dialog_->input_search, true);
+       fl_set_focus_object(dialog_->form, dialog_->input_search);
 }
 
 
 ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
 {
-       if (obj == dialog_->findnext || obj == dialog_->findprev) {
-               bool const forward = (obj == dialog_->findnext);
-       
+       if (obj == dialog_->button_findnext ||
+           obj == dialog_->button_findprev) {
+               bool const forward = (obj == dialog_->button_findnext);
+
                controller().find(fl_get_input(dialog_->input_search),
-                                 fl_get_button(dialog_->casesensitive),
-                                 fl_get_button(dialog_->matchword),
+                                 fl_get_button(dialog_->check_casesensitive),
+                                 fl_get_button(dialog_->check_matchword),
                                  forward);
 
-       } else if (obj == dialog_->replace || obj == dialog_->replaceall) {
-               bool const all = (obj == dialog_->replaceall);
-       
+       } else if (obj == dialog_->button_replace ||
+                  obj == dialog_->button_replaceall) {
+               bool const all = (obj == dialog_->button_replaceall);
+
                controller().replace(fl_get_input(dialog_->input_search),
                                     fl_get_input(dialog_->input_replace),
-                                    fl_get_button(dialog_->casesensitive),
-                                    fl_get_button(dialog_->matchword),
+                                    fl_get_button(dialog_->check_casesensitive),
+                                    fl_get_button(dialog_->check_matchword),
                                     all);
        }
-   
+
        return ButtonPolicy::SMI_VALID;
 }