Convert the Search/Replace dialog to the cleaner MCV scheme.

The dispatch reaches the correct place in the core, but the core
doesn't seem to act on it properly. No doubt Andr�'s doing ;-)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8370 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2004-01-26 00:43:56 +00:00
parent 35d08a9635
commit be2ce42c65
20 changed files with 85 additions and 89 deletions

View File

@ -1,3 +1,7 @@
2004-01-25 Angus Leeming <leeming@lyx.org>
* lyxfunc.C (dispatch): Dialogs::showSearch is no more.
2004-01-19 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* LaTeXFeatures.h: add nice_ and nice() const

View File

@ -1,3 +1,8 @@
2004-01-25 Angus Leeming <leeming@lyx.org>
* Dialogs.h (showSearch):
* guiapi.[Ch] (gui_ShowSearch): removed.
2004-01-08 Angus Leeming <leeming@lyx.org>
* FileDialog.h (open, save): the file filter mask is now passed

View File

@ -76,8 +76,6 @@ public:
///
void showPrint();
///
void showSearch();
///
void showSendto();
/// bring up the spellchecker
void showSpellchecker();

View File

@ -1,3 +1,8 @@
2004-01-25 Angus Leeming <leeming@lyx.org>
* ControlSearch.[Ch]: derive from Dialog::Controller rather than
the deprecated ControlDialogBD.
2004-01-08 Alfredo Braunstein <abraunst@lyx.org>
* Dialog.C (hide): disconnect dialog/inset on hide (partial fix

View File

@ -25,7 +25,7 @@ public:
virtual bool initialiseParams(std::string const & data);
/// clean-up on hide.
virtual void clearParams();
/// clean-up on hide.
///
virtual void dispatchParams();
///
virtual bool isBufferDependent() const { return true; }

View File

@ -15,34 +15,29 @@
#include "funcrequest.h"
#include "lyxfind.h"
#include "frontends/LyXView.h"
using std::string;
/* The ControlSeach class is now in a fit state to derive from
Dialog::Controller
*/
ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d)
ControlSearch::ControlSearch(Dialog & parent)
: Dialog::Controller(parent)
{}
void ControlSearch::find(string const & search,
bool casesensitive, bool matchword, bool forward)
void ControlSearch::find(string const & search, bool casesensitive,
bool matchword, bool forward)
{
string const data =
lyx::find::find2string(search,
casesensitive, matchword, forward);
lv_.dispatch(FuncRequest(LFUN_WORD_FIND, data));
string const data = lyx::find::find2string(search, casesensitive,
matchword, forward);
kernel().dispatch(FuncRequest(LFUN_WORD_FIND, data));
}
void ControlSearch::replace(string const & search, string const & replace,
bool casesensitive, bool matchword, bool forward, bool all)
bool casesensitive, bool matchword,
bool forward, bool all)
{
string const data =
lyx::find::replace2string(search, replace,
casesensitive, matchword, all, forward);
lv_.dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
lyx::find::replace2string(search, replace, casesensitive,
matchword, all, forward);
kernel().dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
}

View File

