]> git.lyx.org Git - lyx.git/commitdiff
- Applied the thesaurus patch.
authorAsger Ottar Alstrup <alstrup@lyx.org>
Sun, 29 Jul 2001 10:42:11 +0000 (10:42 +0000)
committerAsger Ottar Alstrup <alstrup@lyx.org>
Sun, 29 Jul 2001 10:42:11 +0000 (10:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2381 a592a061-630c-0410-9148-cb99ea01b6c8

33 files changed:
ChangeLog
INSTALL
NEWS
configure.in
lib/ChangeLog
lib/bind/cua.bind
lib/ui/default.ui
po/POTFILES.in
src/BufferView_pimpl.C
src/ChangeLog
src/LyXAction.C
src/Makefile.am
src/Thesaurus.C [new file with mode: 0644]
src/Thesaurus.h [new file with mode: 0644]
src/commandtags.h
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlThesaurus.C [new file with mode: 0644]
src/frontends/controllers/ControlThesaurus.h [new file with mode: 0644]
src/frontends/controllers/GUI.h
src/frontends/controllers/Makefile.am
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormThesaurus.C [new file with mode: 0644]
src/frontends/xforms/FormThesaurus.h [new file with mode: 0644]
src/frontends/xforms/Makefile.am
src/frontends/xforms/form_thesaurus.C [new file with mode: 0644]
src/frontends/xforms/form_thesaurus.h [new file with mode: 0644]
src/frontends/xforms/forms/form_thesaurus.fd [new file with mode: 0644]
src/frontends/xforms/forms/makefile
src/lyxfind.C
src/lyxfind.h

index 785bc34e4f6810f949d7df61571169c9fd405aab..b30c1918eccdc269e85304ab3accb4dd2303818e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-26  John Levon  <moz@compsoc.man.ac.uk>
+
+       * NEWS:
+       * INSTALL:
+       * configure.in: add libAikSaurus
+
 2001-07-25  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * NEWS: update again.
diff --git a/INSTALL b/INSTALL
index 6662268ec25ba5e5ec0b11bc29cf8ac38af3a3f1..57a240626e58db146b5df00bd81a542e62c41176 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -55,6 +55,11 @@ developers to request a version for your system.  You can get it from
 In addition, you must have libXpm version 4.7 (or newer; 4.8 rumoured
 to work).
 
+To use the thesaurus, you will need to install libAikSaurus, available
+from :
+
+    http://aiken.clan11.com/aiksaurus/ 
 You will also probably need GNU m4 (perhaps installed as gm4).
  
 libXpm can be found at:
diff --git a/NEWS b/NEWS
index 11a393f17b9bbc8249cab9973041718445a6e386..2820e11cc2c9b252baf16d17cc2f35eb82f79afa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -73,6 +73,7 @@ Other changes include:
 
 - babel can be disabled when using the default language.
 
+- a thesaurus facility (English only)
 
 
 What's new in LyX version 1.1.6?
index 14a13021c9b7b7c9acd58a560abd648a7f50f0a4..5e4437f46d2fb572056336aee195a0bac76495ea 100644 (file)
@@ -111,6 +111,12 @@ dnl by testing these we check if it is ok to have
 dnl -lc and -lm as args to the compiler
 AC_CHECK_LIB(m, sin)
 AC_CHECK_LIB(c, fopen)
+AC_CHECK_LIB(bz2, main)
+AC_CHECK_LIB(AikSaurus, main, 
+       [AC_DEFINE(HAVE_LIBAIKSAURUS,,[Define this if you have the AikSaurus library])
+        AIKSAURUS_LIBS="-lAikSaurus"
+        AC_SUBST(AIKSAURUS_LIBS)
+       ])
 
 ### Add extra directories to check for libraries.
 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
index 9de9c5ae4b666cce14c1552f22c30e75e9725ddd..9c1dd035e67adde33cf65f6faf3afa60f5ff6353 100644 (file)
@@ -1,3 +1,8 @@
+2001-07-26  John Levon  <moz@compsoc.man.ac.uk>
+
+       * bind/cua.bind:
+       * ui/default.ui: entries for thesaurus
 2001-07-25  André Pönitz <poenitz@gmx.net>
 
        * bind/math.bind:  new LFUN 'math-space'
index b04653d3243a5e34e610652d46fc59f7ee850453..4536c4ac1b7dc3b212cbf80ae5037dcdd8de3bbe 100644 (file)
@@ -83,6 +83,7 @@
 \bind "F5"                     "screen-recenter"
 \bind "M-F4"                   "lyx-quit"
 \bind "F7"                     "spellchecker"
+\bind "S-F7"                   "thesaurus-entry"
 
 \bind "M-x"                    "command-execute"
 
index c3397dada2c02cf3fe810e4d025973514f8f46f2..99eb3c82a2421961ff9f7e465b5ecfea8f29a224 100644 (file)
@@ -101,6 +101,7 @@ Menuset
        Separator
        #Item "Read Only" "buffer-toggle-read-only"
        Item "Spellchecker...|S" "spellchecker"
+       Item "Thesaurus" "thesaurus-entry"
        Item "Check TeX|h" "buffer-chktex"
        Item "Remove All Error Boxes|E" "error-remove-all"
        Separator
index 15d17461eb2f5d4fad616b0eadcc41d1013edc9b..0497eaf198862cd76ffd2db1403b347c3216e0f0 100644 (file)
@@ -9,7 +9,6 @@ src/converter.C
 src/CutAndPaste.C
 src/debug.C
 src/exporter.C
-src/ext_l10n.h
 src/figureForm.C
 src/figure_form.C
 src/FontLoader.C
@@ -106,6 +105,8 @@ src/frontends/xforms/FormTabular.C
 src/frontends/xforms/form_tabular.C
 src/frontends/xforms/FormTabularCreate.C
 src/frontends/xforms/form_tabular_create.C
+src/frontends/xforms/FormThesaurus.C
+src/frontends/xforms/form_thesaurus.C
 src/frontends/xforms/FormToc.C
 src/frontends/xforms/form_toc.C
 src/frontends/xforms/FormUrl.C
@@ -115,7 +116,6 @@ src/frontends/xforms/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
 src/frontends/xforms/xforms_helpers.C
 src/gettext.h
-src/graphics/GraphicsCacheItem.C
 src/importer.C
 src/insets/figinset.C
 src/insets/insetbib.C
index f52dd19560c789d99af6f29e0dbd92a000819267..814579da78c9f0dabf6f0ea169d207ebbad4de74 100644 (file)
@@ -3086,6 +3086,26 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        }
        break;
        
