]> git.lyx.org Git - features.git/commitdiff
Convert the Search/Replace dialog to the cleaner MCV scheme.
authorAngus Leeming <leeming@lyx.org>
Mon, 26 Jan 2004 00:43:56 +0000 (00:43 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 26 Jan 2004 00:43:56 +0000 (00:43 +0000)
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

20 files changed:
src/ChangeLog
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlParagraph.h
src/frontends/controllers/ControlSearch.C
src/frontends/controllers/ControlSearch.h
src/frontends/guiapi.C
src/frontends/guiapi.h
src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/Dialogs2.C
src/frontends/qt2/QSearch.C
src/frontends/qt2/QSearch.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/Dialogs2.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/FormSearch.h
src/lyxfunc.C

index 1fcbcaa611095196de362dc004495b7c98cd55b8..640a1aeb942e84b2152a67e1aa589708d0ee3300 100644 (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
index 42e140531a7dc2a892696bdb0f89b862b472fd4d..8b69af6d19de182dca79ce6ec471bec13c25ba5d 100644 (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
index a7688055a28faa24c3ffdda7de4f2199446a9494..ddaf2c05df1e1b842214459d6a4f23dde05a2d15 100644 (file)
@@ -76,8 +76,6 @@ public:
        ///
        void showPrint();
        ///
-       void showSearch();
-       ///
        void showSendto();
        /// bring up the spellchecker
        void showSpellchecker();
index 82308c17842bb0904e3d6d08936e18186df56214..21dc9b5d0e499949179ab9bbee7159f8820ea494 100644 (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
index 5053526bd5d98031b004e01d5c13633fa384e5fc..7375545538ad062bc8ec6901bcb77025f44ffe36 100644 (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; }
index 5bd503ad018d7f37971907eb9c95f0fca14a43f8..0002aaa0cd8e47dcab310f86646400a065076e76 100644 (file)
 #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));
 }
index 5c34643c4c368aff145f7ebe04b95593a9e632dd..09c2be55454d10fab413bc6c1b2cee4e1d35d698 100644 (file)
 #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
index 1006b66fc944c72acaf616be4306fe3015c4b9c5..9cd0d32a00a5ff31fa34b1a948f7d17ce81b6983 100644 (file)
@@ -52,12 +52,6 @@ void gui_ShowPrint(Dialogs & d)
 }
 
 
-void gui_ShowSearch(Dialogs & d)
-{
-       d.showSearch();
-}
-
-
 void gui_ShowSendto(Dialogs & d)
 {
        d.showSendto();
index ef1d4990cefeaa9c0da0d2e55c36c47ba1a2d862..77e3c46f3c3d38f7b6a16e4387b177dbd20e3d26 100644 (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 &);
 
index f68f54810a48f5d4117f2fff03972a52b6622f0f..0f53c54bad485bce5204344f7abceee76027408a 100644 (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
index 5ed714492c193a20f0aa0814c43b381f1cf2703f..ecbd3a1332fb1f0a4d6598abacc47979e9964731 100644 (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));
index 583f714dff335349c6b9e6a8713d7c8117d18a08..e419f68387f37221cb09323e0bdcea6e2e95c12f 100644 (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();
index a74f29b0e2b9e7883168cfea13d4cdda937d1486..53761d03660eb122c073fae61fdb0d06ceb9333b 100644 (file)
 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"))
 {
 }
 
index 3c179dac9f2240d3e0f4891fc002c8e69845a3b4..55dc44b3627bf6074906b9df9e92f463facc894b 100644 (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() {}
index 8768f0907ea18d9facc25636369201fe8442fa07..0b5707089e5309dd74509487b59a01821b329cdc 100644 (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):
index 8322fc8c30a676e802805f501dc9d31e0dad18a7..831ff2f9dda4360163e1413400acd8de8176b885 100644 (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));
index 11ad084acad0fb05b6848b7c51881e952f450330..1d50034f263ba41e397f31d40d1df28136853ffc 100644 (file)
 #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();
index 261d895cf6143011997af7cf69b214fe05f94a8f..7c386786aa600af52af90031e35513848f85dd17 100644 (file)
 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"))
 {}
 
 
index 47329d97f91c7d93ad6f3c6ece889fd82bac2fd4..3571508112031887a8c73c7c052c94e9931669b4 100644 (file)
 #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() {}
index d4ef9aa8d0e39ec9cdb104cd11d6c44a32a7074f..63607907f6ce5b0b9595692f8a9e891d933c5aa8 100644 (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")