]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormThesaurus.C
Yet more dialog tweaking from Rob.
[lyx.git] / src / frontends / xforms / FormThesaurus.C
index 4f2b097ea7cadebfb547a7b0363e9aec661beced..d94196dcf2a25184809c52bf6f0db2afff68fa76 100644 (file)
@@ -1,9 +1,11 @@
 /**
  * \file FormThesaurus.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, leuven@fee.uva.nl
+ * \author Edwin Leuven
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 #pragma implementation
 #endif
 
-#include <cctype>
-#include "support/lstrings.h"
-#include "xformsBC.h"
-#include "xforms_helpers.h"
 #include "ControlThesaurus.h"
 #include "FormThesaurus.h"
-#include "form_thesaurus.h"
+#include "forms/form_thesaurus.h"
+#include "xformsBC.h"
+#include "xforms_helpers.h"
 #include "debug.h"
+#include "support/lstrings.h"
+#include FORMS_H_LOCATION
+#include <cctype>
 
+#ifndef CXX_GLOBAL_CSTD
+using std::isupper;
+using std::islower;
+#endif
 
 using std::vector;
 
 
-typedef FormCB<ControlThesaurus, FormDB<FD_form_thesaurus> > base_class;
+typedef FormCB<ControlThesaurus, FormDB<FD_thesaurus> > base_class;
 
 
-FormThesaurus::FormThesaurus(ControlThesaurus & c)
-       : base_class(c, _("LyX: Thesaurus"), false),
+FormThesaurus::FormThesaurus()
+       : base_class(_("Thesaurus"), false),
          clickline_(-1)
 {
 }
@@ -37,14 +44,14 @@ FormThesaurus::FormThesaurus(ControlThesaurus & c)
 
 void FormThesaurus::build()
 {
-       dialog_.reset(build_thesaurus());
+       dialog_.reset(build_thesaurus(this));
 
        fl_set_input_return(dialog_->input_entry,   FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_replace, FL_RETURN_CHANGED);
 
        setPrehandler(dialog_->input_entry);
        setPrehandler(dialog_->input_replace);
+
        // Manage the ok, apply and cancel/close buttons
        bc().setCancel(dialog_->button_close);
        bc().addReadOnly(dialog_->input_replace);
@@ -68,7 +75,7 @@ void FormThesaurus::update()
 void FormThesaurus::updateMeanings(string const & str)
 {
        fl_clear_browser(dialog_->browser_meanings);
+
        fl_set_input(dialog_->input_entry, str.c_str());
 
        fl_set_browser_topline(dialog_->browser_meanings, 1);
@@ -82,7 +89,7 @@ void FormThesaurus::updateMeanings(string const & str)
        for (; cit != end; ++cit) {
                fl_add_browser_line(dialog_->browser_meanings,
                                    cit->first.c_str());
-               
+
                vector<string> const & tmpvec = cit->second;
                vector<string>::const_iterator cit2 = tmpvec.begin();
                vector<string>::const_iterator end2 = tmpvec.end();
@@ -93,7 +100,7 @@ void FormThesaurus::updateMeanings(string const & str)
                                            ent.c_str());
                }
        }
+
        fl_unfreeze_form(form());
        fl_redraw_form(form());
 }
@@ -126,12 +133,12 @@ void FormThesaurus::setReplace(string const & templ, string const & nstr)
        } else if (templ.size() > 0 && isupper(templ[0])) {
                bool rest_lower = true;
                string::const_iterator cit2 = beg + 1;
-               
+
                for (; cit2 != end; ++cit2) {
                        if (isupper(*cit2))
                                rest_lower = false;
                }
-               
+
                if (rest_lower) {
                        str = lowercase(nstr);
                        str[0] = uppercase(nstr[0]);
@@ -145,8 +152,8 @@ void FormThesaurus::setReplace(string const & templ, string const & nstr)
 ButtonPolicy::SMInput FormThesaurus::input(FL_OBJECT * obj, long)
 {
        if (obj == dialog_->input_entry) {
-               string s = strip(frontStrip(fl_get_input(dialog_->input_entry)));
-                
+               string s = trim(fl_get_input(dialog_->input_entry));
+
                updateMeanings(s);
 
                if (s.empty()) {
@@ -169,7 +176,7 @@ ButtonPolicy::SMInput FormThesaurus::input(FL_OBJECT * obj, long)
        int const line = fl_get_browser(obj);
        if (line > 0) {
                setReplace(fl_get_input(dialog_->input_entry),
-                          strip(frontStrip(fl_get_browser_line(obj, line))));
+                          trim(fl_get_browser_line(obj, line)));
        }
 
        if (clickline_ == fl_get_browser(obj)) {