+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
+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
class InsetGraphics;
class InsetInfo;
-class InsetMinipage;
class Paragraph;
class InsetTabular;
/// show the merge changes dialog
void showMergeChanges();
///
- void showMinipage(InsetMinipage *);
- ///
- void updateMinipage(InsetMinipage *);
- ///
void showParagraph();
///
void updateParagraph();
+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.
+++ /dev/null
-/**
- * \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")
-{}
+++ /dev/null
-// -*- 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
void ControlERT::dispatchParams()
{
- string const lfun = InsetERTMailer::params2string("ert", status_);
+ string const lfun = InsetERTMailer::params2string(status_);
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
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));
}
void ControlFloat::dispatchParams()
{
- string const lfun = InsetFloatMailer::params2string("float", params());
+ string const lfun = InsetFloatMailer::params2string(params());
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
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));
}
+++ /dev/null
-/**
- * \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")
-{}
+++ /dev/null
-// -*- 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
+++ /dev/null
-/**
- * \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")
-{}
+++ /dev/null
-// -*- 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
#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));
}
#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
+++ /dev/null
-/**
- * \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")
-{}
+++ /dev/null
-// -*- 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
void ControlWrap::dispatchParams()
{
- string const lfun = InsetWrapMailer::params2string("wrap", params());
+ string const lfun = InsetWrapMailer::params2string(params());
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
ButtonPolicies.h \
ControlAboutlyx.C \
ControlAboutlyx.h \
- ControlBibitem.C \
- ControlBibitem.h \
ControlBibtex.C \
ControlBibtex.h \
ControlButtons.C \
ControlGraphics.h \
ControlInclude.C \
ControlInclude.h \
- ControlIndex.C \
- ControlIndex.h \
ControlInset.h \
- ControlLabel.C \
- ControlLabel.h \
ControlLog.C \
ControlLog.h \
ControlMath.C \
ControlThesaurus.h \
ControlToc.C \
ControlToc.h \
- ControlUrl.C \
- ControlUrl.h \
ControlVCLog.C \
ControlVCLog.h \
ControlWrap.C \
}
-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();
class Dialogs;
class InsetGraphics;
-class InsetMinipage;
class InsetTabular;
extern "C" {
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 &);
+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
file(lv, d),
graphics(lv, d),
logfile(lv, d),
- minipage(lv, d),
paragraph(lv, d),
prefs(lv, d),
print(lv, d),
}
-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();
#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"
#include "QIncludeDialog.h"
#include "QIndex.h"
#include "QIndexDialog.h"
+#include "QMinipage.h"
+#include "QMinipageDialog.h"
#include "QRef.h"
#include "QRefDialog.h"
#include "QToc.h"
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 *));
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") {
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));
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") {
#include "ControlGraphics.h"
#include "insets/insetgraphicsParams.h"
#include "ControlLog.h"
-#include "ControlMinipage.h"
#include "ControlParagraph.h"
#include "ControlPrefs.h"
#include "ControlPrint.h"
#include "QGraphicsDialog.h"
#include "QLog.h"
#include "QLogDialog.h"
-#include "QMinipage.h"
-#include "QMinipageDialog.h"
#include "QParagraph.h"
#include "QParagraphDialog.h"
#include "QPrefs.h"
typedef GUI<ControlLog, QLog, OkCancelPolicy, Qt2BC>
LogFileDialog;
-typedef GUI<ControlMinipage, QMinipage, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
-MinipageDialog;
-
typedef GUI<ControlParagraph, QParagraph, OkApplyCancelReadOnlyPolicy, Qt2BC>
ParagraphDialog;
FileDialog file;
GraphicsDialog graphics;
LogFileDialog logfile;
- MinipageDialog minipage;
ParagraphDialog paragraph;
PrefsDialog prefs;
PrintDialog print;
#include "support/lstrings.h"
-#include "ControlBibitem.h"
+#include "ControlCommand.h"
#include "qt_helpers.h"
#include "debug.h"
#include "QBibitem.h"
#include "Qt2BC.h"
-typedef QController<ControlBibitem, QView<QBibitemDialog> > base_class;
+typedef QController<ControlCommand, QView<QBibitemDialog> > base_class;
QBibitem::QBibitem(Dialog & parent)
#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;
#include <config.h>
-
-#include "ControlBibitem.h"
-
#include <qpushbutton.h>
#include <qlineedit.h>
#include <config.h>
-#include "ControlIndex.h"
+#include "ControlCommand.h"
#include "qt_helpers.h"
#include "QIndexDialog.h"
#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"))
{
}
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:
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())
#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();
#include <config.h>
-
-#include "ControlUrl.h"
+#include "ControlCommand.h"
#include "debug.h"
#include "qt_helpers.h"
#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"))
#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;
+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
graphics(lv, d),
logfile(lv, d),
mathpanel(lv, d),
- minipage(lv, d),
paragraph(lv, d),
preamble(lv, d),
preferences(lv, d),
}
-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();
#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"
// "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 *));
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") {
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));
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") {
#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"
typedef GUI<ControlMath, FormMathsPanel, OkCancelReadOnlyPolicy, xformsBC>
MathPanelDialog;
-typedef GUI<ControlMinipage, FormMinipage, NoRepeatedApplyReadOnlyPolicy, xformsBC>
-MinipageDialog;
-
typedef GUI<ControlParagraph, FormParagraph, OkApplyCancelReadOnlyPolicy, xformsBC>
ParagraphDialog;
GraphicsDialog graphics;
LogFileDialog logfile;
MathPanelDialog mathpanel;
- MinipageDialog minipage;
ParagraphDialog paragraph;
PreambleDialog preamble;
PreferencesDialog preferences;
#include <config.h>
#include "xformsBC.h"
-#include "ControlBibitem.h"
+#include "ControlCommand.h"
#include "FormBibitem.h"
#include "Tooltips.h"
#include "forms/form_bibitem.h"
#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"))
#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 &);
#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"))
{}
void FormMinipage::apply()
{
- controller().params().pageWidth =
+ controller().params().width =
LyXLength(getLengthFromWidgets(dialog_->input_width,
dialog_->choice_width_units));
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);
#ifndef FORMMINIPAGE_H
#define FORMMINIPAGE_H
-
-#include "FormBase.h"
+#include "FormDialogView.h"
class ControlMinipage;
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();
#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"))
#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 &);
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_width
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_width_units
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_top
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_middle
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: radio_bottom
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
argument: 0
--------------------
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_restore
-callback: C_FormBaseRestoreCB
+callback: C_FormDialogView_RestoreCB
argument: 0
--------------------
+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:
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);
}
}
+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());
}
string const
-InsetERTMailer::params2string(string const & name, InsetERT::ERTStatus status)
+InsetERTMailer::params2string(InsetERT::ERTStatus status)
{
- return name + ' ' + tostr(status);
+ return name_ + ' ' + tostr(status);
}
///
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_;
};
}
+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());
}
{
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);
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";
///
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_;
};
}
+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());
}
{
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();
///
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_;
};
}
+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());
}
{
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);
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";
///
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_;
};
#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;
// (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);
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_)
{}
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;
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;
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;
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;
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);
}
else {
// Take placement into account.
int i = 0;
- switch (pos_) {
+ switch (params_.pos) {
case top:
i = InsetCollapsable::ascent(bv, font);
break;
else {
// Take placement into account.
int i = 0;
- switch (pos_) {
+ switch (params_.pos) {
case top:
i = InsetCollapsable::descent(bv, font);
break;
ostream & os, bool fragile, bool fp) const
{
string s_pos;
- switch (pos_) {
+ switch (params_.pos) {
case top:
s_pos += 't';
break;
break;
}
os << "\\begin{minipage}[" << s_pos << "]{"
- << width_.asLatexString() << "}%\n";
+ << params_.width.asLatexString() << "}%\n";
int i = inset.latex(buf, os, fragile, fp);
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;
}
}
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;
}
}
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;
}
}
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;
}
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) {
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();
}
#include "insetcollapsable.h"
#include "lyxlength.h"
-#include <boost/signals/signal0.hpp>
-
/** The minipage inset
*/
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 &);
///
///
~InsetMinipage();
///
+ virtual dispatch_result localDispatch(FuncRequest const & cmd);
+ ///
void write(Buffer const * buf, std::ostream & os) const;
///
void read(Buffer const * buf, LyXLex & lex);
///
void pageWidth(LyXLength const &);
///
- boost::signal0<void> hideDialog;
- ///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
bool needFullRow() const { return false; }
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
}
+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());
}
{
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();
///
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_;
};
string data;
if (name == "bibitem" ||
name == "bibtex" ||
+ name == "include" ||
name == "index" ||
name == "ref" ||
name == "toc" ||
} 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);
}