@ -12,15 +12,19 @@
#ifndef CONTROLSEARCH_H
#define CONTROLSEARCH_H
#include "Dialog.h"
#include "ControlDialog_impl.h"
/** A controller for Search dialogs.
*/
class ControlSearch : public ControlDialogBD {
class ControlSearch : public Dialog::Controller {
public:
///
ControlSearch(LyXView &, Dialogs &);
ControlSearch(Dialog &);
virtual bool initialiseParams(std::string const &) { return true; }
virtual void clearParams() {}
virtual void dispatchParams() {}
virtual bool isBufferDependent() const { return true; }
/// Searches occurence of string
void find(std::string const & search,
@ -30,9 +34,6 @@ public:
void replace(std::string const & search, std::string const & replace,
bool casesensitive, bool matchword,
bool forward, bool all);
private:
/// not needed.
virtual void apply() {}
};
#endif // CONTROLSEARCH_H

View File

@ -52,12 +52,6 @@ void gui_ShowPrint(Dialogs & d)
}
void gui_ShowSearch(Dialogs & d)
{
d.showSearch();
}
void gui_ShowSendto(Dialogs & d)
{
d.showSendto();

View File

@ -25,7 +25,6 @@ void gui_ShowForks(Dialogs &);
void gui_ShowPreamble(Dialogs &);
void gui_ShowPreferences(Dialogs &);
void gui_ShowPrint(Dialogs &);
void gui_ShowSearch(Dialogs &);
void gui_ShowSendto(Dialogs &);
void gui_ShowSpellchecker(Dialogs &);

View File

@ -1,3 +1,10 @@
2004-01-25 Angus Leeming <leeming@lyx.org>
* Dialog.C (build): add the "findreplace" dialog.
* Dialogs2.C (showSearch): removed.
* QSearch.[Ch]: derive from QDialogView rather than from Qt2Base.
2004-01-15 Ronald Florence <ron@18james.com>
* Menubar_pimpl.C: change Q_WS_MAC conditional define to

View File

@ -30,6 +30,7 @@
#include "ControlNote.h"
#include "ControlParagraph.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlShowFile.h"
#include "ControlTabular.h"
#include "ControlTabularCreate.h"
@ -63,6 +64,7 @@
#include "QNote.h"
#include "QParagraph.h"
#include "QRef.h"
#include "QSearch.h"
#include "QShowFile.h"
#include "QTabular.h"
#include "QTabularCreate.h"
@ -84,10 +86,11 @@ using std::string;
namespace {
char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "box",
"branch", "changes", "character", "citation", "error", "errorlist", "ert", "external",
"file", "float", "graphics", "include", "index", "label", "log",
"mathpanel", "mathdelimiter", "mathmatrix",
char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
"citation", "error", "errorlist", "ert", "external", "file", "findreplace",
"float", "graphics", "include", "index", "label", "log", "mathpanel",
"mathdelimiter", "mathmatrix",
"note", "paragraph", "ref", "tabular", "tabularcreate", "texinfo",
#ifdef HAVE_LIBAIKSAURUS
@ -175,6 +178,10 @@ Dialog * Dialogs::build(string const & name)
dialog->setController(new ControlShowFile(*dialog));
dialog->setView(new QShowFile(*dialog));
dialog->bc().bp(new OkCancelPolicy);
} else if (name == "findreplace") {
dialog->setController(new ControlSearch(*dialog));
dialog->setView(new QSearch(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "float") {
dialog->setController(new ControlFloat(*dialog));
dialog->setView(new QFloat(*dialog));

View File

@ -19,7 +19,6 @@
#include "ControlDocument.h"
#include "ControlPrint.h"
#include "ControlSearch.h"
#include "ControlSendto.h"
#include "ControlSpellchecker.h"
@ -34,8 +33,6 @@
#include "QPrefsDialog.h"
#include "QPrint.h"
#include "QLPrintDialog.h"
#include "QSearch.h"
#include "QSearchDialog.h"
#include "QSendto.h"
#include "QSendtoDialog.h"
#include "QSpellchecker.h"
@ -53,9 +50,6 @@ PrefsDialog;
typedef GUI<ControlPrint, QPrint, OkApplyCancelPolicy, Qt2BC>
PrintDialog;
typedef GUI<ControlSearch, QSearch, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
SearchDialog;
typedef GUI<ControlSendto, QSendto, OkApplyCancelPolicy, Qt2BC>
SendtoDialog;
@ -68,7 +62,6 @@ struct Dialogs::Impl {
DocumentDialog document;
PrefsDialog prefs;
PrintDialog print;
SearchDialog search;
SendtoDialog sendto;
SpellcheckerDialog spellchecker;
};
@ -78,7 +71,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
: document(lv, d),
prefs(lv, d),
print(lv, d),
search(lv, d),
sendto(lv, d),
spellchecker(lv, d)
{}
@ -126,12 +118,6 @@ void Dialogs::showPrint()
}
void Dialogs::showSearch()
{
pimpl_->search.controller().show();
}
void Dialogs::showSendto()
{
pimpl_->sendto.controller().show();

View File

@ -23,11 +23,11 @@
using std::string;
typedef Qt2CB<ControlSearch, Qt2DB<QSearchDialog> > base_class;
typedef QController<ControlSearch, QView<QSearchDialog> > base_class;
QSearch::QSearch()
: base_class(_("LyX: Find and Replace"))
QSearch::QSearch(Dialog & parent)
: base_class(parent, _("LyX: Find and Replace"))
{
}

View File

@ -12,8 +12,7 @@
#ifndef QSEARCH_H
#define QSEARCH_H
#include "Qt2Base.h"
#include "QDialogView.h"
class ControlSearch;
class QSearchDialog;
@ -21,13 +20,13 @@ class QSearchDialog;
///
class QSearch
: public Qt2CB<ControlSearch, Qt2DB<QSearchDialog> >
: public QController<ControlSearch, QView<QSearchDialog> >
{
public:
///
friend class QSearchDialog;
///
QSearch();
QSearch(Dialog &);
private:
/// Apply changes
virtual void apply() {}

View File

@ -1,3 +1,10 @@
2004-01-25 Angus Leeming <leeming@lyx.org>
* Dialog.C (build): add the "findreplace" dialog.
* Dialogs2.C (showSearch): removed.
* FormSearch.[Ch]: derive from FormDialogView rather than from FormBase.
2004-01-08 Angus Leeming <leeming@lyx.org>
* FileDialog.C (open, save):

View File

@ -31,6 +31,7 @@
#include "ControlNote.h"
#include "ControlParagraph.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlShowFile.h"
#include "ControlTabular.h"
#include "ControlTabularCreate.h"
@ -64,6 +65,7 @@
#include "FormRef.h"
#include "FormTabular.h"
#include "FormTexinfo.h"
#include "FormSearch.h"
#include "FormShowFile.h"
#include "FormTabularCreate.h"
#include "FormText.h"
@ -110,13 +112,13 @@ FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title,
char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "branch", "box", "changes",
"character", "citation", "error", "errorlist" , "ert", "external", "file",
"aboutlyx", "bibitem", "bibtex", "branch", "box", "changes", "character",
"citation", "error", "errorlist" , "ert", "external", "file", "findreplace",
"float", "graphics", "include", "index", "label", "log", "mathpanel",
"mathaccents", "matharrows", "mathoperators", "mathrelations", "mathgreek",
"mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations", "mathamsoperators",
"mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
"mathaccents", "matharrows", "mathoperators", "mathrelations",
"mathgreek", "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations",
"mathamsoperators", "mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
"note", "paragraph", "ref", "tabular", "tabularcreate", "texinfo",
#ifdef HAVE_LIBAIKSAURUS
@ -203,6 +205,10 @@ Dialog * Dialogs::build(string const & name)
dialog->setController(new ControlShowFile(*dialog));
dialog->setView(new FormShowFile(*dialog));
dialog->bc().bp(new OkCancelPolicy);
} else if (name == "findreplace") {
dialog->setController(new ControlSearch(*dialog));
dialog->setView(new FormSearch(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "float") {
dialog->setController(new ControlFloat(*dialog));
dialog->setView(new FormFloat(*dialog));

View File

@ -39,10 +39,6 @@
#include "FormPrint.h"
#include "forms/form_print.h"
#include "ControlSearch.h"
#include "FormSearch.h"
#include "forms/form_search.h"
#include "ControlSendto.h"
#include "FormSendto.h"
#include "forms/form_sendto.h"
@ -66,9 +62,6 @@ PreferencesDialog;
typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
PrintDialog;
typedef GUI<ControlSearch, FormSearch, NoRepeatedApplyReadOnlyPolicy, xformsBC>
SearchDialog;
typedef GUI<ControlSendto, FormSendto, OkApplyCancelPolicy, xformsBC>
SendtoDialog;
@ -84,7 +77,6 @@ struct Dialogs::Impl {
PreambleDialog preamble;
PreferencesDialog preferences;
PrintDialog print;
SearchDialog search;
SendtoDialog sendto;
SpellcheckerDialog spellchecker;
};
@ -96,7 +88,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
preamble(lv, d),
preferences(lv, d),
print(lv, d),
search(lv, d),
sendto(lv, d),
spellchecker(lv, d)
{}
@ -144,12 +135,6 @@ void Dialogs::showPrint()
}
void Dialogs::showSearch()
{
pimpl_->search.controller().show();
}
void Dialogs::showSendto()
{
pimpl_->sendto.controller().show();

View File

@ -24,10 +24,10 @@
using std::string;
typedef FormCB<ControlSearch, FormDB<FD_search> > base_class;
typedef FormController<ControlSearch, FormView<FD_search> > base_class;
FormSearch::FormSearch()
: base_class(_("Find and Replace"))
FormSearch::FormSearch(Dialog & parent)
: base_class(parent, _("Find and Replace"))
{}

View File

@ -12,18 +12,18 @@
#ifndef FORMSEARCH_H
#define FORMSEARCH_H
#include "FormBase.h"
#include "FormDialogView.h"
class ControlSearch;
struct FD_search;
/** This class provides an XForms implementation of the FormSearch Dialog.
*/
class FormSearch : public FormCB<ControlSearch, FormDB<FD_search> > {
class FormSearch
: public FormController<ControlSearch, FormView<FD_search> > {
public:
///
FormSearch();
FormSearch(Dialog &);
private:
/// not needed.
virtual void apply() {}

View File

@ -1200,8 +1200,6 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
}
else if (name == "document")
owner->getDialogs().showDocument();
else if (name == "findreplace")
owner->getDialogs().showSearch();
else if (name == "forks")
owner->getDialogs().showForks();
else if (name == "preamble")