mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
port the thesaurus dialog to the new scheme
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6583 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
336be5b8f5
commit
9f330376ac
@ -1212,7 +1212,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
}
|
||||
}
|
||||
|
||||
bv_->owner()->getDialogs().showThesaurus(arg);
|
||||
bv_->owner()->getDialogs().show("thesaurus", arg);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-03-26 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* BufferView_pimpl.C (dispatch): changes to the Dialogs interface for
|
||||
the thesaurus dialog.
|
||||
|
||||
2003-03-26 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* ParagraphList.C (erase): handle the case where it == begin
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-03-26 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showThesaurus.
|
||||
* guiapi.[Ch]: remove the gui_ equivalents.
|
||||
|
||||
2003-03-25 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showFile, showLogFile, showVCLogFile.
|
||||
|
@ -90,8 +90,6 @@ public:
|
||||
void showSpellchecker();
|
||||
/// show the TexInfo
|
||||
void showTexinfo();
|
||||
/// show the thesaurus dialog
|
||||
void showThesaurus(string const &);
|
||||
//@}
|
||||
|
||||
/** \param name == "about" etc; an identifier used to
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-03-26 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlThesaurus.[Ch]: rewrite to use the Dialog-based scheme.
|
||||
|
||||
2003-03-25 John Levon <levon@movementarian.org>
|
||||
|
||||
* ControlSpellchecker.C: support for new aspell
|
||||
|
@ -18,16 +18,21 @@
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
|
||||
ControlThesaurus::ControlThesaurus(LyXView & lv, Dialogs & d)
|
||||
: ControlDialogBD(lv, d)
|
||||
ControlThesaurus::ControlThesaurus(Dialog & parent)
|
||||
: Dialog::Controller(parent)
|
||||
{}
|
||||
|
||||
|
||||
void ControlThesaurus::showEntry(string const & entry)
|
||||
bool ControlThesaurus::initialiseParams(string const & data)
|
||||
{
|
||||
oldstr_ = entry;
|
||||
show();
|
||||
oldstr_ = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ControlThesaurus::clearParams()
|
||||
{
|
||||
oldstr_.erase();
|
||||
}
|
||||
|
||||
|
||||
@ -38,19 +43,20 @@ void ControlThesaurus::replace(string const & newstr)
|
||||
* deletion/change !
|
||||
*/
|
||||
int const replace_count =
|
||||
lyxfind::LyXReplace(bufferview(), oldstr_, newstr,
|
||||
lyxfind::LyXReplace(kernel().bufferview(), oldstr_, newstr,
|
||||
true, true, true, false, true);
|
||||
|
||||
oldstr_ = newstr;
|
||||
|
||||
if (replace_count == 0)
|
||||
lv_.message(_("String not found!"));
|
||||
kernel().lyxview().message(_("String not found!"));
|
||||
else
|
||||
lv_.message(_("String has been replaced."));
|
||||
kernel().lyxview().message(_("String has been replaced."));
|
||||
}
|
||||
|
||||
|
||||
Thesaurus::Meanings const & ControlThesaurus::getMeanings(string const & str)
|
||||
Thesaurus::Meanings const &
|
||||
ControlThesaurus::getMeanings(string const & str)
|
||||
{
|
||||
if (str != laststr_)
|
||||
meanings_ = thesaurus.lookup(str);
|
||||
|
@ -13,33 +13,33 @@
|
||||
#ifndef CONTROLTHESAURUS_H
|
||||
#define CONTROLTHESAURUS_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "LString.h"
|
||||
#include "Dialog.h"
|
||||
#include "Thesaurus.h"
|
||||
#include "ControlDialog_impl.h"
|
||||
#include <vector>
|
||||
|
||||
/** A controller for Thesaurus dialogs.
|
||||
*/
|
||||
class ControlThesaurus : public ControlDialogBD {
|
||||
class ControlThesaurus : public Dialog::Controller {
|
||||
public:
|
||||
///
|
||||
ControlThesaurus(LyXView &, Dialogs &);
|
||||
ControlThesaurus(Dialog &);
|
||||
///
|
||||
virtual bool initialiseParams(string const & data);
|
||||
///
|
||||
virtual void clearParams();
|
||||
///
|
||||
virtual void dispatchParams() {}
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
|
||||
/// replace the particular string
|
||||
void replace(string const & newstr);
|
||||
|
||||
/// show dialog
|
||||
virtual void showEntry(string const & str);
|
||||
|
||||
/// get meanings
|
||||
Thesaurus::Meanings const & getMeanings(string const & str);
|
||||
|
||||
/// the text
|
||||
string const & text() {
|
||||
return oldstr_;
|
||||
}
|
||||
string const & text() const { return oldstr_; }
|
||||
|
||||
private:
|
||||
/// last string looked up
|
||||
|
@ -81,10 +81,4 @@ void gui_ShowTexinfo(Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowThesaurus(string const & s, Dialogs & d)
|
||||
{
|
||||
d.showThesaurus(s);
|
||||
}
|
||||
|
||||
|
||||
} // extern "C"
|
||||
|
@ -31,7 +31,6 @@ void gui_ShowSearch(Dialogs &);
|
||||
void gui_ShowSendto(Dialogs &);
|
||||
void gui_ShowSpellchecker(Dialogs &);
|
||||
void gui_ShowTexinfo(Dialogs &);
|
||||
void gui_ShowThesaurus(string const &, Dialogs &);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
@ -1,3 +1,13 @@
|
||||
2003-03-26 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove the thesaurus dialog.
|
||||
|
||||
* Dialogs3.C: add it here.
|
||||
|
||||
* QThesaurus.[Ch]: changes to use the new Dialog-based scheme.
|
||||
|
||||
2003-03-25 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
|
@ -27,11 +27,7 @@ Dialogs::~Dialogs()
|
||||
|
||||
|
||||
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
:
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
thesaurus(lv, d),
|
||||
#endif
|
||||
document(lv, d),
|
||||
: document(lv, d),
|
||||
prefs(lv, d),
|
||||
print(lv, d),
|
||||
search(lv, d),
|
||||
|
@ -74,18 +74,3 @@ void Dialogs::showTexinfo()
|
||||
{
|
||||
pimpl_->texinfo.controller().show();
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
|
||||
void Dialogs::showThesaurus(string const & s)
|
||||
{
|
||||
pimpl_->thesaurus.controller().showEntry(s);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Dialogs::showThesaurus(string const &)
|
||||
{}
|
||||
|
||||
#endif
|
||||
|
@ -36,58 +36,38 @@
|
||||
#include "ControlWrap.h"
|
||||
|
||||
#include "QAbout.h"
|
||||
#include "QAboutDialog.h"
|
||||
#include "QBibitem.h"
|
||||
#include "QBibitemDialog.h"
|
||||
#include "QBibtex.h"
|
||||
#include "QBibtexDialog.h"
|
||||
#include "QChanges.h"
|
||||
#include "QChangesDialog.h"
|
||||
#include "QCharacter.h"
|
||||
#include "QCharacterDialog.h"
|
||||
#include "QCitation.h"
|
||||
#include "QCitationDialog.h"
|
||||
#include "QError.h"
|
||||
#include "QErrorDialog.h"
|
||||
#include "QERT.h"
|
||||
#include "QERTDialog.h"
|
||||
#include "QExternal.h"
|
||||
#include "QExternalDialog.h"
|
||||
#include "QFloat.h"
|
||||
#include "QFloatDialog.h"
|
||||
// Here would be an appropriate point to lecture on the evils
|
||||
// of the Qt headers, those most fucked up of disgusting ratholes.
|
||||
// But I won't.
|
||||
#undef signals
|
||||
#include "QGraphics.h"
|
||||
#include "QGraphicsDialog.h"
|
||||
#include "QInclude.h"
|
||||
#include "QIncludeDialog.h"
|
||||
#include "QIndex.h"
|
||||
#include "QIndexDialog.h"
|
||||
#include "QLog.h"
|
||||
#include "QLogDialog.h"
|
||||
#include "QMinipage.h"
|
||||
#include "QMinipageDialog.h"
|
||||
#include "QParagraph.h"
|
||||
#include "QParagraphDialog.h"
|
||||
#include "QRef.h"
|
||||
#include "QRefDialog.h"
|
||||
#include "QShowFile.h"
|
||||
#include "QShowFileDialog.h"
|
||||
#include "QTabular.h"
|
||||
#include "QTabularDialog.h"
|
||||
#include "QTabularCreate.h"
|
||||
#include "QTabularCreateDialog.h"
|
||||
#include "QToc.h"
|
||||
#include "QTocDialog.h"
|
||||
#include "QURL.h"
|
||||
#include "QURLDialog.h"
|
||||
#include "QVCLog.h"
|
||||
#include "QVCLogDialog.h"
|
||||
|
||||
#include "QWrap.h"
|
||||
#include "QWrapDialog.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
#include "QThesaurus.h"
|
||||
#endif
|
||||
|
||||
#include "Qt2BC.h"
|
||||
#include "ButtonController.h"
|
||||
@ -99,7 +79,13 @@ namespace {
|
||||
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
|
||||
"character", "citation", "error", "ert", "external", "file", "float",
|
||||
"graphics", "include", "index", "label", "log", "minipage", "paragraph",
|
||||
"ref", "tabular", "tabularcreate", "toc", "url", "vclog", "wrap" };
|
||||
"ref", "tabular", "tabularcreate",
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
"thesaurus",
|
||||
#endif
|
||||
|
||||
"toc", "url", "vclog", "wrap" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -220,6 +206,12 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlTabularCreate(*dialog));
|
||||
dialog->setView(new QTabularCreate(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
} else if (name == "thesaurus") {
|
||||
dialog->setController(new ControlThesaurus(*dialog));
|
||||
dialog->setView(new QThesaurus(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
#endif
|
||||
} else if (name == "toc") {
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new QToc(*dialog));
|
||||
|
@ -45,12 +45,6 @@
|
||||
#include "QTexinfo.h"
|
||||
#include "QTexinfoDialog.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
#include "QThesaurus.h"
|
||||
#include "QThesaurusDialog.h"
|
||||
#endif
|
||||
|
||||
#include "Qt2BC.h"
|
||||
|
||||
|
||||
@ -76,11 +70,6 @@ SpellcheckerDialog;
|
||||
typedef GUI<ControlTexinfo, QTexinfo, OkCancelPolicy, Qt2BC>
|
||||
TexinfoDialog;
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
typedef GUI<ControlThesaurus, QThesaurus, OkApplyCancelReadOnlyPolicy, Qt2BC>
|
||||
ThesaurusDialog;
|
||||
#endif
|
||||
|
||||
struct Dialogs::Impl {
|
||||
Impl(LyXView & lv, Dialogs & d);
|
||||
|
||||
@ -91,10 +80,6 @@ struct Dialogs::Impl {
|
||||
SendtoDialog sendto;
|
||||
SpellcheckerDialog spellchecker;
|
||||
TexinfoDialog texinfo;
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
ThesaurusDialog thesaurus;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // DIALOGS_IMPL_H
|
||||
|
@ -21,11 +21,11 @@
|
||||
#include <qpushbutton.h>
|
||||
#include <qlistbox.h>
|
||||
|
||||
typedef Qt2CB<ControlThesaurus, Qt2DB<QThesaurusDialog> > base_class;
|
||||
typedef QController<ControlThesaurus, QView<QThesaurusDialog> > base_class;
|
||||
|
||||
|
||||
QThesaurus::QThesaurus()
|
||||
: base_class(qt_("LyX: Thesaurus"))
|
||||
QThesaurus::QThesaurus(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Thesaurus"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,20 +13,21 @@
|
||||
#define QTHESAURUS_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
|
||||
class ControlThesaurus;
|
||||
class QThesaurusDialog;
|
||||
|
||||
///
|
||||
class QThesaurus
|
||||
: public Qt2CB<ControlThesaurus, Qt2DB<QThesaurusDialog> >
|
||||
: public QController<ControlThesaurus, QView<QThesaurusDialog> >
|
||||
{
|
||||
public:
|
||||
///
|
||||
friend class QThesaurusDialog;
|
||||
///
|
||||
QThesaurus();
|
||||
QThesaurus(Dialog &);
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply() {}
|
||||
|
@ -1,3 +1,14 @@
|
||||
2003-03-26 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove the thesaurus dialog.
|
||||
|
||||
* Dialogs3.C: add it here.
|
||||
|
||||
* FormThesaurus.[Ch]:
|
||||
* forms/form_thesaurus.fd: changes to use the new Dialog-based scheme.
|
||||
|
||||
2003-03-25 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
|
@ -27,11 +27,7 @@ Dialogs::~Dialogs()
|
||||
|
||||
|
||||
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
:
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
thesaurus(lv, d),
|
||||
#endif
|
||||
document(lv, d),
|
||||
: document(lv, d),
|
||||
forks(lv, d),
|
||||
mathpanel(lv, d),
|
||||
preamble(lv, d),
|
||||
|
@ -73,18 +73,3 @@ void Dialogs::showTexinfo()
|
||||
{
|
||||
pimpl_->texinfo.controller().show();
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
|
||||
void Dialogs::showThesaurus(string const & s)
|
||||
{
|
||||
pimpl_->thesaurus.controller().showEntry(s);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Dialogs::showThesaurus(string const &)
|
||||
{}
|
||||
|
||||
#endif
|
||||
|
@ -63,6 +63,11 @@
|
||||
#include "FormVCLog.h"
|
||||
#include "FormWrap.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
#include "FormThesaurus.h"
|
||||
#endif
|
||||
|
||||
#include "xformsBC.h"
|
||||
#include "ButtonController.h"
|
||||
|
||||
@ -72,7 +77,13 @@ namespace {
|
||||
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
|
||||
"character", "citation", "error", "ert", "external", "file", "float",
|
||||
"graphics", "include", "index", "label", "log", "minipage", "paragraph",
|
||||
"ref", "tabular", "tabularcreate", "toc", "url", "vclog", "wrap" };
|
||||
"ref", "tabular", "tabularcreate",
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
"thesaurus",
|
||||
#endif
|
||||
|
||||
"toc", "url", "vclog", "wrap" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -191,6 +202,12 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlTabularCreate(*dialog));
|
||||
dialog->setView(new FormTabularCreate(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
} else if (name == "thesaurus") {
|
||||
dialog->setController(new ControlThesaurus(*dialog));
|
||||
dialog->setView(new FormThesaurus(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
#endif
|
||||
} else if (name == "toc") {
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new FormToc(*dialog));
|
||||
|
@ -58,12 +58,6 @@
|
||||
#include "FormTexinfo.h"
|
||||
#include "forms/form_texinfo.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
#include "FormThesaurus.h"
|
||||
#include "forms/form_thesaurus.h"
|
||||
#endif
|
||||
|
||||
typedef GUI<ControlDocument, FormDocument, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
DocumentDialog;
|
||||
|
||||
@ -94,11 +88,6 @@ SpellcheckerDialog;
|
||||
typedef GUI<ControlTexinfo, FormTexinfo, OkCancelPolicy, xformsBC>
|
||||
TexinfoDialog;
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
typedef GUI<ControlThesaurus, FormThesaurus, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
ThesaurusDialog;
|
||||
#endif
|
||||
|
||||
struct Dialogs::Impl {
|
||||
Impl(LyXView & lv, Dialogs & d);
|
||||
|
||||
@ -112,10 +101,6 @@ struct Dialogs::Impl {
|
||||
SendtoDialog sendto;
|
||||
SpellcheckerDialog spellchecker;
|
||||
TexinfoDialog texinfo;
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
ThesaurusDialog thesaurus;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // DIALOGS_IMPL_H
|
||||
|
@ -29,11 +29,11 @@ using std::islower;
|
||||
using std::vector;
|
||||
|
||||
|
||||
typedef FormCB<ControlThesaurus, FormDB<FD_thesaurus> > base_class;
|
||||
typedef FormController<ControlThesaurus, FormView<FD_thesaurus> > base_class;
|
||||
|
||||
|
||||
FormThesaurus::FormThesaurus()
|
||||
: base_class(_("Thesaurus"), false),
|
||||
FormThesaurus::FormThesaurus(Dialog & parent)
|
||||
: base_class(parent, _("Thesaurus"), false),
|
||||
clickline_(-1)
|
||||
{
|
||||
}
|
||||
|
@ -13,17 +13,19 @@
|
||||
#define FORMTHESAURUS_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
|
||||
|
||||
class ControlThesaurus;
|
||||
struct FD_thesaurus;
|
||||
|
||||
/** This class provides an XForms implementation of the Thesaurus dialog.
|
||||
*/
|
||||
class FormThesaurus : public FormCB<ControlThesaurus, FormDB<FD_thesaurus> > {
|
||||
class FormThesaurus
|
||||
: public FormController<ControlThesaurus, FormView<FD_thesaurus> > {
|
||||
public:
|
||||
///
|
||||
FormThesaurus();
|
||||
FormThesaurus(Dialog &);
|
||||
private:
|
||||
/// not needed.
|
||||
virtual void apply() {}
|
||||
|
@ -46,7 +46,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: button_replace
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -64,7 +64,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: button_close
|
||||
callback: C_FormBaseOKCB
|
||||
callback: C_FormDialogView_OKCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -82,7 +82,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: input_entry
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -100,7 +100,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_NorthWest
|
||||
name: input_replace
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -118,7 +118,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: browser_meanings
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
||||
|
Loading…
Reference in New Issue
Block a user