+       case LFUN_THESAURUS_ENTRY:
+       {
+               string arg = argument;
+
+               if (arg.empty()) {
+                       arg = bv_->getLyXText()->selectionAsString(buffer_);
+                       // FIXME
+                       if (arg.size() > 100 || arg.empty()) {
+                               // Get word or selection
+                               bv_->getLyXText()->selectWordWhenUnderCursor(bv_, LyXText::WHOLE_WORD);
+                               arg = bv_->getLyXText()->selectionAsString(buffer_);
+                               // FIXME: where is getLyXText()->unselect(bv_) ?
+                       }
+               }
+
+               bv_->owner()->getDialogs()->showThesaurus(arg);
+       }
+               break;
        case LFUN_SELFINSERT:
        {
                if (argument.empty()) break;
index ee55afb0415f2c4bb466c11f90506dfe7d77eca2..80188b60f83c31e0cb000481b2be77934aeef8ba 100644 (file)
        using interface colors for certain fonts in certain environments,
        which should not seen as that on the final output.
 
+2001-07-26  John Levon  <moz@compsoc.man.ac.uk>
+
+       * BufferView_pimpl.C:
+       * Thesaurus.h:
+       * Thesaurus.C:
+       * Makefile.am:
+       * commandtags.h:
+       * LyXAction.C: add thesaurus support
+
+       * lyxfind.h:
+       * lyxfind.C: add "once" parameter, for thesaurus, to not
+         move to the next match
+  
 2001-07-26  Juergen Vigna  <jug@sad.it>
 
        * lyxfont.C (realize): honor ignore_language too!
index 4aa64ccfa5eebcd48bd7cee789946af1eea8552f..db2af296891ba6f2e676ff2962db63da70c32b45 100644 (file)
@@ -384,6 +384,7 @@ void LyXAction::init()
 #if 0
                { LFUN_INSET_THEOREM, "theorem-insert", "", Noop },
 #endif
+               { LFUN_THESAURUS_ENTRY, "thesaurus-entry", N_("Open thesaurus"), ReadOnly },
                { LFUN_TOC_INSERT, "toc-insert",
                  N_("Insert table of contents"), Noop },
                { LFUN_TOCVIEW, "toc-view",
index 374e4c68255dcdd2e5270f388fe17f4dbd6d1acb..64b6772746b9f06356eae60f2166343be2f01d9e 100644 (file)
@@ -13,7 +13,7 @@ lyx_DEPENDENCIES = mathed/libmathed.la insets/libinsets.la \
        support/libsupport.la \
        @INCLUDED_SIGC@
 lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(LYX_LIBS) $(SIGC_LIBS) \
-       $(PSPELL_LIBS) @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@
+       $(PSPELL_LIBS) @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@ @AIKSAURUS_LIBS@
 #lyx_LDFLAGS=-Wl,-O1
 EXTRA_DIST = config.h.in stamp-h.in cheaders ext_l10n.h
 ETAGS_ARGS = --lang=c++
@@ -75,6 +75,8 @@ lyx_SOURCES = \
        Spacing.h \
        TextCache.C \
        TextCache.h \
+       Thesaurus.C \
+       Thesaurus.h \
        ToolbarDefaults.C \
        ToolbarDefaults.h \
        UpdateInset.C \
diff --git a/src/Thesaurus.C b/src/Thesaurus.C
new file mode 100644 (file)
index 0000000..8e30bf9
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ * \file Thesaurus.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon
+ */
+
+#include "Thesaurus.h"
+
+Thesaurus thesaurus; 
+
+#ifdef HAVE_LIBAIKSAURUS
+Thesaurus::ThesaurusEntry::ThesaurusEntry(string const & ent, char part)
+       : entry(ent), pos(Thesaurus::NONE)
+{
+       if (part & AikSaurus::Unknown) pos |= OTHER;
+       if (part & AikSaurus::Other) pos |= OTHER;
+       if (part & AikSaurus::Noun) pos |= NOUN;
+       if (part & AikSaurus::Verb) pos |= VERB;
+       if (part & AikSaurus::Adjective) pos |= ADJECTIVE;
+       if (part & AikSaurus::Adverb) pos |= ADVERB;
+}
+
+
+Thesaurus::Thesaurus()
+{
+       aik_ = new AikSaurus();
+}
+
+
+Thesaurus::~Thesaurus()
+{
+       delete aik_;
+}
+
+
+std::vector<Thesaurus::ThesaurusEntry> Thesaurus::lookup(string const & text)
+{
+       std::vector<ThesaurusEntry> entries;
+
+       if (!aik_->find(text.c_str()))
+               return entries;
+
+       char pos;
+       string ret;
+
+       ret = aik_->next(pos);
+       while (!ret.empty()) {
+               entries.push_back(ThesaurusEntry(ret, pos));
+               ret = aik_->next(pos);
+       }
+
+       return entries;
+}
+
+#else
+
+Thesaurus::ThesaurusEntry::ThesaurusEntry(string const &, char)
+{
+}
+
+Thesaurus::Thesaurus()
+{
+}
+Thesaurus::~Thesaurus()
+{
+}
+
+std::vector<Thesaurus::ThesaurusEntry> Thesaurus::lookup(string const & text)
+{
+       return std::vector<ThesaurusEntry>();
+}
+
+#endif // HAVE_LIBAIKSAURUS
diff --git a/src/Thesaurus.h b/src/Thesaurus.h
new file mode 100644 (file)
index 0000000..fc04d72
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * \file Thesaurus.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon
+ */
+
+#ifndef THESAURUS_H
+#define THESAURUS_H
+#include <vector>
+
+#include <config.h>
+#include "LString.h"
+#ifdef HAVE_LIBAIKSAURUS
+#include "AikSaurus.h"
+#endif
+/**
+ * This class provides an interface to whatever thesauri we might support.
+ */
+
+class Thesaurus {
+public:
+       ///
+       Thesaurus();
+       ///
+       ~Thesaurus();
+
+       /**
+        * enum of possible part of speech types
+        */
+       enum POS {
+               NONE = 0x0,
+               OTHER = 0x01,
+               NOUN = 0x02,
+               VERB = 0x04,
+               ADJECTIVE = 0x08,
+               ADVERB = 0x10
+       };
+
+       /**
+        * an individual entry from the thesaurus 
+        */
+       struct ThesaurusEntry {
+               /// 
+               ThesaurusEntry(const string & ent, char pos); 
+               /// the actual entry 
+               string entry;
+               /// entry's part of speech
+               int pos;
+       };
+
+       /**
+        * look up some text in the thesaurus
+        */
+       std::vector<ThesaurusEntry> lookup(string const & text);
+
+private:
+#ifdef HAVE_LIBAIKSAURUS
+       AikSaurus * aik_;
+#endif
+};
+extern Thesaurus thesaurus;
+#endif
index 44fd580daa5d81d87898f085f553d06a3ee596a2..b30196a406c0e2a2ff3cea55ff54411ae56b91b1 100644 (file)
@@ -305,6 +305,7 @@ enum kb_action {
        LFUN_TRANSPOSE_CHARS,           // Lgb 20010425
        LFUN_ESCAPE, // 260             // Lgb 20010517
        LFUN_HELP_ABOUTLYX,             // Edwin 20010712
+       LFUN_THESAURUS_ENTRY,           // Levon 20010720
        LFUN_LASTACTION  /* this marks the end of the table */
 };
 
index 37731740cf1a79a777eec2ad4e507924cca304fe..60c835ebad5f3be5c8cdf4f6ad4366b85417f874 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-24  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Dialogs.h: add showThesaurus
 2001-07-13  Edwin Leuven  <leuven@fee.uva.nl>
        
        * Dialogs.h: add showAboutlyx and remove showCredits and Copyright
index 39578b22d0a35d95e3882f5c940e7164c8ac5ab3..c9210e97d71af00e5c1ac07729cb80cf43fee59c 100644 (file)
@@ -153,6 +153,8 @@ public:
        SigC::Signal1<void, InsetTabular *> updateTabular;
        ///
        SigC::Signal0<void> showTabularCreate;
+       /// show the thesaurus dialog
+       SigC::Signal1<void, string const &> showThesaurus; 
        ///
        SigC::Signal1<void, InsetCommand *> showTOC;
        ///
index e0b35b4227de1c2c2026da24bbf243ca6857e5c2..736aa2af66f4adadcc4ca185eaa263e7ed8e33d5 100644 (file)
@@ -3,6 +3,13 @@
        * ControlGraphics.C: changed file search string to cover eps, jpeg, gif
        and png.
 
+2001-07-26  John Levon  <moz@compsoc.man.ac.uk>
+
+       * ControlThesaurus.h:
+       * ControlThesaurus.C:
+       * GUI.h:
+       * Makefile.am: thesaurus support
+
 2001-07-23  John Levon  <moz@compsoc.man.ac.uk>
 
        * ControlInclude.h:
diff --git a/src/frontends/controllers/ControlThesaurus.C b/src/frontends/controllers/ControlThesaurus.C
new file mode 100644 (file)
index 0000000..03f82ed
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * \file ControlThesaurus.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "ViewBase.h"
+#include "ButtonControllerBase.h"
+#include "ControlThesaurus.h"
+#include "Dialogs.h"
+#include "Liason.h"
+#include "LyXView.h"
+#include "lyxfind.h"
+#include "buffer.h"
+#include "debug.h"
+#include "gettext.h"
+#include "BufferView.h"
+
+using Liason::setMinibuffer;
+using SigC::slot;
+
+ControlThesaurus::ControlThesaurus(LyXView & lv, Dialogs & d)
+       : ControlDialog<ControlConnectBD>(lv, d)
+{
+       d_.showThesaurus.connect(SigC::slot(this, &ControlThesaurus::showEntry));
+}
+
+
+void ControlThesaurus::showEntry(string const & entry)
+{
+       oldstr_ = entry;
+       show();
+}
+
+
+void ControlThesaurus::replace(string const & newstr)
+{
+       /* FIXME: this is not suitable ! We need to have a "lock"
+        * on a particular charpos in a paragraph that is broken on
+        * deletion/change !
+        */
+       int const replace_count = LyXReplace(lv_.view(), oldstr_, newstr,
+                                       true, true, true, false, true);
+
+       oldstr_ = newstr;
+
+       if (replace_count == 0)
+               setMinibuffer(&lv_, _("String not found!"));
+       else
+               setMinibuffer(&lv_, _("String has been replaced."));
+}
+
+
+std::vector<string> ControlThesaurus::getEntries(string const & str, Thesaurus::POS pos)
+{
+       if (str != laststr_)
+               entries_ = thesaurus.lookup(str);
+
+       laststr_ = str;
+
+       std::vector<string> strs;
+
+       for (std::vector<Thesaurus::ThesaurusEntry>::const_iterator it = entries_.begin();
+               it != entries_.end(); ++it) {
+               if (it->pos & pos)
+                       strs.push_back(it->entry);
+       }
+
+       return strs;
+}
diff --git a/src/frontends/controllers/ControlThesaurus.h b/src/frontends/controllers/ControlThesaurus.h
new file mode 100644 (file)
index 0000000..737f8dd
--- /dev/null
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+/**
+ * \file ControlThesaurus.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon
+ */
+
+
+#ifndef CONTROLTHESAURUS_H
+#define CONTROLTHESAURUS_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <vector>
+#include <config.h>
+
+#include "LString.h"
+#include "Thesaurus.h"
+#include "ControlDialogs.h"
+
+/** A controller for Thesaurus dialogs.
+ */
+class ControlThesaurus : public ControlDialog<ControlConnectBD> {
+public:
+       ///
+       ControlThesaurus(LyXView &, Dialogs &);
+       /// replace the particular string
+       void replace(string const & newstr);
+
+       /// show dialog
+       virtual void showEntry(string const & str);
+
+       /// get noun entries
+       std::vector<string> getNouns(string const & str) {
+               return getEntries(str, Thesaurus::NOUN);
+       }
+       /// get verb entries
+       std::vector<string> getVerbs(string const & str) {
+               return getEntries(str, Thesaurus::VERB);
+       }
+       /// get adjective entries
+       std::vector<string> getAdjectives(string const & str) {
+               return getEntries(str, Thesaurus::ADJECTIVE);
+       }
+       /// get adverb entries
+       std::vector<string> getAdverbs(string const & str) {
+               return getEntries(str, Thesaurus::ADVERB);
+       }
+       /// get other entries
+       std::vector<string> getOthers(string const & str) {
+               return getEntries(str, Thesaurus::OTHER);
+       }
+
+       /// the text
+       string const & text() {
+               return oldstr_;
+       }
+
+private:
+       /// get entries for a str
+       std::vector<string> getEntries(string const & str, Thesaurus::POS pos);
+
+       /// last string looked up
+       string laststr_;
+
+       /// entries for last string
+       std::vector<Thesaurus::ThesaurusEntry> entries_;
+
+       /// original string
+       string oldstr_;
+
+       /// not needed.
+       virtual void apply() {}
+};
+
+#endif // CONTROLTHESAURUS_H
index 14eb9755dcc0110df449e47acf41ee336047bf85..86518f6500b0a35ccc6e1937fe7f97bfaf1abfee 100644 (file)
@@ -321,6 +321,22 @@ public:
 };
 
 
+/** Specialization for TabularCreate dialog
+ */
+class ControlThesaurus;
+
+template <class GUIview, class GUIbc>
+class GUIThesaurus :
+       public GUI<ControlThesaurus, GUIview,
+                   OkApplyCancelReadOnlyPolicy, GUIbc> {
+public:
+       ///
+       GUIThesaurus(LyXView & lv, Dialogs & d)
+               : GUI<ControlThesaurus, GUIview,
+                     OkApplyCancelReadOnlyPolicy, GUIbc>(lv, d) {}
+};
+
 /** Specialization for Url dialog
  */
 class ControlUrl;
index f3454699538429dcd5d12bee053d2ebfefa4a73f..6034922d9c5be4181304e3cebc393bf09c7ac9d1 100644 (file)
@@ -65,6 +65,8 @@ libcontrollers_la_SOURCES=\
        ControlSplash.h \
        ControlTabularCreate.C \
        ControlTabularCreate.h \
+       ControlThesaurus.C \
+       ControlThesaurus.h \
        ControlToc.C \
        ControlToc.h \
        ControlUrl.C \
index 07f90d30c0eeabc9a2017d719c84073393d051ad..19e2f9ab326b93fb15d63b3769a1ff713915154d 100644 (file)
        only floating point numbers.
        (input): Browse now activates the Ok button approriately.
 
+2001-07-26  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Dialogs.C:
+       * Makefile.am: 
+       * FormThesaurus.h:
+       * FormThesaurus.C:
+       * form_thesaurus.h:
+       * form_thesaurus.C:
+       * forms/makefile:
+       * forms/form_thesaurus.fd: add thesaurus
 2001-07-26  Baruch Even  <baruch@lyx.org>
 
        * FormGraphics.h:
index eb03517a858987d25fa8c6a31f16bad0e101c100..de101ef053d01346114915285c05294173678ed3 100644 (file)
@@ -39,6 +39,7 @@
 #include "ControlSpellchecker.h"
 #include "ControlSplash.h"
 #include "ControlTabularCreate.h"
+#include "ControlThesaurus.h"
 #include "ControlToc.h"
 #include "ControlUrl.h"
 #include "ControlVCLog.h"
@@ -65,6 +66,7 @@
 #include "form_spellchecker.h"
 #include "form_splash.h"
 #include "form_tabular_create.h"
+#include "form_thesaurus.h"
 #include "form_toc.h"
 #include "form_url.h"
 
@@ -87,6 +89,7 @@
 #include "FormSpellchecker.h"
 #include "FormSplash.h"
 #include "FormTabularCreate.h"
+#include "FormThesaurus.h" 
 #include "FormToc.h"
 #include "FormUrl.h"
 #include "FormVCLog.h"
@@ -123,6 +126,9 @@ Dialogs::Dialogs(LyXView * lv)
        add(new GUISearch<FormSearch, xformsBC>(*lv, *this));
        add(new GUISpellchecker<FormSpellchecker, xformsBC>(*lv, *this));
        add(new GUITabularCreate<FormTabularCreate, xformsBC>(*lv, *this));
+#ifdef HAVE_LIBAIKSAURUS
+       add(new GUIThesaurus<FormThesaurus, xformsBC>(*lv, *this));
+#endif
        add(new GUIToc<FormToc, xformsBC>(*lv, *this));
        add(new GUIUrl<FormUrl, xformsBC>(*lv, *this));
        add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
diff --git a/src/frontends/xforms/FormThesaurus.C b/src/frontends/xforms/FormThesaurus.C
new file mode 100644 (file)
index 0000000..31d2ed9
--- /dev/null
@@ -0,0 +1,215 @@
+/**
+ * \file FormThesaurus.C
+ * Copyright 2001 The LyX Team.
+ * See the file COPYING.
+ *
+ * \author Edwin Leuven
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#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 "debug.h"
+
+typedef FormCB<ControlThesaurus, FormDB<FD_form_tabbed_thesaurus> > base_class;
+
+FormThesaurus::FormThesaurus(ControlThesaurus & c)
+       : base_class(c, _("LyX: Thesaurus")),
+       clickline_(-1)
+{
+}
+
+
+void FormThesaurus::build()
+{
+       dialog_.reset(build_tabbed_thesaurus());
+       noun_.reset(build_noun());
+       verb_.reset(build_verb());
+       adjective_.reset(build_adjective());
+       adverb_.reset(build_adverb());
+       other_.reset(build_other());
+
+       fl_set_form_maxsize(dialog_->form, minw_, minh_);
+
+       // Manage the ok, apply and cancel/close buttons
+       bc().setCancel(dialog_->button_close);
+       bc().addReadOnly(dialog_->input_replace);
+
+       fl_set_input_return(dialog_->input_entry, FL_RETURN_END_CHANGED);
+
+       fl_addto_tabfolder(dialog_->tabbed_folder, _("Nouns"), noun_->form);
+       fl_addto_tabfolder(dialog_->tabbed_folder, _("Verbs"), verb_->form);
+       fl_addto_tabfolder(dialog_->tabbed_folder, _("Adjectives"), adjective_->form);
+       fl_addto_tabfolder(dialog_->tabbed_folder, _("Adverbs"), adverb_->form);
+       fl_addto_tabfolder(dialog_->tabbed_folder, _("Other"), other_->form);
+}
+
+
+void FormThesaurus::redraw()
+{
+       if (form() && form()->visible)
+               fl_redraw_form(form());
+       else
+               return;
+
+       FL_FORM * form = fl_get_active_folder(dialog_->tabbed_folder);
+       if (form && form->visible)
+               fl_redraw_form(form);
+}
+
+
+void FormThesaurus::update()
+{
+       if (!dialog_.get())
+               return;
+
+       string const & str_ = controller().text();
+       setEnabled(dialog_->button_replace, !str_.empty());
+       fl_set_input(dialog_->input_replace, "");
+       updateEntries(str_);
+}
+
+
+void FormThesaurus::updateEntries(string const & str)
+{
+       fl_set_input(dialog_->input_entry, str.c_str());
+
+       fl_clear_browser(noun_->browser_noun);
+       fl_clear_browser(verb_->browser_verb);
+       fl_clear_browser(adjective_->browser_adjective);
+       fl_clear_browser(adverb_->browser_adverb);
+       fl_clear_browser(other_->browser_other);
+
+       fl_set_browser_topline(noun_->browser_noun, 1);
+       fl_set_browser_topline(verb_->browser_verb, 1);
+       fl_set_browser_topline(adjective_->browser_adjective, 1);
+       fl_set_browser_topline(adverb_->browser_adverb, 1);
+       fl_set_browser_topline(other_->browser_other, 1);
+
+       fl_freeze_form(noun_->form);
+       fl_freeze_form(verb_->form);
+       fl_freeze_form(adverb_->form);
+       fl_freeze_form(adjective_->form);
+       fl_freeze_form(other_->form);
+
+       std::vector<string> nouns = controller().getNouns(str);
+       for (std::vector<string>::const_iterator it = nouns.begin(); it != nouns.end(); ++it)
+               fl_add_browser_line(noun_->browser_noun, it->c_str());
+
+       std::vector<string> verbs = controller().getVerbs(str);
+       for (std::vector<string>::const_iterator it = verbs.begin(); it != verbs.end(); ++it)
+               fl_add_browser_line(verb_->browser_verb, it->c_str());
+
+       std::vector<string> adjectives = controller().getAdjectives(str);
+       for (std::vector<string>::const_iterator it = adjectives.begin(); it != adjectives.end(); ++it)
+               fl_add_browser_line(adjective_->browser_adjective, it->c_str());
+
+       std::vector<string> adverbs = controller().getAdverbs(str);
+       for (std::vector<string>::const_iterator it = adverbs.begin(); it != adverbs.end(); ++it)
+               fl_add_browser_line(adverb_->browser_adverb, it->c_str());
+
+       std::vector<string> others = controller().getOthers(str);
+       for (std::vector<string>::const_iterator it = others.begin(); it != others.end(); ++it)
+               fl_add_browser_line(other_->browser_other, it->c_str());
+
+       fl_unfreeze_form(noun_->form);
+       fl_unfreeze_form(verb_->form);
+       fl_unfreeze_form(adverb_->form);
+       fl_unfreeze_form(adjective_->form);
+       fl_unfreeze_form(other_->form);
+       fl_redraw_form(noun_->form);
+       fl_redraw_form(verb_->form);
+       fl_redraw_form(adverb_->form);
+       fl_redraw_form(adjective_->form);
+       fl_redraw_form(other_->form);
+}
+
+
+void FormThesaurus::setReplace(string const & templ, string const & nstr)
+{
+       string str(nstr);
+
+       // the following mechanism makes sure we replace "House" with "Home",
+       // "HOUSE" with "HOME" etc.
+
+       bool all_lower = true;
+       bool all_upper = true;
+
+       for (string::const_iterator it = templ.begin(); it != templ.end(); ++it) {
+               if (isupper(*it))
+                       all_lower = false;
+               if (islower(*it))
+                       all_upper = false;
+       }
+
+       if (all_lower) {
+               str = lowercase(nstr);
+       } else if (all_upper) {
+               str = uppercase(nstr);
+       } else if (templ.size() > 0 && isupper(templ[0])) {
+               bool rest_lower = true;
+               for (string::const_iterator it = templ.begin() + 1;
+                       it != templ.end(); ++it) {
+                       if (isupper(*it))
+                               rest_lower = false;
+               }
+               
+               if (rest_lower) {
+                       str = lowercase(nstr);
+                       str[0] = uppercase(nstr[0]);
+               }
+       }
+
+       fl_set_input(dialog_->input_replace, str.c_str());
+}
+
+
+ButtonPolicy::SMInput FormThesaurus::input(FL_OBJECT * obj, long)
+{
+       FL_OBJECT * browser = 0;
+
+       if (obj == dialog_->input_entry) {
+               updateEntries(fl_get_input(dialog_->input_entry));
+               if (string(fl_get_input(dialog_->input_entry)).empty()) {
+                       fl_set_input(dialog_->input_replace, "");
+                       return ButtonPolicy::SMI_APPLY;
+               }
+       } else if (obj == dialog_->button_replace) {
+               string rep(fl_get_input(dialog_->input_replace));
+               if (!rep.empty())
+                       controller().replace(fl_get_input(dialog_->input_replace));
+               clickline_ = -1;
+               updateEntries(rep);
+               return ButtonPolicy::SMI_APPLY;
+       } else if (obj == noun_->browser_noun ||
+                  obj == verb_->browser_verb ||
+                  obj == adjective_->browser_adjective ||
+                  obj == adverb_->browser_adverb ||
+                  obj == other_->browser_other) {
+               browser = obj;
+       }
+
+       if (browser) {
+               setReplace(fl_get_input(dialog_->input_entry),
+                       fl_get_browser_line(browser, fl_get_browser(browser)));
+
+               if (clickline_ == fl_get_browser(browser)) {
+                       updateEntries(fl_get_input(dialog_->input_replace));
+                       clickline_ = -1;
+               } else {
+                       clickline_ = fl_get_browser(browser);
+               }
+       }
+
+       return ButtonPolicy::SMI_VALID;
+}
diff --git a/src/frontends/xforms/FormThesaurus.h b/src/frontends/xforms/FormThesaurus.h
new file mode 100644 (file)
index 0000000..897c667
--- /dev/null
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+/**
+ * \file FormThesaurus.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon
+ */
+
+#ifndef FORMTHESAURUS_H
+#define FORMTHESAURUS_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "FormBase.h"
+
+class ControlThesaurus;
+struct FD_form_tabbed_thesaurus;
+struct FD_form_noun;
+struct FD_form_verb;
+struct FD_form_adjective;
+struct FD_form_adverb;
+struct FD_form_other;
+
+/** This class provides an XForms implementation of the Thesaurus dialog.
+ */
+class FormThesaurus : public FormCB<ControlThesaurus, FormDB<FD_form_tabbed_thesaurus> > {
+public:
+       ///
+       FormThesaurus(ControlThesaurus &);
+private:
+       /// not needed.
+       virtual void apply() {}
+       /// Build the dialog
+       virtual void build();
+       /// update dialog
+       virtual void update();
+       /// redraw
+       virtual void redraw();
+
+       /// set the replace word properly
+       void setReplace(const string & templ, const string & nstr);
+
+       /// update browser entries
+       void updateEntries(const string & str);
+
+       /// Filter the inputs
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
+       /// Fdesign generated methods
+       FD_form_tabbed_thesaurus  * build_tabbed_thesaurus();
+       FD_form_noun * build_noun();
+       FD_form_verb * build_verb();
+       FD_form_adjective * build_adjective();
+       FD_form_adverb * build_adverb();
+       FD_form_other * build_other();
+
+       /// Real GUI implementations of sub-forms
+       boost::scoped_ptr<FD_form_noun> noun_;
+       boost::scoped_ptr<FD_form_verb> verb_;
+       boost::scoped_ptr<FD_form_adjective> adjective_;
+       boost::scoped_ptr<FD_form_adverb> adverb_;
+       boost::scoped_ptr<FD_form_other> other_;
+
+       /// for double click handling
+       int clickline_;
+
+       /// current string
+       string str_;
+};
+
+#endif // FORMTHESAURUS_H
index 8d6f6ecca79c0b1136dea245aa1c5979189be98a..e4e152d66b7501f1017cbc6c2e687cc9d245d06d 100644 (file)
@@ -148,6 +148,10 @@ libxforms_la_SOURCES = \
        FormTabularCreate.h \
        form_tabular_create.C \
        form_tabular_create.h \
+       FormThesaurus.C \
+       FormThesaurus.h \
+       form_thesaurus.C \
+       form_thesaurus.h \
        FormToc.C \
        FormToc.h \
        form_toc.C \
diff --git a/src/frontends/xforms/form_thesaurus.C b/src/frontends/xforms/form_thesaurus.C
new file mode 100644 (file)
index 0000000..3713917
--- /dev/null
@@ -0,0 +1,195 @@
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+#include <config.h>
+#include "lyx_gui_misc.h"
+#include "gettext.h"
+
+/* Form definition file generated with fdesign. */
+
+#include FORMS_H_LOCATION
+#include <stdlib.h>
+#include "form_thesaurus.h"
+#include "FormThesaurus.h"
+
+FD_form_tabbed_thesaurus::~FD_form_tabbed_thesaurus()
+{
+  if ( form->visible ) fl_hide_form( form );
+  fl_free_form( form );
+}
+
+
+FD_form_tabbed_thesaurus * FormThesaurus::build_tabbed_thesaurus()
+{
+  FL_OBJECT *obj;
+  FD_form_tabbed_thesaurus *fdui = new FD_form_tabbed_thesaurus;
+
+  fdui->form = fl_bgn_form(FL_NO_BOX, 465, 450);
+  fdui->form->u_vdata = this;
+  obj = fl_add_box(FL_UP_BOX, 0, 0, 465, 450, "");
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+  fdui->tabbed_folder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 15, 55, 440, 310, _("Tabbed folder"));
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+  {
+    char const * const dummy = N_("Replace|^R");
+    fdui->button_replace = obj = fl_add_button(FL_NORMAL_BUTTON, 355, 375, 100, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  {
+    char const * const dummy = N_("Close|^C");
+    fdui->button_close = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 410, 100, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+    fl_set_object_callback(obj, C_FormBaseOKCB, 0);
+  fdui->input_entry = obj = fl_add_input(FL_NORMAL_INPUT, 60, 10, 315, 25, _("Entry : "));
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fdui->input_replace = obj = fl_add_input(FL_NORMAL_INPUT, 75, 375, 260, 30, _("Selection :"));
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fl_end_form();
+
+  fdui->form->fdui = fdui;
+
+  return fdui;
+}
+/*---------------------------------------*/
+
+FD_form_noun::~FD_form_noun()
+{
+  if ( form->visible ) fl_hide_form( form );
+  fl_free_form( form );
+}
+
+
+FD_form_noun * FormThesaurus::build_noun()
+{
+  FL_OBJECT *obj;
+  FD_form_noun *fdui = new FD_form_noun;
+
+  fdui->form = fl_bgn_form(FL_NO_BOX, 440, 290);
+  fdui->form->u_vdata = this;
+  obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 290, "");
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+  fdui->browser_noun = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, 440, 290, "");
+    fl_set_object_resize(obj, FL_RESIZE_NONE);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fl_end_form();
+
+  fdui->form->fdui = fdui;
+
+  return fdui;
+}
+/*---------------------------------------*/
+
+FD_form_verb::~FD_form_verb()
+{
+  if ( form->visible ) fl_hide_form( form );
+  fl_free_form( form );
+}
+
+
+FD_form_verb * FormThesaurus::build_verb()
+{
+  FL_OBJECT *obj;
+  FD_form_verb *fdui = new FD_form_verb;
+
+  fdui->form = fl_bgn_form(FL_NO_BOX, 440, 290);
+  fdui->form->u_vdata = this;
+  obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 290, "");
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+  fdui->browser_verb = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, 440, 290, "");
+    fl_set_object_resize(obj, FL_RESIZE_NONE);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fl_end_form();
+
+  fdui->form->fdui = fdui;
+
+  return fdui;
+}
+/*---------------------------------------*/
+
+FD_form_adjective::~FD_form_adjective()
+{
+  if ( form->visible ) fl_hide_form( form );
+  fl_free_form( form );
+}
+
+
+FD_form_adjective * FormThesaurus::build_adjective()
+{
+  FL_OBJECT *obj;
+  FD_form_adjective *fdui = new FD_form_adjective;
+
+  fdui->form = fl_bgn_form(FL_NO_BOX, 440, 290);
+  fdui->form->u_vdata = this;
+  obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 290, "");
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+  fdui->browser_adjective = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, 440, 290, "");
+    fl_set_object_resize(obj, FL_RESIZE_NONE);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fl_end_form();
+
+  fdui->form->fdui = fdui;
+
+  return fdui;
+}
+/*---------------------------------------*/
+
+FD_form_adverb::~FD_form_adverb()
+{
+  if ( form->visible ) fl_hide_form( form );
+  fl_free_form( form );
+}
+
+
+FD_form_adverb * FormThesaurus::build_adverb()
+{
+  FL_OBJECT *obj;
+  FD_form_adverb *fdui = new FD_form_adverb;
+
+  fdui->form = fl_bgn_form(FL_NO_BOX, 440, 290);
+  fdui->form->u_vdata = this;
+  obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 290, "");
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+  fdui->browser_adverb = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, 440, 290, "");
+    fl_set_object_resize(obj, FL_RESIZE_NONE);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fl_end_form();
+
+  fdui->form->fdui = fdui;
+
+  return fdui;
+}
+/*---------------------------------------*/
+
+FD_form_other::~FD_form_other()
+{
+  if ( form->visible ) fl_hide_form( form );
+  fl_free_form( form );
+}
+
+
+FD_form_other * FormThesaurus::build_other()
+{
+  FL_OBJECT *obj;
+  FD_form_other *fdui = new FD_form_other;
+
+  fdui->form = fl_bgn_form(FL_NO_BOX, 440, 290);
+  fdui->form->u_vdata = this;
+  obj = fl_add_box(FL_FLAT_BOX, 0, 0, 440, 290, "");
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthWest);
+  fdui->browser_other = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, 440, 290, "");
+    fl_set_object_resize(obj, FL_RESIZE_NONE);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fl_end_form();
+
+  fdui->form->fdui = fdui;
+
+  return fdui;
+}
+/*---------------------------------------*/
+
diff --git a/src/frontends/xforms/form_thesaurus.h b/src/frontends/xforms/form_thesaurus.h
new file mode 100644 (file)
index 0000000..45d109b
--- /dev/null
@@ -0,0 +1,64 @@
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+/** Header file generated with fdesign **/
+
+#ifndef FD_form_tabbed_thesaurus_h_
+#define FD_form_tabbed_thesaurus_h_
+
+/** Callbacks, globals and object handlers **/
+extern  "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseOKCB(FL_OBJECT *, long);
+
+extern  "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+
+extern  "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+
+extern  "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+
+extern  "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+
+extern  "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+
+
+/**** Forms and Objects ****/
+struct FD_form_tabbed_thesaurus {
+       ~FD_form_tabbed_thesaurus();
+
+       FL_FORM *form;
+       FL_OBJECT *tabbed_folder;
+       FL_OBJECT *button_replace;
+       FL_OBJECT *button_close;
+       FL_OBJECT *input_entry;
+       FL_OBJECT *input_replace;
+};
+struct FD_form_noun {
+       ~FD_form_noun();
+
+       FL_FORM *form;
+       FL_OBJECT *browser_noun;
+};
+struct FD_form_verb {
+       ~FD_form_verb();
+
+       FL_FORM *form;
+       FL_OBJECT *browser_verb;
+};
+struct FD_form_adjective {
+       ~FD_form_adjective();
+
+       FL_FORM *form;
+       FL_OBJECT *browser_adjective;
+};
+struct FD_form_adverb {
+       ~FD_form_adverb();
+
+       FL_FORM *form;
+       FL_OBJECT *browser_adverb;
+};
+struct FD_form_other {
+       ~FD_form_other();
+
+       FL_FORM *form;
+       FL_OBJECT *browser_other;
+};
+
+#endif /* FD_form_tabbed_thesaurus_h_ */
diff --git a/src/frontends/xforms/forms/form_thesaurus.fd b/src/frontends/xforms/forms/form_thesaurus.fd
new file mode 100644 (file)
index 0000000..ff3eb65
--- /dev/null
@@ -0,0 +1,335 @@
+Magic: 13000
+
+Internal Form Definition File
+    (do not change)
+
+Number of forms: 6
+Unit of measure: FL_COORD_PIXEL
+SnapGrid: 5
+
+=============== FORM ===============
+Name: form_tabbed_thesaurus
+Width: 465
+Height: 450
+Number of Objects: 6
+
+--------------------
+class: FL_BOX
+type: UP_BOX
+box: 0 0 465 450
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_TABFOLDER
+type: TOP_TABFOLDER
+box: 15 55 440 310
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Tabbed folder
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_NorthWest FL_NorthWest
+name: tabbed_folder
+callback: 
+argument: 
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 355 375 100 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Replace|^R
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: button_replace
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 180 410 100 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Close|^C
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: button_close
+callback: C_FormBaseOKCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 60 10 315 25
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Entry : 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: input_entry
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 75 375 260 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Selection :
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: input_replace
+callback: C_FormBaseInputCB
+argument: 0
+
+=============== FORM ===============
+Name: form_noun
+Width: 440
+Height: 290
+Number of Objects: 2
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 440 290
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_BROWSER
+type: HOLD_BROWSER
+box: 0 0 440 290
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_BOTTOM
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name: browser_noun
+callback: C_FormBaseInputCB
+argument: 0
+
+=============== FORM ===============
+Name: form_verb
+Width: 440
+Height: 290
+Number of Objects: 2
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 440 290
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_BROWSER
+type: HOLD_BROWSER
+box: 0 0 440 290
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_BOTTOM
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name: browser_verb
+callback: C_FormBaseInputCB
+argument: 0
+
+=============== FORM ===============
+Name: form_adjective
+Width: 440
+Height: 290
+Number of Objects: 2
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 440 290
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_BROWSER
+type: HOLD_BROWSER
+box: 0 0 440 290
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_BOTTOM
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name: browser_adjective
+callback: C_FormBaseInputCB
+argument: 0
+
+=============== FORM ===============
+Name: form_adverb
+Width: 440
+Height: 290
+Number of Objects: 2
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 440 290
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_BROWSER
+type: HOLD_BROWSER
+box: 0 0 440 290
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_BOTTOM
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name: browser_adverb
+callback: C_FormBaseInputCB
+argument: 0
+
+=============== FORM ===============
+Name: form_other
+Width: 440
+Height: 290
+Number of Objects: 2
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 440 290
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthWest
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_BROWSER
+type: HOLD_BROWSER
+box: 0 0 440 290
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_BOTTOM
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_NoGravity FL_NoGravity
+name: browser_other
+callback: C_FormBaseInputCB
+argument: 0
+
+==============================
+create_the_forms
index 18e3826be5c1651d7b14775c84f6d343132c872a..d048c49c52aa132fc02a3ff7abc3a61f69959b30 100644 (file)
@@ -47,6 +47,7 @@ SRCS =  form_aboutlyx.fd \
        form_splash.fd \
        form_tabular.fd \
        form_tabular_create.fd \
