]> git.lyx.org Git - features.git/commitdiff
port the minipage dialog to the new scheme. Various other small changes
authorAngus Leeming <leeming@lyx.org>
Fri, 7 Mar 2003 14:08:10 +0000 (14:08 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 7 Mar 2003 14:08:10 +0000 (14:08 +0000)
in the inset mailers and in the controllers.
Enable the include dialog to be lauched for a new inset (should please John ;-)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6374 a592a061-630c-0410-9148-cb99ea01b6c8

62 files changed:
src/ChangeLog
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlBibitem.C [deleted file]
src/frontends/controllers/ControlBibitem.h [deleted file]
src/frontends/controllers/ControlERT.C
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlFloat.C
src/frontends/controllers/ControlInclude.C
src/frontends/controllers/ControlIndex.C [deleted file]
src/frontends/controllers/ControlIndex.h [deleted file]
src/frontends/controllers/ControlLabel.C [deleted file]
src/frontends/controllers/ControlLabel.h [deleted file]
src/frontends/controllers/ControlMinipage.C
src/frontends/controllers/ControlMinipage.h
src/frontends/controllers/ControlUrl.C [deleted file]
src/frontends/controllers/ControlUrl.h [deleted file]
src/frontends/controllers/ControlWrap.C
src/frontends/controllers/Makefile.am
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/Dialogs3.C
src/frontends/qt2/Dialogs_impl.h
src/frontends/qt2/QBibitem.C
src/frontends/qt2/QBibitem.h
src/frontends/qt2/QBibitemDialog.C
src/frontends/qt2/QIndex.C
src/frontends/qt2/QMinipage.C
src/frontends/qt2/QMinipage.h
src/frontends/qt2/QURL.C
src/frontends/qt2/QURL.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/Dialogs2.C
src/frontends/xforms/Dialogs3.C
src/frontends/xforms/Dialogs_impl.h
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/FormBibitem.h
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/FormMinipage.h
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormUrl.h
src/frontends/xforms/forms/form_minipage.fd
src/insets/ChangeLog
src/insets/insetcommand.C
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetexternal.C
src/insets/insetexternal.h
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetminipage.C
src/insets/insetminipage.h
src/insets/insetwrap.C
src/insets/insetwrap.h
src/lyxfunc.C

index 2029bfbc43572c1a74a2252890dfd8fd1c59bf3f..b2a9bc3c6d41db458676318ba80fbe5a78a027ed 100644 (file)
@@ -1,3 +1,8 @@
+2003-03-07  Angus Leeming  <leeming@lyx.org>
+
+       * lyxfunc.C (dispatch): add "include" to LFUN_SHOW_NEW_INSET and
+       remove "ert".
+
 2003-03-06  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * ParagraphList.C (front): new function
index abc24731993a5f4385b76f4e36c88412e9677e6e..29f3bb135714b487267a9e1dc238f424b72fa3e4 100644 (file)
@@ -1,3 +1,8 @@
+2003-03-07  Angus Leeming  <leeming@lyx.org>
+
+       * Dialogs.h: remove showMinipage, updateMinipage.
+       * guiapi.[Ch]: remove gui_showMinipage, gui_updateMinipage.
+
 2003-03-06  Alfredo Braunstein  <abraunst@libero.it>
 
        * screen.C: use LyXText::top_y() instead of LyXText::first_y
index c3971ffda75822362910844d858763b4930cca8e..745bdc13a78bd9e7a2731c4546a0f62fc35b30fa 100644 (file)
@@ -25,7 +25,6 @@ class LyXView;
 
 class InsetGraphics;
 class InsetInfo;
-class InsetMinipage;
 class Paragraph;
 class InsetTabular;
 
@@ -96,10 +95,6 @@ public:
        /// show the merge changes dialog
        void showMergeChanges();
        ///
-       void showMinipage(InsetMinipage *);
-       ///
-       void updateMinipage(InsetMinipage *);
-       ///
        void showParagraph();
        ///
        void updateParagraph();
index b7bec49a68a24b034aa7e921f2b40c19a7f5311f..ce6179f0bd8b2b0910457b3ec2b8fc1207a5c21c 100644 (file)
@@ -1,3 +1,21 @@
+2003-03-07  Angus Leeming  <leeming@lyx.org>
+
+       * ControlBibitem.[Ch]:
+       * ControlIndex.[Ch]:
+       * ControlLabel.[Ch]:
+       * ControlUrl.[Ch]: removed.
+
+       * Makefile.am: remove files.
+
+       * ControlERT.C (dispatchParams):
+       * ControlExternal.C (dispatchParams):
+       * ControlFloat.C (dispatchParams):
+       * ControlInclude.C (dispatchParams):
+       * ControlWrap.C (dispatchParams): no need to pass name to Mailer
+       anymore.
+
+       * ControlMinipage.[Ch]: rewrite to use the Dialog-based scheme.
+
 2003-03-05  Angus Leeming  <leeming@lyx.org>
 
        * ControlWrap.[Ch]: rewrite to use the Dialog-based scheme.
diff --git a/src/frontends/controllers/ControlBibitem.C b/src/frontends/controllers/ControlBibitem.C
deleted file mode 100644 (file)
index cc14a6b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * \file ControlBibitem.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#include <config.h>
-
-#include "ControlBibitem.h"
-
-
-ControlBibitem::ControlBibitem(Dialog & d)
-       : ControlCommand(d, "bibitem")
-{}
diff --git a/src/frontends/controllers/ControlBibitem.h b/src/frontends/controllers/ControlBibitem.h
deleted file mode 100644 (file)
index 226466a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// -*- C++ -*-
-/**
- * \file ControlBibitem.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#ifndef CONTROLBIBITEM_H
-#define CONTROLBIBITEM_H
-
-
-#include "ControlCommand.h"
-
-/** A controller for Bibitem dialogs.
- */
-class ControlBibitem : public ControlCommand {
-public:
-       ///
-       ControlBibitem(Dialog &);
-};
-
-#endif // CONTROLBIBITEM_H
index 65e05a801dfb0c33e75177f76c324a9987b1eaed..64ec796d1f57b78540da39f2fdcf0fe45ee1f65c 100644 (file)
@@ -34,6 +34,6 @@ void ControlERT::clearParams()
 
 void ControlERT::dispatchParams()
 {
-       string const lfun = InsetERTMailer::params2string("ert", status_);
+       string const lfun = InsetERTMailer::params2string(status_);
        kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
index 7c5ee9fd48ff0c76fffd810d8972db08711835f8..60060449385979e41398d24060201ff9c11b5f0f 100644 (file)
@@ -46,8 +46,7 @@ void ControlExternal::clearParams()
 
 void ControlExternal::dispatchParams()
 {
-       InsetExternal::Params p = params();
-       string const lfun = InsetExternalMailer::params2string("external", p);
+       string const lfun = InsetExternalMailer::params2string(params());
        kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
 
index 52744e622fb2d11ede0604bbe5736fde4932a7c1..3817f7f8884f73e653ea22dc1ef589b6533d0a6c 100644 (file)
@@ -36,6 +36,6 @@ void ControlFloat::clearParams()
 
 void ControlFloat::dispatchParams()
 {
-       string const lfun = InsetFloatMailer::params2string("float", params());
+       string const lfun = InsetFloatMailer::params2string(params());
        kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
index aa9695f36320a674a96f4a214afe0467c63f7b9d..24fc60b55265c8675ba0bc0fc27ba7a3466ffee3 100644 (file)
@@ -48,7 +48,7 @@ void ControlInclude::clearParams()
 void ControlInclude::dispatchParams()
 {
        InsetInclude::Params p = params();
-       string const lfun = InsetIncludeMailer::params2string("include", p);
+       string const lfun = InsetIncludeMailer::params2string(p);
        kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
 
diff --git a/src/frontends/controllers/ControlIndex.C b/src/frontends/controllers/ControlIndex.C
deleted file mode 100644 (file)
index 1b1a652..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * \file ControlIndex.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#include <config.h>
-
-
-#include "ControlIndex.h"
-
-
-ControlIndex::ControlIndex(Dialog & d)
-       : ControlCommand(d, "index")
-{}
diff --git a/src/frontends/controllers/ControlIndex.h b/src/frontends/controllers/ControlIndex.h
deleted file mode 100644 (file)
index 48cc37a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// -*- C++ -*-
-/**
- * \file ControlIndex.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#ifndef CONTROLINDEX_H
-#define CONTROLINDEX_H
-
-
-#include "ControlCommand.h"
-
-/** A controller for Index dialogs.
- */
-class ControlIndex : public ControlCommand {
-public:
-       ///
-       ControlIndex(Dialog &);
-};
-
-#endif // CONTROLINDEX_H
diff --git a/src/frontends/controllers/ControlLabel.C b/src/frontends/controllers/ControlLabel.C
deleted file mode 100644 (file)
index ba842e1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * \file ControlLabel.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#include <config.h>
-
-
-#include "ControlLabel.h"
-
-
-ControlLabel::ControlLabel(Dialog & d)
-       : ControlCommand(d, "label")
-{}
diff --git a/src/frontends/controllers/ControlLabel.h b/src/frontends/controllers/ControlLabel.h
deleted file mode 100644 (file)
index bd06578..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// -*- C++ -*-
-/**
- * \file ControlLabel.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#ifndef CONTROLLABEL_H
-#define CONTROLLABEL_H
-
-
-#include "ControlCommand.h"
-
-/** A controller for Label dialogs.
- */
-class ControlLabel : public ControlCommand {
-public:
-       ///
-       ControlLabel(Dialog &);
-};
-
-#endif // CONTROLLABEL_H
index 42d0afd684761f984fd0bfbb2155f7289df8193c..49d305ce6d251b93286e4ee29ec78ea214e768d7 100644 (file)
 
 #include <config.h>
 
-
 #include "ControlMinipage.h"
-#include "BufferView.h"
+#include "funcrequest.h"
 
 
-ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
-       : ControlInset<InsetMinipage, MinipageParams>(lv, d)
+ControlMinipage::ControlMinipage(Dialog & parent)
+       : Dialog::Controller(parent)
 {}
 
 
-void ControlMinipage::applyParamsToInset()
-{
-       inset()->pageWidth(params().pageWidth);
-       inset()->pos(params().pos);
-
-       bufferview()->updateInset(inset(), true);
-}
-
-
-void ControlMinipage::applyParamsNoInset()
-{
-}
-
-
-MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
+void ControlMinipage::initialiseParams(string const & data)
 {
-       return MinipageParams(inset);
+       InsetMinipage::Params params;
+       InsetMinipageMailer::string2params(data, params);
+       params_.reset(new InsetMinipage::Params(params));
 }
 
 
-MinipageParams::MinipageParams()
-       : pos(InsetMinipage::top)
-{}
-
-
-MinipageParams::MinipageParams(InsetMinipage const & inset)
-       : pageWidth(inset.pageWidth()), pos(inset.pos())
-{}
-
-
-bool operator==(MinipageParams const & p1, MinipageParams const & p2)
+void ControlMinipage::clearParams()
 {
-       return (p1.pageWidth == p2.pageWidth && p1.pos == p2.pos);
+       params_.reset();
 }
 
 
-bool operator!=(MinipageParams const & p1, MinipageParams const & p2)
+void ControlMinipage::dispatchParams()
 {
-       return !(p1 == p2);
+       string const lfun = InsetMinipageMailer::params2string(params());
+       kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
index dd355769c9e2ed22553df3d9ad69b531ba2fee14..dd938db0ad165bb6cb9b475206546bd237974231 100644 (file)
 #ifndef CONTROLMINIPAGE_H
 #define CONTROLMINIPAGE_H
 
-#include <vector>
+#include "Dialog.h"
+#include "insets/insetminipage.h"
 
-
-#include "ControlInset.h"
-#include "insets/insetminipage.h" // InsetMinipage::Position
-
-/** This should be moved back into insetminipage.h and InsetMinipage should
-    contain an instance of it. */
-
-struct MinipageParams {
+class ControlMinipage : public Dialog::Controller {
+public:
        ///
-       MinipageParams();
+       ControlMinipage(Dialog &);
        ///
-       MinipageParams(InsetMinipage const &);
+       virtual void initialiseParams(string const & data);
+       /// clean-up on hide.
+       virtual void clearParams();
+       /// clean-up on hide.
+       virtual void dispatchParams();
        ///
-       LyXLength pageWidth;
+       virtual bool isBufferDependent() const { return true; }
        ///
-       InsetMinipage::Position pos;
-};
-
-
-///
-bool operator==(MinipageParams const &, MinipageParams const &);
-///
-bool operator!=(MinipageParams const &, MinipageParams const &);
-
-
-/** A controller for Minipage dialogs.
- */
-class ControlMinipage : public ControlInset<InsetMinipage, MinipageParams>  {
-public:
+       InsetMinipage::Params & params() { return *params_.get(); }
        ///
-       ControlMinipage(LyXView &, Dialogs &);
+       InsetMinipage::Params const & params() const { return *params_.get(); }
 private:
-       /// Dispatch the changed parameters to the kernel.
-       virtual void applyParamsToInset();
        ///
-       virtual void applyParamsNoInset();
-       /// get the parameters from the string passed to createInset.
-       virtual MinipageParams const getParams(string const &)
-               { return MinipageParams(); }
-       /// get the parameters from the inset passed to showInset.
-       virtual MinipageParams const getParams(InsetMinipage const &);
+       boost::scoped_ptr<InsetMinipage::Params> params_;
 };
 
 #endif
diff --git a/src/frontends/controllers/ControlUrl.C b/src/frontends/controllers/ControlUrl.C
deleted file mode 100644 (file)
index 7dfe02e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * \file ControlUrl.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#include <config.h>
-
-
-#include "ControlUrl.h"
-
-
-ControlUrl::ControlUrl(Dialog & d)
-       : ControlCommand(d, "url")
-{}
diff --git a/src/frontends/controllers/ControlUrl.h b/src/frontends/controllers/ControlUrl.h
deleted file mode 100644 (file)
index 923860f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// -*- C++ -*-
-/**
- * \file ControlUrl.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS
- */
-
-#ifndef CONTROLURL_H
-#define CONTROLURL_H
-
-
-#include "ControlCommand.h"
-
-/** A controller for the Url Dialog.
- */
-class ControlUrl : public ControlCommand
-{
-public:
-       ///
-       ControlUrl(Dialog &);
-};
-
-#endif // CONTROLURL_H
index fee4b5c624d60dced55a6045509a5fb9dcc94fa2..1d5ce0e333ed1b70b7e907e6f961f7137000dc3c 100644 (file)
@@ -37,6 +37,6 @@ void ControlWrap::clearParams()
 
 void ControlWrap::dispatchParams()
 {
-       string const lfun = InsetWrapMailer::params2string("wrap", params());
+       string const lfun = InsetWrapMailer::params2string(params());
        kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
index 073eb54a63da1b3eab7ead3d70c0642265e9442f..6751859cddf3f1861f22faccd30e4c11329c8651 100644 (file)
@@ -27,8 +27,6 @@ libcontrollers_la_SOURCES= \
        ButtonPolicies.h \
        ControlAboutlyx.C \
        ControlAboutlyx.h \
-       ControlBibitem.C \
-       ControlBibitem.h \
        ControlBibtex.C \
        ControlBibtex.h \
        ControlButtons.C \
@@ -64,11 +62,7 @@ libcontrollers_la_SOURCES= \
        ControlGraphics.h \
        ControlInclude.C \
        ControlInclude.h \
-       ControlIndex.C \
-       ControlIndex.h \
        ControlInset.h \
-       ControlLabel.C \
-       ControlLabel.h \
        ControlLog.C \
        ControlLog.h \
        ControlMath.C \
@@ -103,8 +97,6 @@ libcontrollers_la_SOURCES= \
        ControlThesaurus.h \
        ControlToc.C \
        ControlToc.h \
-       ControlUrl.C \
-       ControlUrl.h \
        ControlVCLog.C \
        ControlVCLog.h \
        ControlWrap.C \
index 88bfa5918e53bbaf75c75ca6243d6c07d903d4e4..de4d6491201eb3a7e0eb409b71c224681f4f4a40 100644 (file)
@@ -75,18 +75,6 @@ void gui_ShowMathPanel(Dialogs & d)
 }
 
 
-void gui_ShowMinipage(InsetMinipage * im, Dialogs & d)
-{
-       d.showMinipage(im);
-}
-
-
-void gui_UpdateMinipage(InsetMinipage * im, Dialogs & d)
-{
-       d.updateMinipage(im);
-}
-
-
 void gui_ShowParagraph(Dialogs & d)
 {
        d.showParagraph();
index 703e8d4ae13a0dff37fca4302e8129ccf5e1524d..6e7a522f741377637536919adf76e40945e3c003 100644 (file)
@@ -17,7 +17,6 @@
 
 class Dialogs;
 class InsetGraphics;
-class InsetMinipage;
 class InsetTabular;
 
 extern "C" {
@@ -33,8 +32,6 @@ void gui_ShowForks(Dialogs &);
 void gui_ShowGraphics(InsetGraphics *, Dialogs &);
 void gui_ShowLogFile(Dialogs &);
 void gui_ShowMathPanel(Dialogs &);
-void gui_ShowMinipage(InsetMinipage *, Dialogs &);
-void gui_UpdateMinipage(InsetMinipage *, Dialogs &);
 void gui_ShowParagraph(Dialogs &);
 void gui_UpdateParagraph(Dialogs &);
 void gui_ShowPreamble(Dialogs &);
index 5ac87ba107511701d02a55657a9901629ef3f735..7e754e89006f0b74b16ace077f803e59047c88d9 100644 (file)
@@ -1,3 +1,20 @@
+2003-03-07  Angus Leeming  <leeming@lyx.org>
+
+       * Dialogs.C:
+       * Dialogs2.C:
+       * Dialogs_impl.h: remove minipage dialog.
+
+       * Dialogs3.C: add minipage dialog. No longer use the bibitem, include,
+       label or url controllers; use ControlCommand instead.
+
+       * QBibitem.[Ch]:
+       * QIndex.[Ch]:
+       * QURL.[Ch]: changes due to use of ControlCommand, above
+
+       * QBibitemDialog.C: no need to include controller.
+
+       * QMinipage.[Ch]: changes to use the new Dialog-based scheme.
+
 2003-03-06  Alfredo Braunstein  <abraunst@libero.it>
 
        * qscreen.C: use LyXText::top_y() instead of LyXText::first_y
index 6beaf4fcf9b6bff179181e377f83d6f3158a76d5..58f3987104c1368ebf6e222039d1232af8b3ee7f 100644 (file)
@@ -33,7 +33,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
          file(lv, d),
          graphics(lv, d),
          logfile(lv, d),
-         minipage(lv, d),
          paragraph(lv, d),
          prefs(lv, d),
          print(lv, d),
index e06691eb0a92657794e8ff8cc76666f40d1902e1..45ad0bdee45a34cc080a63bf0a4471800f577782 100644 (file)
@@ -76,18 +76,6 @@ void Dialogs::showMathPanel()
 }
 
 
-void Dialogs::showMinipage(InsetMinipage * im)
-{
-       pimpl_->minipage.controller().showInset(im);
-}
-
-
-void Dialogs::updateMinipage(InsetMinipage * im)
-{
-       pimpl_->minipage.controller().showInset(im);
-}
-
-
 void Dialogs::showParagraph()
 {
        pimpl_->paragraph.controller().show();
index d524dca92dcb480d01290d4d5b5f70767cc7ad1c..a919a669458577efff76b47b009b667af78a08d2 100644 (file)
@@ -13,7 +13,6 @@
 #include "Dialogs.h"
 #include "Dialog.h"
 
-#include "ControlBibitem.h"
 #include "ControlBibtex.h"
 #include "ControlCitation.h"
 #include "ControlError.h"
 #include "ControlExternal.h"
 #include "ControlFloat.h"
 #include "ControlInclude.h"
-#include "ControlIndex.h"
-#include "ControlLabel.h"
+#include "ControlMinipage.h"
 #include "ControlRef.h"
 #include "ControlToc.h"
-#include "ControlUrl.h"
 #include "ControlWrap.h"
 
 #include "QBibitem.h"
@@ -50,6 +47,8 @@
 #include "QIncludeDialog.h"
 #include "QIndex.h"
 #include "QIndexDialog.h"
+#include "QMinipage.h"
+#include "QMinipageDialog.h"
 #include "QRef.h"
 #include "QRefDialog.h"
 #include "QToc.h"
@@ -80,8 +79,8 @@ namespace {
 
 char const * const dialognames[] = { "bibitem", "bibtex", "citation",
                                     "error", "ert", "external", "float",
-                                    "include", "index", "label", "ref",
-                                    "toc", "url", "wrap" };
+                                    "include", "index", "label", "minipage",
+                                    "ref", "toc", "url", "wrap" };
 
 char const * const * const end_dialognames =
        dialognames + (sizeof(dialognames) / sizeof(char *));
@@ -114,7 +113,7 @@ Dialog * Dialogs::build(string const & name)
        Dialog * dialog = new Dialog(lyxview_, name);
 
        if (name == "bibitem") {
-               dialog->setController(new ControlBibitem(*dialog));
+               dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new QBibitem(*dialog));
                dialog->setButtonController(new OkCancelReadOnlyBC);
        } else if (name == "bibtex") {
@@ -146,17 +145,21 @@ Dialog * Dialogs::build(string const & name)
                dialog->setView(new QInclude(*dialog));
                dialog->setButtonController(new OkApplyCancelReadOnlyBC);
        } else if (name == "index") {
-               dialog->setController(new ControlIndex(*dialog));
+               dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new QIndex(*dialog,
                                           qt_("LyX: Insert Index Entry"),
                                           qt_("&Keyword")));
                dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
        } else if (name == "label") {
-               dialog->setController(new ControlLabel(*dialog));
+               dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new QIndex(*dialog,
                                           qt_("LyX: Insert Label"),
                                           qt_("&Label")));
                dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
+       } else if (name == "minipage") {
+               dialog->setController(new ControlMinipage(*dialog));
+               dialog->setView(new QMinipage(*dialog));
+               dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
        } else if (name == "ref") {
                dialog->setController(new ControlRef(*dialog));
                dialog->setView(new QRef(*dialog));
@@ -166,7 +169,7 @@ Dialog * Dialogs::build(string const & name)
                dialog->setView(new QToc(*dialog));
                dialog->setButtonController(new OkCancelBC);
        } else if (name == "url") {
-               dialog->setController(new ControlUrl(*dialog));
+               dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new QURL(*dialog));
                dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
        } else if (name == "wrap") {
index 0fc882c9d0f6ca2d466d09e97985d358d7253dae..ad6339edbd8b26e7a82ae22a692e85e13ec4564a 100644 (file)
@@ -22,7 +22,6 @@
 #include "ControlGraphics.h"
 #include "insets/insetgraphicsParams.h"
 #include "ControlLog.h"
-#include "ControlMinipage.h"
 #include "ControlParagraph.h"
 #include "ControlPrefs.h"
 #include "ControlPrint.h"
@@ -52,8 +51,6 @@
 #include "QGraphicsDialog.h"
 #include "QLog.h"
 #include "QLogDialog.h"
-#include "QMinipage.h"
-#include "QMinipageDialog.h"
 #include "QParagraph.h"
 #include "QParagraphDialog.h"
 #include "QPrefs.h"
@@ -109,9 +106,6 @@ GraphicsDialog;
 typedef GUI<ControlLog, QLog, OkCancelPolicy, Qt2BC>
 LogFileDialog;
 
-typedef GUI<ControlMinipage, QMinipage, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
-MinipageDialog;
-
 typedef GUI<ControlParagraph, QParagraph, OkApplyCancelReadOnlyPolicy, Qt2BC>
 ParagraphDialog;
 
@@ -158,7 +152,6 @@ struct Dialogs::Impl {
        FileDialog          file;
        GraphicsDialog      graphics;
        LogFileDialog       logfile;
-       MinipageDialog      minipage;
        ParagraphDialog     paragraph;
        PrefsDialog         prefs;
        PrintDialog         print;
index 2a86aa04a036506a0f3f535d7b67a85a40fe6658..cb8c61cc6e41bbb7b507701df1cfc23a2180d4e7 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "support/lstrings.h"
 
-#include "ControlBibitem.h"
+#include "ControlCommand.h"
 #include "qt_helpers.h"
 #include "debug.h"
 
@@ -24,7 +24,7 @@
 #include "QBibitem.h"
 #include "Qt2BC.h"
 
-typedef QController<ControlBibitem, QView<QBibitemDialog> > base_class;
+typedef QController<ControlCommand, QView<QBibitemDialog> > base_class;
 
 
 QBibitem::QBibitem(Dialog & parent)
index 12dd72bfc493a4e2a278bf6c5323c3786b5a5fd7..a07b12f9f80c89cb516f70de6e21f6954bdbd207 100644 (file)
 
 #include "QDialogView.h"
 
-class ControlBibitem;
+class ControlCommand;
 class QBibitemDialog;
 
 class QBibitem
-       : public QController<ControlBibitem, QView<QBibitemDialog> >
+       : public QController<ControlCommand, QView<QBibitemDialog> >
 {
 public:
        friend class QBibitemDialog;
index aa5dbe53c54bd39e82f7839987630e75ab26496b..50b7c67d6798421d8416eafdf09db216549ecbdd 100644 (file)
@@ -10,9 +10,6 @@
 
 #include <config.h>
 
-
-#include "ControlBibitem.h"
-
 #include <qpushbutton.h>
 #include <qlineedit.h>
 
index 97cce54613156d7d07874b0fbc1be81ee039811b..2eceecf78313e97c1fb2628ba4b25d1dee113e50 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 
-#include "ControlIndex.h"
+#include "ControlCommand.h"
 #include "qt_helpers.h"
 
 #include "QIndexDialog.h"
index 04f7505484e8f89b9e49d3401cfb326634896ef0..7ab69fcfac0f298ce4229699277f3f01547fe043 100644 (file)
 #include <qcombobox.h>
 #include <qlineedit.h>
 
-typedef Qt2CB<ControlMinipage, Qt2DB<QMinipageDialog> > base_class;
+typedef QController<ControlMinipage, QView<QMinipageDialog> > base_class;
 
 
-QMinipage::QMinipage()
-       : base_class(qt_("LyX: Minipage Settings"))
+QMinipage::QMinipage(Dialog & parent)
+       : base_class(parent, qt_("LyX: Minipage Settings"))
 {
 }
 
@@ -57,9 +57,9 @@ void QMinipage::apply()
        if (dialog_->widthED->text().isEmpty())
                unit = LyXLength::UNIT_NONE;
 
-       MinipageParams & params = controller().params();
+       InsetMinipage::Params & params = controller().params();
 
-       params.pageWidth = LyXLength(value, unit);
+       params.width = LyXLength(value, unit);
 
        switch (dialog_->valignCO->currentItem()) {
        case 0:
@@ -90,9 +90,9 @@ string const numtostr(double val)
 
 void QMinipage::update_contents()
 {
-       MinipageParams const & params = controller().params();
+       InsetMinipage::Params const & params = controller().params();
 
-       LyXLength len(params.pageWidth);
+       LyXLength len(params.width);
        dialog_->widthED->setText(toqstr(numtostr(len.value())));
        dialog_->unitsLC->setCurrentItem(len.unit());
        lyxerr << "width " << numtostr(len.value())
index 27805c79110bb1a277238c2b9c4b71a98242d8b9..d39474a7cea4578c40ba971f6ab48dc241696cac 100644 (file)
 #define QMINIPAGE_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
+
 
 class ControlMinipage;
 class QMinipageDialog;
 
 ///
 class QMinipage
-       : public Qt2CB<ControlMinipage, Qt2DB<QMinipageDialog> >
+       : public QController<ControlMinipage, QView<QMinipageDialog> >
 {
 public:
        ///
        friend class QMinipageDialog;
        ///
-       QMinipage();
+       QMinipage(Dialog &);
 private:
        /// Apply changes
        virtual void apply();
index 1c4b77fb9176b204318d7469a2dc63b85bf039d5..4201e4a82e54ad5c7ea6dae5d5515393012eb98e 100644 (file)
@@ -10,8 +10,7 @@
 
 #include <config.h>
 
-
-#include "ControlUrl.h"
+#include "ControlCommand.h"
 #include "debug.h"
 #include "qt_helpers.h"
 
@@ -23,8 +22,7 @@
 #include <qpushbutton.h>
 #include <qlineedit.h>
 
-typedef QController<ControlUrl, QView<QURLDialog> > base_class;
-
+typedef QController<ControlCommand, QView<QURLDialog> > base_class;
 
 QURL::QURL(Dialog & parent)
        : base_class(parent, qt_("LyX: Insert URL"))
index 4a61ce9ca76d8e07c57cfc484b6cb689cdb154d4..5a6c2895986b92858060dedfcbc5b96745fc884b 100644 (file)
 
 #include "QDialogView.h"
 
-class ControlUrl;
+class ControlCommand;
 class QURLDialog;
 
 
 class QURL :
-       public QController<ControlUrl, QView<QURLDialog> >
+       public QController<ControlCommand, QView<QURLDialog> >
 {
 public:
        friend class QURLDialog;
index e2b18b5d34a6e834f9575366d8a9023161632005..85e6838cc58f095e691c49498ae244852fd24702 100644 (file)
@@ -1,3 +1,18 @@
+2003-03-07  Angus Leeming  <leeming@lyx.org>
+
+       * Dialogs.C:
+       * Dialogs2.C:
+       * Dialogs_impl.h: remove minipage dialog.
+
+       * Dialogs3.C: add minipage dialog. No longer use the bibitem, include,
+       label or url controllers; use ControlCommand instead.
+
+       * FormBibitem.[Ch]:
+       * FormIndex.[Ch]: changes due to use of ControlCommand, above
+
+       * FormMinipage.[Ch]:
+       * forms/form_minipage.fd: changes to use the new Dialog-based scheme.
+
 2003-03-06  Alfredo Braunstein  <abraunst@libero.it>
 
        * xscreen.C: use LyXText::top_y() instead of LyXText::first_y
index e5f6843a5726f06cab1123c61ccb903bbd4ccb8a..7c900ac5b0ca7494395ee3252f7cbbd56702b79c 100644 (file)
@@ -35,7 +35,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
          graphics(lv, d),
          logfile(lv, d),
          mathpanel(lv, d),
-         minipage(lv, d),
          paragraph(lv, d),
          preamble(lv, d),
          preferences(lv, d),
index d911e5d276b6764e95e40118186aaca02d97c649..2b0913266a61d4d06cdbc4984d2ce33c6720a838 100644 (file)
@@ -75,18 +75,6 @@ void Dialogs::showMathPanel()
 }
 
 
-void Dialogs::showMinipage(InsetMinipage * im)
-{
-       pimpl_->minipage.controller().showInset(im);
-}
-
-
-void Dialogs::updateMinipage(InsetMinipage * im)
-{
-       pimpl_->minipage.controller().showInset(im);
-}
-
-
 void Dialogs::showParagraph()
 {
        pimpl_->paragraph.controller().show();
index 482c99513986b8374b51babb594a0e15707c4a02..d77daafb03475d365b60396f04afc43f4acf2657 100644 (file)
 
 #include "Tooltips.h"
 
-#include "ControlBibitem.h"
+#include "ControlBibtex.h"
+#include "ControlCitation.h"
+#include "ControlCommand.h"
+#include "ControlError.h"
+#include "ControlERT.h"
+#include "ControlExternal.h"
+#include "ControlFloat.h"
+#include "ControlInclude.h"
+#include "ControlMinipage.h"
+#include "ControlRef.h"
+#include "ControlToc.h"
+#include "ControlWrap.h"
+
 #include "FormBibitem.h"
 #include "forms/form_bibitem.h"
-
-#include "ControlBibtex.h"
 #include "FormBibtex.h"
 #include "forms/form_bibtex.h"
-
-#include "ControlCitation.h"
 #include "FormCitation.h"
 #include "forms/form_citation.h"
-
-#include "ControlError.h"
 #include "FormError.h"
 #include "forms/form_error.h"
-
-#include "ControlERT.h"
 #include "FormERT.h"
 #include "forms/form_ert.h"
-
-#include "ControlExternal.h"
 #include "FormExternal.h"
 #include "forms/form_external.h"
-
-#include "ControlFloat.h"
 #include "FormFloat.h"
 #include "forms/form_float.h"
-
-#include "ControlInclude.h"
 #include "FormInclude.h"
 #include "forms/form_include.h"
-
-#include "ControlIndex.h"
-#include "ControlLabel.h"
-
-#include "FormText.h"
-#include "forms/form_text.h"
-
-#include "ControlRef.h"
+#include "FormMinipage.h"
+#include "forms/form_minipage.h"
 #include "FormRef.h"
 #include "forms/form_ref.h"
-
-#include "ControlToc.h"
+#include "FormText.h"
+#include "forms/form_text.h"
 #include "FormToc.h"
 #include "forms/form_toc.h"
-
-#include "ControlUrl.h"
 #include "FormUrl.h"
 #include "forms/form_url.h"
-
-#include "ControlWrap.h"
 #include "FormWrap.h"
 #include "forms/form_wrap.h"
 
@@ -95,8 +83,8 @@ namespace {
 //                                  "url", "wrap" };
 char const * const dialognames[] = { "bibitem", "bibtex", "citation",
                                     "error", "ert", "external", "float",
-                                    "include", "index", "label", "ref",
-                                    "toc", "url", "wrap" };
+                                    "include", "index", "label", "minipage",
+                                    "ref", "toc", "url", "wrap" };
 
 char const * const * const end_dialognames =
        dialognames + (sizeof(dialognames) / sizeof(char *));
@@ -129,7 +117,7 @@ Dialog * Dialogs::build(string const & name)
        Dialog * dialog = new Dialog(lyxview_, name);
 
        if (name == "bibitem") {
-               dialog->setController(new ControlBibitem(*dialog));
+               dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new FormBibitem(*dialog));
                dialog->setButtonController(new OkCancelReadOnlyBC);
        } else if (name == "bibtex") {
@@ -161,15 +149,19 @@ Dialog * Dialogs::build(string const & name)
                dialog->setView(new FormInclude(*dialog));
                dialog->setButtonController(new OkApplyCancelReadOnlyBC);
        } else if (name == "index") {
-               dialog->setController(new ControlIndex(*dialog));
+               dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new FormText(*dialog,
                                             _("Index"), _("Keyword:|#K")));
                dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
        } else if (name == "label") {
-               dialog->setController(new ControlLabel(*dialog));
+               dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new FormText(*dialog,
                                             _("Label"), _("Label:|#L")));
                dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
+       } else if (name == "minipage") {
+               dialog->setController(new ControlMinipage(*dialog));
+               dialog->setView(new FormMinipage(*dialog));
+               dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
        } else if (name == "ref") {
                dialog->setController(new ControlRef(*dialog));
                dialog->setView(new FormRef(*dialog));
@@ -179,7 +171,7 @@ Dialog * Dialogs::build(string const & name)
                dialog->setView(new FormToc(*dialog));
                dialog->setButtonController(new OkCancelBC);
        } else if (name == "url") {
-               dialog->setController(new ControlUrl(*dialog));
+               dialog->setController(new ControlCommand(*dialog, name));
                dialog->setView(new FormUrl(*dialog));
                dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
        } else if (name == "wrap") {
index 5871881734c76758a873f9b526763027ddb5d828..553a04ab3c2240e3893b5def16906e3b90b5bebc 100644 (file)
 #include "FormMathsPanel.h"
 #include "forms/form_maths_panel.h"
 
-#include "ControlMinipage.h"
-#include "FormMinipage.h"
-#include "forms/form_minipage.h"
-
 #include "ControlParagraph.h"
 #include "FormParagraph.h"
 #include "forms/form_paragraph.h"
@@ -135,9 +131,6 @@ LogFileDialog;
 typedef GUI<ControlMath, FormMathsPanel, OkCancelReadOnlyPolicy, xformsBC>
 MathPanelDialog;
 
-typedef GUI<ControlMinipage, FormMinipage, NoRepeatedApplyReadOnlyPolicy, xformsBC>
-MinipageDialog;
-
 typedef GUI<ControlParagraph, FormParagraph, OkApplyCancelReadOnlyPolicy, xformsBC>
 ParagraphDialog;
 
@@ -188,7 +181,6 @@ struct Dialogs::Impl {
        GraphicsDialog      graphics;
        LogFileDialog       logfile;
        MathPanelDialog     mathpanel;
-       MinipageDialog      minipage;
        ParagraphDialog     paragraph;
        PreambleDialog      preamble;
        PreferencesDialog   preferences;
index 791687a0c33030a43ce6bbd0b0e9af1d0c8d9efb..cff49ed92afa3b8728516945c373f741cf32e7a3 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <config.h>
 #include "xformsBC.h"
-#include "ControlBibitem.h"
+#include "ControlCommand.h"
 #include "FormBibitem.h"
 #include "Tooltips.h"
 #include "forms/form_bibitem.h"
@@ -20,7 +20,7 @@
 #include "gettext.h"
 #include "support/lstrings.h" // compare
 
-typedef FormController<ControlBibitem, FormView<FD_bibitem> > base_class;
+typedef FormController<ControlCommand, FormView<FD_bibitem> > base_class;
 
 FormBibitem::FormBibitem(Dialog & parent)
        : base_class(parent, _("Bibliography Entry"))
index 9206642d9060bd757841addda3f87d203c0eb02f..e83de9aa441cf438c5a68f34274ac880ff659a35 100644 (file)
 
 #include "FormDialogView.h"
 
-class ControlBibitem;
+class ControlCommand;
 struct FD_bibitem;
 
 /**
  * For bibliography entry editing
  */
-class FormBibitem : public FormController<ControlBibitem, FormView<FD_bibitem> > {
+class FormBibitem : public FormController<ControlCommand, FormView<FD_bibitem> > {
 public:
        ///
        FormBibitem(Dialog &);
index d22872bacdda9ee2c3e8052404730a2ccc1d42f2..a9716d091ddcd49a6d57986193f3ab58dff1fad8 100644 (file)
 #include "xforms_helpers.h"
 #include FORMS_H_LOCATION
 
-typedef FormCB<ControlMinipage, FormDB<FD_minipage> > base_class;
+typedef FormController<ControlMinipage, FormView<FD_minipage> > base_class;
 
-FormMinipage::FormMinipage()
-       : base_class(_("Minipage Options"))
+FormMinipage::FormMinipage(Dialog & parent)
+       : base_class(parent, _("Minipage Options"))
 {}
 
 
@@ -57,7 +57,7 @@ void FormMinipage::build()
 
 void FormMinipage::apply()
 {
-       controller().params().pageWidth =
+       controller().params().width =
                LyXLength(getLengthFromWidgets(dialog_->input_width,
                                               dialog_->choice_width_units));
 
@@ -72,7 +72,7 @@ void FormMinipage::apply()
 
 void FormMinipage::update()
 {
-       LyXLength len(controller().params().pageWidth);
+       LyXLength len(controller().params().width);
        fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
        fl_set_choice(dialog_->choice_width_units, len.unit() + 1);
 
index 4378b7a61422d6ae0c5a0e634896fc5dcac970ec..cef758199cbd0f462c87833d478ec75dbe9d5bcf 100644 (file)
@@ -12,8 +12,7 @@
 #ifndef FORMMINIPAGE_H
 #define FORMMINIPAGE_H
 
-
-#include "FormBase.h"
+#include "FormDialogView.h"
 
 class ControlMinipage;
 struct FD_minipage;
@@ -22,10 +21,10 @@ struct FD_minipage;
     Dialog.
  */
 class FormMinipage
-       : public FormCB<ControlMinipage, FormDB<FD_minipage> > {
+       : public FormController<ControlMinipage, FormView<FD_minipage> > {
 public:
        ///
-       FormMinipage();
+       FormMinipage(Dialog &);
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
index 3426122bc80b272c96a75b06e61943aa9f7db1f7..49c098ab0da688d790e9af4371c83cc9277303e6 100644 (file)
 
 
 #include "xformsBC.h"
-#include "ControlUrl.h"
+#include "ControlCommand.h"
 #include "FormUrl.h"
 #include "forms/form_url.h"
 #include FORMS_H_LOCATION
 
-typedef FormController<ControlUrl, FormView<FD_url> > base_class;
+typedef  FormController<ControlCommand, FormView<FD_url> > base_class;
 
 FormUrl::FormUrl(Dialog & parent)
        : base_class(parent, _("Url"))
index 417440dbbb1b7ebe5e63d65ec1fd841fa51bb327..56d85aa2e5b0e52da43c45102292af69ad0d79b2 100644 (file)
 
 #include "FormDialogView.h"
 
-class ControlUrl;
+class ControlCommand;
 struct FD_url;
 
 /** This class provides an XForms implementation of the Url Dialog.
  */
-class FormUrl : public FormController<ControlUrl, FormView<FD_url> > {
+class FormUrl : public FormController<ControlCommand, FormView<FD_url> > {
 public:
        ///
        FormUrl(Dialog &);
index 2cb49aee5ec2a38150620dcb7546c42585d8f3ea..05736ff3df6d2085a130479535f8b62e21e651df 100644 (file)
@@ -81,7 +81,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: input_width
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
@@ -99,7 +99,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: choice_width_units
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
@@ -135,7 +135,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_top
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
@@ -153,7 +153,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_middle
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
@@ -171,7 +171,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_bottom
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
@@ -207,7 +207,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 --------------------
@@ -225,7 +225,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
 argument: 0
 
 --------------------
@@ -243,7 +243,7 @@ shortcut: ^M
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
 argument: 0
 
 --------------------
@@ -261,7 +261,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_restore
-callback: C_FormBaseRestoreCB
+callback: C_FormDialogView_RestoreCB
 argument: 0
 
 --------------------
index 68147b94664d7548bd5dc6b2af3bb294a88ed7b5..707254bd9f0cb9d817ccf6d02bb79a0a3d4658c8 100644 (file)
@@ -1,3 +1,20 @@
+2003-03-07  Angus Leeming  <leeming@lyx.org>
+
+       * insetcommand.C (string2params):
+       * insetexternal.C (string2params):
+       * insetfloat.C (string2params):
+       * insetinclude.C (string2params):
+       * insetwrap.C (string2params): use LyXLeX more.
+
+       * insetert.[Ch]:
+       * insetexternal.[Ch]:
+       * insetfloat.[Ch]:
+       * insetinclude.[Ch]:
+       * insetwrap.[Ch]: change Mailer::name_ to be static.
+
+       * insetminipage.[Ch]: define a new class InsetMinipageMailer and use
+       it to communicate with the frontend dialogs.
+
 2003-03-06  Alfredo Braunstein  <abraunst@libero.it>
 
        * insettext.C:
index b0be308fea1a60821c05e0d18573bb4cd1a09096..d1d51ece82cb0d3fac339eb35c39f5d5b0e62b35 100644 (file)
@@ -101,16 +101,15 @@ void InsetCommandMailer::string2params(string const & in,
        params.setContents(string());
        params.setOptions(string());
 
-       string name;
-       string body = split(in, name, ' ');
-
-       if (body.empty())
-               return;
-
-       istringstream data(body);
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
 
+       if (lex.isOK()) {
+               lex.next();
+               string const name = lex.getString();
+       }
+
        params.read(lex);
 }
 
index ae0eda8f9fd55ea08cf986f022fa75c9b8832599..a4807b046fa063e5eedb942acceb92f91e86930f 100644 (file)
@@ -740,14 +740,16 @@ void InsetERT::update(BufferView * bv, LyXFont const & font,
 }
 
 
+string const InsetERTMailer::name_("ert");
+
 InsetERTMailer::InsetERTMailer(InsetERT & inset)
-       : name_("ert"), inset_(inset)
+       : inset_(inset)
 {}
 
 
 string const InsetERTMailer::inset2string() const
 {
-       return params2string(name(), inset_.status());
+       return params2string(inset_.status());
 }
 
 
@@ -767,7 +769,7 @@ void InsetERTMailer::string2params(string const & in,
 
 
 string const
-InsetERTMailer::params2string(string const & name, InsetERT::ERTStatus status)
+InsetERTMailer::params2string(InsetERT::ERTStatus status)
 {
-       return name + ' ' + tostr(status);
+       return name_ + ' ' + tostr(status);
 }
index 4d874eaf7b28b4473b8e40c67d784c948f69def4..1a1cc59c0d90c4628861fbb515d7034de06cb838 100644 (file)
@@ -167,11 +167,10 @@ public:
        ///
        static void string2params(string const &, InsetERT::ERTStatus &);
        ///
-       static string const params2string(string const & name,
-                                         InsetERT::ERTStatus);
+       static string const params2string(InsetERT::ERTStatus);
 private:
        ///
-       string const name_;
+       static string const name_;
        ///
        InsetERT & inset_;
 };
index a58941e7b31d116e6c1d9de4647784c902838d2d..02e94a059df18041c1372505ac77f5ef816ca837 100644 (file)
@@ -360,15 +360,16 @@ bool operator!=(InsetExternal::Params const & left,
 }
 
 
+string const InsetExternalMailer::name_("external");
+
 InsetExternalMailer::InsetExternalMailer(InsetExternal & inset)
-       : name_("external"), inset_(inset)
+       : inset_(inset)
 {}
 
 
 string const InsetExternalMailer::inset2string() const
 {
-       
-       return params2string(name(), inset_.params());
+       return params2string(inset_.params());
 }
 
 
@@ -377,21 +378,25 @@ void InsetExternalMailer::string2params(string const & in,
 {
        params = InsetExternal::Params();
 
-       string name;
-       string body = split(in, name, ' ');
+       istringstream data(in);
+       LyXLex lex(0,0);
+       lex.setStream(data);
 
-       if (name != "external" || body.empty())
-               return;
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != name_)
+                       return;
+       }
 
        // This is part of the inset proper that is usually swallowed
        // by Buffer::readInset
-       body = split(body, name, ' ');
-       if (name != "External")
-               return;
-
-       istringstream data(body);
-       LyXLex lex(0,0);
-       lex.setStream(data);
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != "External")
+                       return;
+       }
 
        InsetExternal inset;    
        inset.read(0, lex);
@@ -400,13 +405,12 @@ void InsetExternalMailer::string2params(string const & in,
 
 
 string const
-InsetExternalMailer::params2string(string const & name,
-                                  InsetExternal::Params const & params)
+InsetExternalMailer::params2string(InsetExternal::Params const & params)
 {
        InsetExternal inset;
        inset.setFromParams(params);
        ostringstream data;
-       data << name << ' ';
+       data << name_ << ' ';
        inset.write(0, data);
        data << "\\end_inset\n";
 
index a2665ec1e62258fa7696ef7a3bab81d3f0426875..31e3a8275c01098ffb1ecab5a5edfad18585d91d 100644 (file)
@@ -143,11 +143,10 @@ public:
        ///
        static void string2params(string const &, InsetExternal::Params &);
        ///
-       static string const params2string(string const & name,
-                                         InsetExternal::Params const &);
+       static string const params2string(InsetExternal::Params const &);
 private:
        ///
-       string const name_;
+       static string const name_;
        ///
        InsetExternal & inset_;
 };
index 0293a8032702abcf3b1ceed7d3ad8817a91deddf..2eddcad7794d65543bc9d70e0e23034ea9eb737a 100644 (file)
@@ -395,14 +395,16 @@ void InsetFloat::addToToc(toc::TocList & toclist, Buffer const * buf) const
 }
 
 
+string const InsetFloatMailer::name_("float");
+
 InsetFloatMailer::InsetFloatMailer(InsetFloat & inset)
-       : name_("float"), inset_(inset)
+       : inset_(inset)
 {}
 
 
 string const InsetFloatMailer::inset2string() const
 {
-       return params2string(name(), inset_.params());
+       return params2string(inset_.params());
 }
 
 
@@ -411,32 +413,35 @@ void InsetFloatMailer::string2params(string const & in,
 {
        params = InsetFloatParams();
 
-       string name;
-       string body = split(in, name, ' ');
+       istringstream data(in);
+       LyXLex lex(0,0);
+       lex.setStream(data);
 
-       if (name != "float" || body.empty())
-               return;
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != name_)
+                       return;
+       }
 
        // This is part of the inset proper that is usually swallowed
        // by Buffer::readInset
-       body = split(body, name, '\n');
-       if (!prefixIs(name, "Float "))
-               return;
-
-       istringstream data(body);
-       LyXLex lex(0,0);
-       lex.setStream(data);
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != "Float" || !lex.eatLine())
+                       return;
+       }
 
        params.read(lex);
 }
 
 
 string const
-InsetFloatMailer::params2string(string const & name,
-                               InsetFloatParams const & params)
+InsetFloatMailer::params2string(InsetFloatParams const & params)
 {
        ostringstream data;
-       data << name << ' ';
+       data << name_ << ' ';
        params.write(data);
 
        return data.str();
index 944f59e2fabbb76b399545b6d109b9659bb820d4..38fc1284af5d2924edacb4605c152692d13ae661 100644 (file)
@@ -108,11 +108,10 @@ public:
        ///
        static void string2params(string const &, InsetFloatParams &);
        ///
-       static string const params2string(string const & name,
-                                         InsetFloatParams const &);
+       static string const params2string(InsetFloatParams const &);
 private:
        ///
-       string const name_;
+       static string const name_;
        ///
        InsetFloat & inset_;
 };
index 9cafae74d5e3d669087b366e1fde0499cf1a73b8..30ba271416dc5c1811fccec23f4b18f054b71b64 100644 (file)
@@ -610,14 +610,16 @@ void InsetInclude::PreviewImpl::restartLoading()
 }
 
 
+string const InsetIncludeMailer::name_("include");
+
 InsetIncludeMailer::InsetIncludeMailer(InsetInclude & inset)
-       : name_("include"), inset_(inset)
+       : inset_(inset)
 {}
 
 
 string const InsetIncludeMailer::inset2string() const
 {
-       return params2string(name(), inset_.params());
+       return params2string(inset_.params());
 }
 
 
@@ -626,21 +628,25 @@ void InsetIncludeMailer::string2params(string const & in,
 {
        params = InsetInclude::Params();
 
-       string name;
-       string body = split(in, name, ' ');
+       istringstream data(in);
+       LyXLex lex(0,0);
+       lex.setStream(data);
 
-       if (name != "include" || body.empty())
-               return;
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != name_)
+                       return;
+       }
 
        // This is part of the inset proper that is usually swallowed
        // by Buffer::readInset
-       body = split(body, name, ' ');
-       if (name != "Include")
-               return;
-
-       istringstream data(body);
-       LyXLex lex(0,0);
-       lex.setStream(data);
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != "Include")
+                       return;
+       }
 
        InsetInclude inset(params);     
        inset.read(0, lex);
@@ -649,13 +655,12 @@ void InsetIncludeMailer::string2params(string const & in,
 
 
 string const
-InsetIncludeMailer::params2string(string const & name,
-                                 InsetInclude::Params const & params)
+InsetIncludeMailer::params2string(InsetInclude::Params const & params)
 {
        InsetInclude inset(params);
        inset.set(params);
        ostringstream data;
-       data << name << ' ';
+       data << name_ << ' ';
        inset.write(0, data);
        data << "\\end_inset\n";
 
index 4c26ce769367a65898a97f9487aad013042d955b..8a57c739fbd0e09cccb3fe75269ea0a792b6594c 100644 (file)
@@ -164,11 +164,10 @@ public:
        ///
        static void string2params(string const &, InsetInclude::Params &);
        ///
-       static string const params2string(string const & name,
-                                         InsetInclude::Params const &);
+       static string const params2string(InsetInclude::Params const &);
 private:
        ///
-       string const name_;
+       static string const name_;
        ///
        InsetInclude & inset_;
 };
index f2a439e1805d30eaf64c8e5f4b5d7fdff48dc571..026c8f40d3b72547a6fbda63d01cfc799ded8de9 100644 (file)
 
 
 #include "insetminipage.h"
+#include "insettext.h"
+
+#include "BufferView.h"
+#include "debug.h"
+#include "funcrequest.h"
 #include "gettext.h"
 #include "lyxfont.h"
-#include "BufferView.h"
+#include "lyxlex.h"
+#include "lyxtext.h"
+
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
-#include "lyxtext.h"
-#include "insets/insettext.h"
+
 #include "support/LOstream.h"
 #include "support/lstrings.h"
-#include "debug.h"
-#include "gettext.h"
-#include "lyxlex.h"
 
 using std::ostream;
 using std::endl;
@@ -59,8 +62,7 @@ using std::endl;
 // (Lgb)
 
 InsetMinipage::InsetMinipage(BufferParams const & bp)
-       : InsetCollapsable(bp), pos_(center),
-         inner_pos_(inner_center), width_(100, LyXLength::PCW)
+       : InsetCollapsable(bp)
 {
        setLabel(_("minipage"));
        LyXFont font(LyXFont::ALL_SANE);
@@ -86,9 +88,7 @@ InsetMinipage::InsetMinipage(BufferParams const & bp)
 
 
 InsetMinipage::InsetMinipage(InsetMinipage const & in, bool same_id)
-       : InsetCollapsable(in, same_id),
-         pos_(in.pos_), inner_pos_(in.inner_pos_),
-         height_(in.height_), width_(in.width_)
+       : InsetCollapsable(in, same_id), params_(in.params_)
 {}
 
 
@@ -100,29 +100,53 @@ Inset * InsetMinipage::clone(Buffer const &, bool same_id) const
 
 InsetMinipage::~InsetMinipage()
 {
-       hideDialog();
+       InsetMinipageMailer mailer(*this);
+       mailer.hideDialog();
 }
 
 
-void InsetMinipage::write(Buffer const * buf, ostream & os) const
+dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
 {
-       os << getInsetName() << '\n'
-          << "position " << pos_ << '\n'
-          << "inner_position " << inner_pos_ << '\n'
-          << "height \"" << height_.asString() << "\"\n"
-          << "width \"" << width_.asString() << "\"\n";
-       InsetCollapsable::write(buf, os);
+       Inset::RESULT result = UNDISPATCHED;
+
+       switch (cmd.action) {
+       case LFUN_INSET_MODIFY: {
+               InsetMinipage::Params params;
+               InsetMinipageMailer::string2params(cmd.argument, params);
+
+               params_.pos   = params.pos;
+               params_.width = params.width;
+
+               cmd.view()->updateInset(this, true);
+               result = DISPATCHED;
+       }
+       break;
+       default:
+               result = InsetCollapsable::localDispatch(cmd);
+       }
+
+       return result;
 }
 
 
-void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
+void InsetMinipage::Params::write(ostream & os) const
+{
+       os << "Minipage" << '\n'
+          << "position " << pos << '\n'
+          << "inner_position " << inner_pos << '\n'
+          << "height \"" << height.asString() << "\"\n"
+          << "width \"" << width.asString() << "\"\n";
+}
+
+
+void InsetMinipage::Params::read(LyXLex & lex)
 {
        if (lex.isOK()) {
                lex.next();
                string const token = lex.getString();
                if (token == "position") {
                        lex.next();
-                       pos_ = static_cast<Position>(lex.getInteger());
+                       pos = static_cast<Position>(lex.getInteger());
                } else {
                        lyxerr << "InsetMinipage::Read: Missing 'position'-tag!"
                                   << endl;
@@ -135,7 +159,7 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
                string const token = lex.getString();
                if (token == "inner_position") {
                        lex.next();
-                       inner_pos_ = static_cast<InnerPosition>(lex.getInteger());
+                       inner_pos = static_cast<InnerPosition>(lex.getInteger());
                } else {
                        lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!"
                                   << endl;
@@ -148,7 +172,7 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
                string const token = lex.getString();
                if (token == "height") {
                        lex.next();
-                       height_ = LyXLength(lex.getString());
+                       height = LyXLength(lex.getString());
                } else {
                        lyxerr << "InsetMinipage::Read: Missing 'height'-tag!"
                                   << endl;
@@ -161,7 +185,7 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
                string const token = lex.getString();
                if (token == "width") {
                        lex.next();
-                       width_ = LyXLength(lex.getString());
+                       width = LyXLength(lex.getString());
                } else {
                        lyxerr << "InsetMinipage::Read: Missing 'width'-tag!"
                                   << endl;
@@ -169,6 +193,19 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
                        lex.pushToken(token);
                }
        }
+}
+
+
+void InsetMinipage::write(Buffer const * buf, ostream & os) const
+{
+       params_.write(os);
+       InsetCollapsable::write(buf, os);
+}
+
+
+void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
+{
+       params_.read(lex);
        InsetCollapsable::read(buf, lex);
 }
 
@@ -180,7 +217,7 @@ int InsetMinipage::ascent(BufferView * bv, LyXFont const & font) const
        else {
                // Take placement into account.
                int i = 0;
-               switch (pos_) {
+               switch (params_.pos) {
                case top:
                        i = InsetCollapsable::ascent(bv, font);
                        break;
@@ -204,7 +241,7 @@ int InsetMinipage::descent(BufferView * bv, LyXFont const & font) const
        else {
                // Take placement into account.
                int i = 0;
-               switch (pos_) {
+               switch (params_.pos) {
                case top:
                        i = InsetCollapsable::descent(bv, font);
                        break;
@@ -231,7 +268,7 @@ int InsetMinipage::latex(Buffer const * buf,
                         ostream & os, bool fragile, bool fp) const
 {
        string s_pos;
-       switch (pos_) {
+       switch (params_.pos) {
        case top:
                s_pos += 't';
                break;
@@ -243,7 +280,7 @@ int InsetMinipage::latex(Buffer const * buf,
                break;
        }
        os << "\\begin{minipage}[" << s_pos << "]{"
-          << width_.asLatexString() << "}%\n";
+          << params_.width.asLatexString() << "}%\n";
 
        int i = inset.latex(buf, os, fragile, fp);
 
@@ -263,14 +300,14 @@ bool InsetMinipage::insetAllowed(Inset::Code code) const
 
 InsetMinipage::Position InsetMinipage::pos() const
 {
-       return pos_;
+       return params_.pos;
 }
 
 
 void InsetMinipage::pos(InsetMinipage::Position p)
 {
-       if (pos_ != p) {
-               pos_ = p;
+       if (params_.pos != p) {
+               params_.pos = p;
                need_update = FULL;
        }
 }
@@ -278,26 +315,26 @@ void InsetMinipage::pos(InsetMinipage::Position p)
 
 InsetMinipage::InnerPosition InsetMinipage::innerPos() const
 {
-       return inner_pos_;
+       return params_.inner_pos;
 }
 
 
 void InsetMinipage::innerPos(InsetMinipage::InnerPosition ip)
 {
-       inner_pos_ = ip;
+       params_.inner_pos = ip;
 }
 
 
 LyXLength const & InsetMinipage::pageHeight() const
 {
-       return height_;
+       return params_.height;
 }
 
 
 void InsetMinipage::pageHeight(LyXLength const & ll)
 {
-       if (height_ != ll) {
-               height_ = ll;
+       if (params_.height != ll) {
+               params_.height = ll;
                need_update = FULL;
        }
 }
@@ -305,14 +342,14 @@ void InsetMinipage::pageHeight(LyXLength const & ll)
 
 LyXLength const & InsetMinipage::pageWidth() const
 {
-       return width_;
+       return params_.width;
 }
 
 
 void InsetMinipage::pageWidth(LyXLength const & ll)
 {
-       if (ll != width_) {
-               width_ = ll;
+       if (ll != params_.width) {
+               params_.width = ll;
                need_update = FULL;
        }
 }
@@ -320,8 +357,12 @@ void InsetMinipage::pageWidth(LyXLength const & ll)
 
 bool InsetMinipage::showInsetDialog(BufferView * bv) const
 {
-       if (!inset.showInsetDialog(bv))
-               bv->owner()->getDialogs().showMinipage(const_cast<InsetMinipage *>(this));
+       if (!inset.showInsetDialog(bv)) {
+               InsetMinipage * tmp = const_cast<InsetMinipage *>(this);
+               InsetMinipageMailer mailer(*tmp);
+               mailer.showDialog();
+       }
+
        return true;
 }
 
@@ -333,7 +374,7 @@ int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
            static_cast<UpdatableInset*>(owner())->getMaxWidth(bv, inset) < 0) {
                return -1;
        }
-       if (!width_.zero()) {
+       if (!params_.width.zero()) {
                int ww1 = latexTextWidth(bv);
                int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
                if (ww2 > 0 && ww2 < ww1) {
@@ -348,5 +389,65 @@ int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
 
 int InsetMinipage::latexTextWidth(BufferView * bv) const
 {
-       return width_.inPixels(InsetCollapsable::latexTextWidth(bv));
+       return params_.width.inPixels(InsetCollapsable::latexTextWidth(bv));
+}
+
+
+InsetMinipage::Params::Params()
+       : pos(center),
+         inner_pos(inner_center),
+         width(100, LyXLength::PCW)
+{}
+
+
+string const InsetMinipageMailer:: name_("minipage");
+
+InsetMinipageMailer::InsetMinipageMailer(InsetMinipage & inset)
+       : inset_(inset)
+{}
+
+
+string const InsetMinipageMailer::inset2string() const
+{
+       return params2string(inset_.params());
+}
+
+
+void InsetMinipageMailer::string2params(string const & in,
+                                       InsetMinipage::Params & params)
+{
+       params = InsetMinipage::Params();
+
+       istringstream data(in);
+       LyXLex lex(0,0);
+       lex.setStream(data);
+
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != "minipage")
+                       return;
+       }
+
+       // This is part of the inset proper that is usually swallowed
+       // by Buffer::readInset
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != "Minipage")
+                       return;
+       }
+
+       params.read(lex);
+}
+
+
+string const
+InsetMinipageMailer::params2string(InsetMinipage::Params const & params)
+{
+       ostringstream data;
+       data << name_ << ' ';
+       params.write(data);
+
+       return data.str();
 }
index 142068e2a0e712364fafd32075adfdcfc053cbb7..f5f5cafada146ec801f0cbd828eade891782d55c 100644 (file)
@@ -17,8 +17,6 @@
 #include "insetcollapsable.h"
 #include "lyxlength.h"
 
-#include <boost/signals/signal0.hpp>
-
 /** The minipage inset
 
 */
@@ -37,6 +35,25 @@ public:
                inner_bottom,
                inner_stretch
        };
+
+       ///
+       struct Params {
+               ///
+               Params();
+               ///
+               Position pos;
+               ///
+               InnerPosition inner_pos;
+               ///
+               LyXLength height;
+               ///
+               LyXLength width;
+               ///
+               void write(std::ostream & os) const;
+               ///
+               void read(LyXLex & lex);
+       };
+
        ///
        InsetMinipage(BufferParams const &);
        ///
@@ -44,6 +61,8 @@ public:
        ///
        ~InsetMinipage();
        ///
+       virtual dispatch_result localDispatch(FuncRequest const & cmd); 
+       ///
        void write(Buffer const * buf, std::ostream & os) const;
        ///
        void read(Buffer const * buf, LyXLex & lex);
@@ -78,8 +97,6 @@ public:
        ///
        void pageWidth(LyXLength const &);
        ///
-       boost::signal0<void> hideDialog;
-       ///
        int getMaxWidth(BufferView *, UpdatableInset const *) const;
        ///
        bool needFullRow() const { return false; }
@@ -91,16 +108,38 @@ public:
        bool showInsetDialog(BufferView *) const;
        ///
        int latexTextWidth(BufferView *) const;
-
+       ///
+       void params(Params const & p) { params_ = p; }
+       ///
+       Params const & params() const { return params_; }
 private:
        ///
-       Position pos_;
+       Params params_;
+};
+
+
+#include "mailinset.h"
+
+
+class InsetMinipageMailer : public MailInset {
+public:
+       ///
+       InsetMinipageMailer(InsetMinipage & inset);
        ///
-       InnerPosition inner_pos_;
+       virtual Inset & inset() const { return inset_; }
+       ///
+       virtual string const & name() const { return name_; }
+       ///
+       virtual string const inset2string() const;
+       ///
+       static void string2params(string const &, InsetMinipage::Params &);
+       ///
+       static string const params2string(InsetMinipage::Params const &);
+private:
        ///
-       LyXLength height_;
+       static string const name_;
        ///
-       LyXLength width_;
+       InsetMinipage & inset_;
 };
 
 #endif
index 92bd136ea00d5ab7e62eef02521a08be2e21bcec..e54e1fa6298ac49e8463f6501adc5c1d9e1240c8 100644 (file)
@@ -310,14 +310,16 @@ void InsetWrap::addToToc(toc::TocList & toclist, Buffer const * buf) const
 }
 
 
+string const InsetWrapMailer::name_("wrap");
+
 InsetWrapMailer::InsetWrapMailer(InsetWrap & inset)
-       : name_("wrap"), inset_(inset)
+       : inset_(inset)
 {}
 
 
 string const InsetWrapMailer::inset2string() const
 {
-       return params2string(name(), inset_.params());
+       return params2string(inset_.params());
 }
 
 
@@ -326,32 +328,35 @@ void InsetWrapMailer::string2params(string const & in,
 {
        params = InsetWrapParams();
 
-       string name;
-       string body = split(in, name, ' ');
+       istringstream data(in);
+       LyXLex lex(0,0);
+       lex.setStream(data);
 
-       if (name != "wrap" || body.empty())
-               return;
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != name_)
+                       return;
+       }
 
        // This is part of the inset proper that is usually swallowed
        // by Buffer::readInset
-       body = split(body, name, '\n');
-       if (!prefixIs(name, "Wrap "))
-               return;
-
-       istringstream data(body);
-       LyXLex lex(0,0);
-       lex.setStream(data);
+       if (lex.isOK()) {
+               lex.next();
+               string const token = lex.getString();
+               if (token != "Wrap" || !lex.eatLine())
+                       return;
+       }
 
        params.read(lex);
 }
 
 
 string const
-InsetWrapMailer::params2string(string const & name,
-                              InsetWrapParams const & params)
+InsetWrapMailer::params2string(InsetWrapParams const & params)
 {
        ostringstream data;
-       data << name << ' ';
+       data << name_ << ' ';
        params.write(data);
 
        return data.str();
index b4525707f018f0b9128c1d3f6522a9dcc31c532b..a35b782b0bf0c40f666ba157fdc4571f5890690c 100644 (file)
@@ -105,11 +105,10 @@ public:
        ///
        static void string2params(string const &, InsetWrapParams &);
        ///
-       static string const params2string(string const & name,
-                                         InsetWrapParams const &);
+       static string const params2string(InsetWrapParams const &);
 private:
        ///
-       string const name_;
+       static string const name_;
        ///
        InsetWrap & inset_;
 };
index b6e957f01ab69f3cdec7f7ec6bc0394631cf495e..2af31604b054bfea680ddbfa4b73a16e4089bce4 100644 (file)
@@ -1350,6 +1350,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                string data;
                if (name == "bibitem" ||
                    name == "bibtex" ||
+                   name == "include" ||
                    name == "index" ||
                    name == "ref" ||
                    name == "toc" ||
@@ -1359,9 +1360,6 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                } else if (name == "citation") {
                        InsetCommandParams p("cite");
                        data = InsetCommandMailer::params2string(name, p);
-               } else if (name == "ert") {
-                       data = InsetERTMailer::params2string(name,
-                                                            InsetERT::Open);
                }
                owner->getDialogs().show(name, data, 0);
        }