This updates the thesaurus code to Aiksaurus 0.14
It is an incompatible change, the library will have to be upgraded, so this needs to go in before 1.2.0pre1 I think The database is /much/ better in current Aiksaurus, btw. Maybe not ideal but good enough for most uses ! please apply regards john -- "They're all fools. Don't worry. Darwin may be slow, but he'll eventually get them." - Matthew Lammers
Index: ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/ChangeLog,v retrieving revision 1.809 diff -u -p -r1.809 ChangeLog --- ChangeLog 2002/01/09 09:36:31 1.809 +++ ChangeLog 2002/01/12 22:37:04 @@ -1,3 +1,7 @@ +2002-01-12 John Levon <[EMAIL PROTECTED]> + + * configure.in: change for Aiksaurus 0.14 + 2002-01-08 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * configure.in: remove test for -lpt on SCO. Hopefully it is not Index: configure.in =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/configure.in,v retrieving revision 1.85 diff -u -p -r1.85 configure.in --- configure.in 2002/01/09 09:36:32 1.85 +++ configure.in 2002/01/12 22:37:05 @@ -112,12 +112,12 @@ dnl -lc and -lm as args to the compiler AC_CHECK_LIB(m, sin) AC_CHECK_LIB(c, fopen) AC_ARG_WITH(aiksaurus, - [ --without-aiksaurus do not use the AikSaurus library], + [ --without-aiksaurus do not use the Aiksaurus library], [lyx_use_aiksaurus=$withval]) if test x$lyx_use_aiksaurus != xno; then -AC_CHECK_LIB(AikSaurus, main, +AC_CHECK_LIB(Aiksaurus, main, [AC_DEFINE(HAVE_LIBAIKSAURUS,,[Define this if you have the AikSaurus library]) - AIKSAURUS_LIBS="-lAikSaurus -lbz2" + AIKSAURUS_LIBS="-lAiksaurus -lbz2" ],,"-lbz2") fi AC_SUBST(AIKSAURUS_LIBS) Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.505 diff -u -p -r1.505 ChangeLog --- src/ChangeLog 2002/01/10 16:47:01 1.505 +++ src/ChangeLog 2002/01/12 22:37:31 @@ -1,3 +1,16 @@ +2002-01-12 John Levon <[EMAIL PROTECTED]> + + * Thesaurus.h: + * Thesaurus.C: update for Aiksaurus 0.14 + +2002-01-11 Angus Leeming <[EMAIL PROTECTED]> + + * minibuffer.[Ch] (append_char): new method to recieve input from the + drop-down completion browser. If a key was pressed, then recieve this + char and append it to the existing string. + (peek_event): modify the positioning data passed to the completion + browser so that it can be placed above the minibuffer rather than below. + 2002-01-10 Martin Vermeer <[EMAIL PROTECTED]> * commandtags.h: Index: src/Thesaurus.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Thesaurus.C,v retrieving revision 1.4 diff -u -p -r1.4 Thesaurus.C --- src/Thesaurus.C 2001/12/20 15:11:50 1.4 +++ src/Thesaurus.C 2002/01/12 22:37:33 @@ -10,31 +10,15 @@ #include "Thesaurus.h" +#include <algorithm> + 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; + aik_ = new Aiksaurus; } @@ -44,31 +28,46 @@ Thesaurus::~Thesaurus() } -std::vector<Thesaurus::ThesaurusEntry> Thesaurus::lookup(string const & text) +Thesaurus::Meanings Thesaurus::lookup(string const & text) { - std::vector<ThesaurusEntry> entries; + Meanings meanings; if (!aik_->find(text.c_str())) - return entries; + return meanings; - char pos; + // weird api, but ... + + int prev_meaning = -1; + int cur_meaning; + string meaning; - string ret = aik_->next(pos); + // correct, returns "" at the end + string ret = aik_->next(cur_meaning); + while (!ret.empty()) { - entries.push_back(ThesaurusEntry(ret, pos)); - ret = aik_->next(pos); + if (cur_meaning != prev_meaning) { + meaning = ret; + ret = aik_->next(cur_meaning); + prev_meaning = cur_meaning; + } else { + if (ret != text) { + meanings[meaning].push_back(ret); + } + } + + ret = aik_->next(cur_meaning); } - return entries; + for (Meanings::iterator it = meanings.begin(); + it != meanings.end(); ++it) { + std::sort(it->second.begin(), it->second.end()); + } + + return meanings; } #else -Thesaurus::ThesaurusEntry::ThesaurusEntry(string const &, char) -{ -} - - Thesaurus::Thesaurus() { } @@ -79,10 +78,9 @@ Thesaurus::~Thesaurus() } -std::vector<Thesaurus::ThesaurusEntry> -Thesaurus::lookup(string const & /*text*/) +Thesaurus::Meanings Thesaurus::lookup(string const &) { - return std::vector<ThesaurusEntry>(); + return Meanings(); } #endif // HAVE_LIBAIKSAURUS Index: src/Thesaurus.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Thesaurus.h,v retrieving revision 1.3 diff -u -p -r1.3 Thesaurus.h --- src/Thesaurus.h 2001/12/20 15:11:50 1.3 +++ src/Thesaurus.h 2002/01/12 22:37:33 @@ -11,10 +11,11 @@ #define THESAURUS_H #include <vector> +#include <map> #include "LString.h" #ifdef HAVE_LIBAIKSAURUS -#include "AikSaurus.h" +#include "Aiksaurus.h" #endif /** @@ -28,38 +29,16 @@ public: /// ~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; - }; - + typedef std::map<string, std::vector<string> > Meanings; + /** * look up some text in the thesaurus */ - std::vector<ThesaurusEntry> lookup(string const & text); + Meanings lookup(string const & text); private: #ifdef HAVE_LIBAIKSAURUS - AikSaurus * aik_; + Aiksaurus * aik_; #endif }; Index: src/frontends/controllers/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v retrieving revision 1.107 diff -u -p -r1.107 ChangeLog --- src/frontends/controllers/ChangeLog 2002/01/07 17:57:21 1.107 +++ src/frontends/controllers/ChangeLog 2002/01/12 22:37:40 @@ -1,3 +1,8 @@ +2002-01-12 John Levon <[EMAIL PROTECTED]> + + * ControlThesaurus.h: + * ControlThesaurus.C: update to Aiksaurus 0.14 + 2002-01-07 Angus Leeming <[EMAIL PROTECTED]> * ControlSpellchecker.C (clearParams): show the closing message Index: src/frontends/controllers/ControlThesaurus.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlThesaurus.C,v retrieving revision 1.2 diff -u -p -r1.2 ControlThesaurus.C --- src/frontends/controllers/ControlThesaurus.C 2001/08/02 18:46:52 1.2 +++ src/frontends/controllers/ControlThesaurus.C 2002/01/12 22:37:40 @@ -59,21 +59,10 @@ void ControlThesaurus::replace(string co } -std::vector<string> -ControlThesaurus::getEntries(string const & str, Thesaurus::POS pos) +Thesaurus::Meanings const & ControlThesaurus::getMeanings(string const & str) { if (str != laststr_) - entries_ = thesaurus.lookup(str); + meanings_ = 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; + return meanings_; } Index: src/frontends/controllers/ControlThesaurus.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlThesaurus.h,v retrieving revision 1.2 diff -u -p -r1.2 ControlThesaurus.h --- src/frontends/controllers/ControlThesaurus.h 2001/12/20 15:11:50 1.2 +++ src/frontends/controllers/ControlThesaurus.h 2002/01/12 22:37:40 @@ -34,41 +34,20 @@ public: /// 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); - } - + /// get meanings + Thesaurus::Meanings const & getMeanings(string const & str); + /// 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_; + Thesaurus::Meanings meanings_; /// original string string oldstr_; Index: src/frontends/xforms/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v retrieving revision 1.231 diff -u -p -r1.231 ChangeLog --- src/frontends/xforms/ChangeLog 2002/01/10 16:47:03 1.231 +++ src/frontends/xforms/ChangeLog 2002/01/12 22:37:46 @@ -1,3 +1,23 @@ +2002-01-12 John Levon <[EMAIL PROTECTED]> + + * FormThesaurus.h: + * FormThesaurus.C: + * form_thesaurus.h: + * form_thesaurus.C: + * forms/form_thesaurus.fd: update to Aiksaurus 0.14 + Index: src/frontends/xforms/FormThesaurus.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormThesaurus.C,v retrieving revision 1.2 diff -u -p -r1.2 FormThesaurus.C --- src/frontends/xforms/FormThesaurus.C 2001/08/28 13:48:40 1.2 +++ src/frontends/xforms/FormThesaurus.C 2002/01/12 22:37:50 @@ -21,7 +21,7 @@ #include "form_thesaurus.h" #include "debug.h" -typedef FormCB<ControlThesaurus, FormDB<FD_form_tabbed_thesaurus> > base_class; +typedef FormCB<ControlThesaurus, FormDB<FD_form_thesaurus> > base_class; FormThesaurus::FormThesaurus(ControlThesaurus & c) : base_class(c, _("LyX: Thesaurus"), false), @@ -32,37 +32,13 @@ FormThesaurus::FormThesaurus(ControlThes 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()); - + dialog_.reset(build_thesaurus()); + // 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); } @@ -74,62 +50,35 @@ void FormThesaurus::update() string const & str_ = controller().text(); setEnabled(dialog_->button_replace, !str_.empty()); fl_set_input(dialog_->input_replace, ""); - updateEntries(str_); + updateMeanings(str_); } -void FormThesaurus::updateEntries(string const & str) +void FormThesaurus::updateMeanings(string const & str) { + fl_clear_browser(dialog_->browser_meanings); + 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); + fl_set_browser_topline(dialog_->browser_meanings, 1); + + fl_freeze_form(form()); + + Thesaurus::Meanings meanings = controller().getMeanings(str); + + for (Thesaurus::Meanings::const_iterator cit = meanings.begin(); + cit != meanings.end(); ++cit) { + fl_add_browser_line(dialog_->browser_meanings, +cit->first.c_str()); + for (std::vector<string>::const_iterator cit2 = +cit->second.begin(); + cit2 != cit->second.end(); ++cit2) { + string ent = " "; + ent += *cit2; + fl_add_browser_line(dialog_->browser_meanings, +ent.c_str()); + } + } + + fl_unfreeze_form(form()); + fl_redraw_form(form()); } @@ -174,11 +123,12 @@ void FormThesaurus::setReplace(string co 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()) { + string s = strip(frontStrip(fl_get_input(dialog_->input_entry))); + + updateMeanings(s); + + if (s.empty()) { fl_set_input(dialog_->input_replace, ""); return ButtonPolicy::SMI_APPLY; } @@ -187,26 +137,20 @@ ButtonPolicy::SMInput FormThesaurus::inp if (!rep.empty()) controller().replace(fl_get_input(dialog_->input_replace)); clickline_ = -1; - updateEntries(rep); + updateMeanings(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; + } else if (obj != dialog_->browser_meanings) { + return ButtonPolicy::SMI_NOOP; } - 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); - } + setReplace(fl_get_input(dialog_->input_entry), + strip(frontStrip(fl_get_browser_line(obj, fl_get_browser(obj))))); + + if (clickline_ == fl_get_browser(obj)) { + updateMeanings(fl_get_input(dialog_->input_replace)); + clickline_ = -1; + } else { + clickline_ = fl_get_browser(obj); } return ButtonPolicy::SMI_VALID; Index: src/frontends/xforms/FormThesaurus.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormThesaurus.h,v retrieving revision 1.1 diff -u -p -r1.1 FormThesaurus.h --- src/frontends/xforms/FormThesaurus.h 2001/07/29 10:42:11 1.1 +++ src/frontends/xforms/FormThesaurus.h 2002/01/12 22:37:50 @@ -17,7 +17,7 @@ #include "FormBase.h" class ControlThesaurus; -struct FD_form_tabbed_thesaurus; +struct FD_form_thesaurus; struct FD_form_noun; struct FD_form_verb; struct FD_form_adjective; @@ -26,7 +26,7 @@ struct FD_form_other; /** This class provides an XForms implementation of the Thesaurus dialog. */ -class FormThesaurus : public FormCB<ControlThesaurus, FormDB<FD_form_tabbed_thesaurus> > { +class FormThesaurus : public FormCB<ControlThesaurus, FormDB<FD_form_thesaurus> > { public: /// FormThesaurus(ControlThesaurus &); @@ -38,33 +38,19 @@ private: virtual void build(); /// update dialog virtual void update(); - /// redraw - virtual void redraw(); + /// dialog build + FD_form_thesaurus * build_thesaurus(); + /// set the replace word properly void setReplace(const string & templ, const string & nstr); /// update browser entries - void updateEntries(const string & str); + void updateMeanings(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_; Index: src/frontends/xforms/form_thesaurus.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/form_thesaurus.C,v retrieving revision 1.2 diff -u -p -r1.2 form_thesaurus.C --- src/frontends/xforms/form_thesaurus.C 2001/11/26 10:19:54 1.2 +++ src/frontends/xforms/form_thesaurus.C 2002/01/12 22:37:53 @@ -10,24 +10,22 @@ #include "form_thesaurus.h" #include "FormThesaurus.h" -FD_form_tabbed_thesaurus::~FD_form_tabbed_thesaurus() +FD_form_thesaurus::~FD_form_thesaurus() { if ( form->visible ) fl_hide_form( form ); fl_free_form( form ); } -FD_form_tabbed_thesaurus * FormThesaurus::build_tabbed_thesaurus() +FD_form_thesaurus * FormThesaurus::build_thesaurus() { FL_OBJECT *obj; - FD_form_tabbed_thesaurus *fdui = new FD_form_tabbed_thesaurus; + FD_form_thesaurus *fdui = new FD_form_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))); @@ -49,141 +47,12 @@ FD_form_tabbed_thesaurus * FormThesaurus 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); + { + char const * const dummy = N_("Meanings|#M"); + fdui->browser_meanings = obj = fl_add_browser(FL_SELECT_BROWSER, 15, 50, 440, +305, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_end_form(); Index: src/frontends/xforms/form_thesaurus.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/form_thesaurus.h,v retrieving revision 1.1 diff -u -p -r1.1 form_thesaurus.h --- src/frontends/xforms/form_thesaurus.h 2001/07/29 10:42:11 1.1 +++ src/frontends/xforms/form_thesaurus.h 2002/01/12 22:37:53 @@ -1,64 +1,24 @@ // 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_ +#ifndef FD_form_thesaurus_h_ +#define FD_form_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(); +struct FD_form_thesaurus { + ~FD_form_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; + FL_OBJECT *browser_meanings; }; -#endif /* FD_form_tabbed_thesaurus_h_ */ +#endif /* FD_form_thesaurus_h_ */ Index: src/frontends/xforms/forms/form_thesaurus.fd =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_thesaurus.fd,v retrieving revision 1.1 diff -u -p -r1.1 form_thesaurus.fd --- src/frontends/xforms/forms/form_thesaurus.fd 2001/07/29 10:42:11 1.1 +++ src/frontends/xforms/forms/form_thesaurus.fd 2002/01/12 22:37:54 @@ -3,12 +3,12 @@ Magic: 13000 Internal Form Definition File (do not change) -Number of forms: 6 +Number of forms: 1 Unit of measure: FL_COORD_PIXEL SnapGrid: 5 =============== FORM =============== -Name: form_tabbed_thesaurus +Name: form_thesaurus Width: 465 Height: 450 Number of Objects: 6 @@ -32,24 +32,6 @@ 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 @@ -121,213 +103,21 @@ 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 +type: SELECT_BROWSER +box: 15 50 440 305 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: +label: Meanings|#M 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 +name: browser_meanings callback: C_FormBaseInputCB argument: 0