+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.
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:
- babel can be disabled when using the default language.
+- a thesaurus facility (English only)
What's new in LyX version 1.1.6?
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)
+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'
\bind "F5" "screen-recenter"
\bind "M-F4" "lyx-quit"
\bind "F7" "spellchecker"
+\bind "S-F7" "thesaurus-entry"
\bind "M-x" "command-execute"
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
src/CutAndPaste.C
src/debug.C
src/exporter.C
-src/ext_l10n.h
src/figureForm.C
src/figure_form.C
src/FontLoader.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
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
}
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;
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!
#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",
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++
Spacing.h \
TextCache.C \
TextCache.h \
+ Thesaurus.C \
+ Thesaurus.h \
ToolbarDefaults.C \
ToolbarDefaults.h \
UpdateInset.C \
--- /dev/null
+/**
+ * \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
--- /dev/null
+/**
+ * \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
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 */
};
+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
SigC::Signal1<void, InsetTabular *> updateTabular;
///
SigC::Signal0<void> showTabularCreate;
+ /// show the thesaurus dialog
+ SigC::Signal1<void, string const &> showThesaurus;
///
SigC::Signal1<void, InsetCommand *> showTOC;
///
* 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:
--- /dev/null
+/**
+ * \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;
+}
--- /dev/null
+// -*- 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
};
+/** 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;
ControlSplash.h \
ControlTabularCreate.C \
ControlTabularCreate.h \
+ ControlThesaurus.C \
+ ControlThesaurus.h \
ControlToc.C \
ControlToc.h \
ControlUrl.C \
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:
#include "ControlSpellchecker.h"
#include "ControlSplash.h"
#include "ControlTabularCreate.h"
+#include "ControlThesaurus.h"
#include "ControlToc.h"
#include "ControlUrl.h"
#include "ControlVCLog.h"
#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"
#include "FormSpellchecker.h"
#include "FormSplash.h"
#include "FormTabularCreate.h"
+#include "FormThesaurus.h"
#include "FormToc.h"
#include "FormUrl.h"
#include "FormVCLog.h"
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));
--- /dev/null
+/**
+ * \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;
+}
--- /dev/null
+// -*- 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
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 \
--- /dev/null
+// 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;
+}
+/*---------------------------------------*/
+
--- /dev/null
+// 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_ */
--- /dev/null
+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
form_splash.fd \
form_tabular.fd \
form_tabular_create.fd \
+ form_thesaurus.fd \
form_toc.fd \
form_url.fd
#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
///
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;
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();
}
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;
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