+       form_thesaurus.fd \
        form_toc.fd \
        form_url.fd
 
index 4feec5b0484182f1ccbc3050b813b69276848f9f..4f82ef9e1f733c72e4b01c95a8c4da44de07893c 100644 (file)
 #include "buffer.h"
 #include "gettext.h"
 
-// declare local prototypes here so they cannot be used without hack
-// externally and also we won't see them in the lyxfind.h file so we
-// know this are internal files!
-
-
 ///
 // locally used enum
 ///
@@ -47,8 +42,8 @@ SearchResult SearchBackward(BufferView *, LyXText * text, string const & str,
 
 int LyXReplace(BufferView * bv,
                string const & searchstr, string const & replacestr,
-               bool const & forward, bool const & casesens,
-               bool const & matchwrd, bool const & replaceall)
+               bool forward, bool casesens, bool matchwrd, bool replaceall,
+              bool once)
 {
        if (!bv->available() || bv->buffer()->isReadonly()) 
                return 0;
@@ -99,8 +94,9 @@ int LyXReplace(BufferView * bv,
                bv->getLyXText()->setSelectionOverString(bv, replacestr);
                bv->update(bv->getLyXText(), BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
                ++replace_count;
-               found = LyXFind(bv, searchstr, fw, false, casesens, matchwrd);
-       } while (replaceall && found);
+               if (!once)
+                 found = LyXFind(bv, searchstr, fw, false, casesens, matchwrd);
+       } while (!once && replaceall && found);
    
        if (bv->focus())
                bv->showCursor();
@@ -109,9 +105,8 @@ int LyXReplace(BufferView * bv,
 }
 
 bool LyXFind(BufferView * bv,
-             string const & searchstr, bool const & forward,
-                        bool const & frominset,
-             bool const & casesens, bool const & matchwrd)
+             string const & searchstr, bool forward,
+            bool frominset, bool casesens, bool matchwrd)
 {
        if (!bv->available() || searchstr.empty())
                return false;
index 4bbae181ac9eeaf9ab13a25b3b34c429ac5058ba..7ea11b7f6f20f48574307638d42fd4c1c1f4d868 100644 (file)
 class BufferView;
 
 int LyXReplace(BufferView * bv, string const &, string const &,
-               bool const &, bool const & = true, bool const & = false,
-               bool const & = false);
+               bool, bool = true, bool = false,
+               bool = false, bool = false);
 
 bool LyXFind(BufferView *,
-             string const & searchstr, bool const & forward,
-                        bool const & frominset = false,
-             bool const & casesens = true, bool const & matchwrd = false);
+             string const & searchstr, bool forward,
+            bool frominset = false, bool casesens = true, 
+            bool matchwrd = false);
 
 #endif