mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Port the tabular dialog to the new scheme based on class Dialog.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6401 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3e97d1fee2
commit
ded76b4ff4
@ -1,3 +1,8 @@
|
||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showTabular, updateTabular.
|
||||
* guiapi.[Ch]: remove gui_updateTabular, gui_updateTabular.
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.h: remove showGraphics.
|
||||
|
@ -23,9 +23,7 @@ class Dialog;
|
||||
class InsetBase;
|
||||
class LyXView;
|
||||
|
||||
class InsetInfo;
|
||||
class Paragraph;
|
||||
class InsetTabular;
|
||||
|
||||
/** Container of all dialogs and signals a LyXView needs or uses to access them
|
||||
The list of dialog signals isn't comprehensive but should be a good guide
|
||||
@ -108,10 +106,6 @@ public:
|
||||
/// bring up the spellchecker
|
||||
void showSpellchecker();
|
||||
///
|
||||
void showTabular(InsetTabular *);
|
||||
///
|
||||
void updateTabular(InsetTabular *);
|
||||
///
|
||||
void showTabularCreate();
|
||||
/// show the TexInfo
|
||||
void showTexinfo();
|
||||
@ -134,7 +128,7 @@ public:
|
||||
*/
|
||||
void update(string const & name, string const & data);
|
||||
///
|
||||
void Dialogs::hide(string const & name);
|
||||
void hide(string const & name);
|
||||
///
|
||||
void disconnect(string const & name);
|
||||
///
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlTabular.[Ch]: rewrite to use the Dialog-based scheme.
|
||||
|
||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlTabular.[Ch]: minimise the interface in preparation for
|
||||
|
@ -9,132 +9,59 @@
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "ControlTabular.h"
|
||||
|
||||
#include "ButtonControllerBase.h"
|
||||
#include "ViewBase.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
#include "funcrequest.h"
|
||||
#include "lyxrc.h"
|
||||
#include "insets/insettabular.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
ControlTabular::ControlTabular(LyXView & lv, Dialogs & d)
|
||||
: ControlConnectBD(lv, d),
|
||||
inset_(0), dialog_built_(false)
|
||||
ControlTabular::ControlTabular(Dialog & parent)
|
||||
: Dialog::Controller(parent), active_cell_(-1)
|
||||
{}
|
||||
|
||||
|
||||
void ControlTabular::showInset(InsetTabular * inset)
|
||||
void ControlTabular::initialiseParams(string const & data)
|
||||
{
|
||||
lyx::Assert(inset);
|
||||
|
||||
connectInset(inset);
|
||||
show(inset);
|
||||
|
||||
// The widgets may not be valid, so refresh the button controller
|
||||
// FIXME: needed ?
|
||||
bc().refresh();
|
||||
}
|
||||
|
||||
|
||||
void ControlTabular::updateInset(InsetTabular * inset)
|
||||
{
|
||||
if (!view().isVisible())
|
||||
Buffer * buffer = kernel().buffer();
|
||||
if (!buffer)
|
||||
return;
|
||||
lyx::Assert(inset);
|
||||
connectInset(inset);
|
||||
update();
|
||||
|
||||
InsetTabular tmp(*buffer);
|
||||
int cell = InsetTabularMailer::string2params(data, tmp);
|
||||
if (cell != -1) {
|
||||
params_.reset(new LyXTabular(*tmp.tabular.get()));
|
||||
active_cell_ = cell;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ControlTabular::show(InsetTabular * inset)
|
||||
void ControlTabular::clearParams()
|
||||
{
|
||||
inset_ = inset;
|
||||
|
||||
if (emergency_exit_) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dialog_built_) {
|
||||
view().build();
|
||||
dialog_built_ = true;
|
||||
}
|
||||
|
||||
bc().readOnly(bufferIsReadonly());
|
||||
view().show();
|
||||
params_.reset();
|
||||
active_cell_ = -1;
|
||||
}
|
||||
|
||||
|
||||
void ControlTabular::update()
|
||||
int ControlTabular::getActiveCell() const
|
||||
{
|
||||
if (emergency_exit_) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
bc().readOnly(bufferIsReadonly());
|
||||
view().update();
|
||||
|
||||
// The widgets may not be valid, so refresh the button controller
|
||||
// FIXME: needed ?
|
||||
bc().refresh();
|
||||
}
|
||||
|
||||
|
||||
void ControlTabular::hide()
|
||||
{
|
||||
emergency_exit_ = false;
|
||||
inset_ = 0;
|
||||
|
||||
ih_.disconnect();
|
||||
disconnect();
|
||||
view().hide();
|
||||
}
|
||||
|
||||
|
||||
void ControlTabular::updateSlot(bool switched)
|
||||
{
|
||||
if (switched)
|
||||
hide();
|
||||
else
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void ControlTabular::connectInset(InsetTabular * inset)
|
||||
{
|
||||
// If connected to another inset, disconnect from it.
|
||||
if (inset_) {
|
||||
ih_.disconnect();
|
||||
inset_ = 0;
|
||||
}
|
||||
|
||||
if (inset) {
|
||||
inset_ = inset;
|
||||
ih_ = inset->hideDialog.connect(
|
||||
boost::bind(&ControlTabular::hide, this));
|
||||
}
|
||||
connect();
|
||||
return active_cell_;
|
||||
}
|
||||
|
||||
|
||||
LyXTabular const & ControlTabular::tabular() const
|
||||
{
|
||||
lyx::Assert(inset_);
|
||||
return *inset_->tabular.get();
|
||||
lyx::Assert(params_.get());
|
||||
return *params_.get();
|
||||
}
|
||||
|
||||
|
||||
void ControlTabular::set(LyXTabular::Feature f, string const & arg)
|
||||
{
|
||||
lyx::Assert(inset_);
|
||||
inset_->tabularFeatures(lv_.view().get(), f, arg);
|
||||
string const data = featureAsString(f) + ' ' + arg;
|
||||
kernel().dispatch(FuncRequest(LFUN_TABULAR_FEATURE, data));
|
||||
}
|
||||
|
||||
|
||||
@ -142,10 +69,3 @@ bool ControlTabular::useMetricUnits() const
|
||||
{
|
||||
return lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER;
|
||||
}
|
||||
|
||||
|
||||
int ControlTabular::getActiveCell() const
|
||||
{
|
||||
lyx::Assert(inset_);
|
||||
return inset_->getActCell();
|
||||
}
|
||||
|
@ -16,62 +16,37 @@
|
||||
#ifndef CONTROLTABULAR_H
|
||||
#define CONTROLTABULAR_H
|
||||
|
||||
#include "ControlConnections.h"
|
||||
#include "LString.h"
|
||||
#include "Dialog.h"
|
||||
#include "tabular.h"
|
||||
|
||||
#include <boost/signals/connection.hpp>
|
||||
|
||||
class InsetTabular;
|
||||
|
||||
class ControlTabular : public ControlConnectBD {
|
||||
class ControlTabular : public Dialog::Controller {
|
||||
public:
|
||||
|
||||
ControlTabular(LyXView &, Dialogs &);
|
||||
ControlTabular(Dialog &);
|
||||
///
|
||||
virtual void initialiseParams(string const & data);
|
||||
/// clean-up on hide.
|
||||
virtual void clearParams();
|
||||
/// We use set() instead.
|
||||
virtual void dispatchParams() {};
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
|
||||
///
|
||||
int getActiveCell() const;
|
||||
|
||||
/// get the contained tabular
|
||||
LyXTabular const & tabular() const;
|
||||
|
||||
/// return true if units should default to metric
|
||||
bool useMetricUnits() const;
|
||||
|
||||
/// set a parameter
|
||||
void set(LyXTabular::Feature, string const & arg = string());
|
||||
|
||||
/// slot launching dialog to an existing inset.
|
||||
void showInset(InsetTabular *);
|
||||
|
||||
/// update inset
|
||||
void updateInset(InsetTabular *);
|
||||
|
||||
private:
|
||||
|
||||
/// we can't do this ...
|
||||
virtual void apply() {};
|
||||
/// disconnect signals and hide View.
|
||||
virtual void hide();
|
||||
/// update the dialog.
|
||||
virtual void update();
|
||||
|
||||
/** Instantiation of ControlConnectBD private virtual method.
|
||||
Slot connected to update signal. */
|
||||
virtual void updateSlot(bool);
|
||||
|
||||
/// show the dialog.
|
||||
void show(InsetTabular *);
|
||||
/// connect signals
|
||||
void connectInset(InsetTabular *);
|
||||
|
||||
/// pointer to the inset passed through connectInset
|
||||
InsetTabular * inset_;
|
||||
/// inset::hide connection.
|
||||
boost::signals::connection ih_;
|
||||
|
||||
/// is the dialog built ?
|
||||
bool dialog_built_;
|
||||
///
|
||||
int active_cell_;
|
||||
///
|
||||
boost::scoped_ptr<LyXTabular> params_;
|
||||
};
|
||||
|
||||
#endif // CONTROLTABULAR_H
|
||||
|
@ -117,18 +117,6 @@ void gui_ShowSpellchecker(Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowTabular(InsetTabular * it, Dialogs & d)
|
||||
{
|
||||
d.showTabular(it);
|
||||
}
|
||||
|
||||
|
||||
void gui_UpdateTabular(InsetTabular * it, Dialogs & d)
|
||||
{
|
||||
d.updateTabular(it);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowTabularCreate(Dialogs & d)
|
||||
{
|
||||
d.showTabularCreate();
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "LString.h"
|
||||
|
||||
class Dialogs;
|
||||
class InsetTabular;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@ -38,8 +37,6 @@ void gui_ShowPrint(Dialogs &);
|
||||
void gui_ShowSearch(Dialogs &);
|
||||
void gui_ShowSendto(Dialogs &);
|
||||
void gui_ShowSpellchecker(Dialogs &);
|
||||
void gui_ShowTabular(InsetTabular *, Dialogs &);
|
||||
void gui_UpdateTabular(InsetTabular *, Dialogs &);
|
||||
void gui_ShowTabularCreate(Dialogs &);
|
||||
void gui_ShowTexinfo(Dialogs &);
|
||||
void gui_ShowThesaurus(string const &, Dialogs &);
|
||||
|
@ -1,3 +1,13 @@
|
||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove tabular dialog.
|
||||
|
||||
* Dialogs3.C: add tabular dialog.
|
||||
|
||||
* QTabular.[Ch]: changes to use the new Dialog-based scheme.
|
||||
|
||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* QDialogView.h: make controller methods of QController public to
|
||||
|
@ -39,7 +39,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
sendto(lv, d),
|
||||
spellchecker(lv, d),
|
||||
tabularcreate(lv, d),
|
||||
tabular(lv, d),
|
||||
texinfo(lv, d),
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
|
@ -118,18 +118,6 @@ void Dialogs::showSpellchecker()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showTabular(InsetTabular * it)
|
||||
{
|
||||
pimpl_->tabular.controller().showInset(it);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateTabular(InsetTabular * it)
|
||||
{
|
||||
pimpl_->tabular.controller().updateInset(it);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showTabularCreate()
|
||||
{
|
||||
pimpl_->tabularcreate.controller().show();
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlMinipage.h"
|
||||
#include "ControlRef.h"
|
||||
#include "ControlTabular.h"
|
||||
#include "ControlToc.h"
|
||||
#include "ControlWrap.h"
|
||||
|
||||
@ -54,6 +55,8 @@
|
||||
#include "QMinipageDialog.h"
|
||||
#include "QRef.h"
|
||||
#include "QRefDialog.h"
|
||||
#include "QTabular.h"
|
||||
#include "QTabularDialog.h"
|
||||
#include "QToc.h"
|
||||
#include "QTocDialog.h"
|
||||
#include "QURL.h"
|
||||
@ -83,7 +86,8 @@ namespace {
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "external", "float",
|
||||
"graphics", "include", "index", "label",
|
||||
"minipage", "ref", "toc", "url", "wrap" };
|
||||
"minipage", "ref", "tabular", "toc",
|
||||
"url", "wrap" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
@ -171,6 +175,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlRef(*dialog));
|
||||
dialog->setView(new QRef(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "tabular") {
|
||||
dialog->setController(new ControlTabular(*dialog));
|
||||
dialog->setView(new QTabular(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "toc") {
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new QToc(*dialog));
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "ControlShowFile.h"
|
||||
#include "ControlSpellchecker.h"
|
||||
#include "ControlTabularCreate.h"
|
||||
#include "ControlTabular.h"
|
||||
#include "ControlTexinfo.h"
|
||||
#include "ControlVCLog.h"
|
||||
|
||||
@ -63,8 +62,6 @@
|
||||
#include "QSpellcheckerDialog.h"
|
||||
#include "QTabularCreate.h"
|
||||
#include "QTabularCreateDialog.h"
|
||||
#include "QTabular.h"
|
||||
#include "QTabularDialog.h"
|
||||
#include "QTexinfo.h"
|
||||
#include "QTexinfoDialog.h"
|
||||
|
||||
@ -120,9 +117,6 @@ SpellcheckerDialog;
|
||||
typedef GUI<ControlTabularCreate, QTabularCreate, OkApplyCancelReadOnlyPolicy, Qt2BC>
|
||||
TabularCreateDialog;
|
||||
|
||||
typedef GUI<ControlTabular, QTabular, OkApplyCancelReadOnlyPolicy, Qt2BC>
|
||||
TabularDialog;
|
||||
|
||||
typedef GUI<ControlTexinfo, QTexinfo, OkCancelPolicy, Qt2BC>
|
||||
TexinfoDialog;
|
||||
|
||||
@ -151,7 +145,6 @@ struct Dialogs::Impl {
|
||||
SendtoDialog sendto;
|
||||
SpellcheckerDialog spellchecker;
|
||||
TabularCreateDialog tabularcreate;
|
||||
TabularDialog tabular;
|
||||
TexinfoDialog texinfo;
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include "debug.h"
|
||||
#include "QtLyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "QDialogView.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "support/LAssert.h"
|
||||
|
@ -29,10 +29,10 @@
|
||||
#include "lengthcombo.h"
|
||||
#include "qsetborder.h"
|
||||
|
||||
typedef Qt2CB<ControlTabular, Qt2DB<QTabularDialog> > base_class;
|
||||
typedef QController<ControlTabular, QView<QTabularDialog> > base_class;
|
||||
|
||||
QTabular::QTabular()
|
||||
: base_class(qt_("LyX: Table Settings"))
|
||||
QTabular::QTabular(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Table Settings"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -16,19 +16,20 @@
|
||||
#define QTABULAR_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
|
||||
class ControlTabular;
|
||||
class QTabularDialog;
|
||||
|
||||
|
||||
class QTabular :
|
||||
public Qt2CB<ControlTabular, Qt2DB<QTabularDialog> >
|
||||
public QController<ControlTabular, QView<QTabularDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QTabularDialog;
|
||||
|
||||
QTabular();
|
||||
QTabular(Dialog &);
|
||||
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
|
@ -1,3 +1,14 @@
|
||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C:
|
||||
* Dialogs2.C:
|
||||
* Dialogs_impl.h: remove tabular dialog.
|
||||
|
||||
* Dialogs3.C: add tabular dialog.
|
||||
|
||||
* FormTabular.[Ch]:
|
||||
* forms/form_tabular.fd: changes to use the new Dialog-based scheme.
|
||||
|
||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormTabular.C: changes due to the changed ControlTabular
|
||||
|
@ -41,7 +41,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
search(lv, d),
|
||||
sendto(lv, d),
|
||||
spellchecker(lv, d),
|
||||
tabular(lv, d),
|
||||
tabularcreate(lv, d),
|
||||
texinfo(lv, d),
|
||||
|
||||
|
@ -117,18 +117,6 @@ void Dialogs::showSpellchecker()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showTabular(InsetTabular * it)
|
||||
{
|
||||
pimpl_->tabular.controller().showInset(it);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateTabular(InsetTabular * it)
|
||||
{
|
||||
pimpl_->tabular.controller().updateInset(it);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showTabularCreate()
|
||||
{
|
||||
pimpl_->tabularcreate.controller().show();
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlMinipage.h"
|
||||
#include "ControlRef.h"
|
||||
#include "ControlTabular.h"
|
||||
#include "ControlToc.h"
|
||||
#include "ControlWrap.h"
|
||||
|
||||
@ -51,6 +52,8 @@
|
||||
#include "forms/form_minipage.h"
|
||||
#include "FormRef.h"
|
||||
#include "forms/form_ref.h"
|
||||
#include "FormTabular.h"
|
||||
#include "forms/form_tabular.h"
|
||||
#include "FormText.h"
|
||||
#include "forms/form_text.h"
|
||||
#include "FormToc.h"
|
||||
@ -82,7 +85,8 @@ namespace {
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "external", "float",
|
||||
"graphics", "include", "index", "label",
|
||||
"minipage", "ref", "toc", "url", "wrap" };
|
||||
"minipage", "ref", "tabular", "toc",
|
||||
"url", "wrap" };
|
||||
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
@ -169,6 +173,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlRef(*dialog));
|
||||
dialog->setView(new FormRef(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "tabular") {
|
||||
dialog->setController(new ControlTabular(*dialog));
|
||||
dialog->setView(new FormTabular(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "toc") {
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new FormToc(*dialog));
|
||||
|
@ -79,10 +79,6 @@
|
||||
#include "FormSpellchecker.h"
|
||||
#include "forms/form_spellchecker.h"
|
||||
|
||||
#include "ControlTabular.h"
|
||||
#include "FormTabular.h"
|
||||
#include "forms/form_tabular.h"
|
||||
|
||||
#include "ControlTabularCreate.h"
|
||||
#include "FormTabularCreate.h"
|
||||
#include "forms/form_tabular_create.h"
|
||||
@ -145,9 +141,6 @@ SendtoDialog;
|
||||
typedef GUI<ControlSpellchecker, FormSpellchecker, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
SpellcheckerDialog;
|
||||
|
||||
typedef GUI<ControlTabular, FormTabular, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
TabularDialog;
|
||||
|
||||
typedef GUI<ControlTabularCreate, FormTabularCreate, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
TabularCreateDialog;
|
||||
|
||||
@ -180,7 +173,6 @@ struct Dialogs::Impl {
|
||||
SearchDialog search;
|
||||
SendtoDialog sendto;
|
||||
SpellcheckerDialog spellchecker;
|
||||
TabularDialog tabular;
|
||||
TabularCreateDialog tabularcreate;
|
||||
TexinfoDialog texinfo;
|
||||
|
||||
|
@ -34,10 +34,10 @@ using std::vector;
|
||||
using std::bind2nd;
|
||||
|
||||
|
||||
typedef FormCB<ControlTabular, FormDB<FD_tabular> > base_class;
|
||||
typedef FormController<ControlTabular, FormView<FD_tabular> > base_class;
|
||||
|
||||
FormTabular::FormTabular()
|
||||
: base_class(_("Edit table settings")),
|
||||
FormTabular::FormTabular(Dialog & parent)
|
||||
: base_class(parent, _("Edit table settings")),
|
||||
closing_(false), actCell_(-1)
|
||||
{
|
||||
}
|
||||
@ -507,7 +507,7 @@ ButtonPolicy::SMInput FormTabular::input(FL_OBJECT * ob, long)
|
||||
input(cell_options_->input_special_multialign, 0);
|
||||
|
||||
closing_ = false;
|
||||
controller().OKButton();
|
||||
dialog().OKButton();
|
||||
return ButtonPolicy::SMI_VALID;
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,9 @@
|
||||
#ifndef FORMTABULAR_H
|
||||
#define FORMTABULAR_H
|
||||
|
||||
#include "FormDialogView.h"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
|
||||
class InsetTabular;
|
||||
class ControlTabular;
|
||||
struct FD_tabular;
|
||||
@ -29,10 +27,11 @@ struct FD_tabular_longtable;
|
||||
/** This class provides an XForms implementation of the FormTabular Dialog.
|
||||
The tabular dialog allows users to set/save their tabular.
|
||||
*/
|
||||
class FormTabular : public FormCB<ControlTabular, FormDB<FD_tabular> > {
|
||||
class FormTabular
|
||||
: public FormController<ControlTabular, FormView<FD_tabular> > {
|
||||
public:
|
||||
|
||||
FormTabular();
|
||||
FormTabular(Dialog &);
|
||||
|
||||
private:
|
||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||
|
@ -64,7 +64,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_close
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -160,7 +160,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_append_column
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -178,7 +178,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_delete_column
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -196,7 +196,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_append_row
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -214,7 +214,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_delete_row
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -232,7 +232,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_set_borders
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -250,7 +250,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_unset_borders
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -268,7 +268,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_longtable
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -286,7 +286,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_rotate_tabular
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -418,7 +418,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_column_width
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -436,7 +436,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_border_top
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -454,7 +454,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_border_bottom
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -472,7 +472,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_border_left
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -490,7 +490,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_border_right
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -526,7 +526,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_align_left
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
@ -545,7 +545,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_align_right
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -563,7 +563,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_align_center
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -617,7 +617,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_valign_top
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
@ -636,7 +636,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_valign_center
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -654,7 +654,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_valign_bottom
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -690,7 +690,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_special_alignment
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -708,7 +708,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: choice_value_column_width
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -744,7 +744,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_align_block
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
=============== FORM ===============
|
||||
@ -876,7 +876,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_border_top
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -894,7 +894,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_border_bottom
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -912,7 +912,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_border_left
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -930,7 +930,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_border_right
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -966,7 +966,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_align_left
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
@ -985,7 +985,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_align_right
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1003,7 +1003,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_align_center
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1057,7 +1057,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_valign_top
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
@ -1076,7 +1076,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_valign_center
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1094,7 +1094,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: radio_valign_bottom
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1130,7 +1130,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_mcolumn_width
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1148,7 +1148,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_special_multialign
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1166,7 +1166,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_multicolumn
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1184,7 +1184,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_useminipage
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1202,7 +1202,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_rotate_cell
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1220,7 +1220,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: choice_value_mcolumn_width
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1370,7 +1370,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_lt_firsthead
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1388,7 +1388,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_lt_head
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1406,7 +1406,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_lt_foot
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1424,7 +1424,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_lt_lastfoot
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1442,7 +1442,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_lt_newpage
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1460,7 +1460,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_head_2border_above
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1478,7 +1478,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_head_2border_below
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1568,7 +1568,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_1head_2border_above
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1586,7 +1586,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_foot_2border_above
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1604,7 +1604,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_lastfoot_2border_above
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1622,7 +1622,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_1head_2border_below
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1640,7 +1640,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_foot_2border_below
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1658,7 +1658,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_lastfoot_2border_below
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1676,7 +1676,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_1head_empty
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
@ -1694,7 +1694,7 @@ shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: check_lastfoot_empty
|
||||
callback: C_FormBaseInputCB
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
|
@ -1,3 +1,11 @@
|
||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insettabular.[Ch]: define a new class InsetTabularMailer and use
|
||||
it to communicate with the frontend dialogs.
|
||||
|
||||
* mailinset.C (hideDialog): only hide the dialog if it is showing the
|
||||
contents of this inset!
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* inseterror.C (localDispatch): new method; calls edit() on
|
||||
|
@ -119,9 +119,29 @@ TabularFeature tabularFeature[] =
|
||||
{ LyXTabular::LAST_ACTION, "" }
|
||||
};
|
||||
|
||||
struct FindFeature {
|
||||
FindFeature(LyXTabular::Feature feature) : feature_(feature) {}
|
||||
bool operator()(TabularFeature & tf)
|
||||
{
|
||||
return tf.action == feature_;
|
||||
}
|
||||
private:
|
||||
LyXTabular::Feature feature_;
|
||||
};
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
string const featureAsString(LyXTabular::Feature feature)
|
||||
{
|
||||
TabularFeature * it = tabularFeature;
|
||||
TabularFeature * end = it +
|
||||
sizeof(tabularFeature) / sizeof(TabularFeature);
|
||||
it = std::find_if(it, end, FindFeature(feature));
|
||||
return (it == end) ? string() : it->feature;
|
||||
}
|
||||
|
||||
|
||||
bool InsetTabular::hasPasteBuffer() const
|
||||
{
|
||||
return (paste_tabular != 0);
|
||||
@ -174,7 +194,8 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
|
||||
|
||||
InsetTabular::~InsetTabular()
|
||||
{
|
||||
hideDialog();
|
||||
InsetTabularMailer mailer(*this);
|
||||
mailer.hideDialog();
|
||||
}
|
||||
|
||||
|
||||
@ -184,6 +205,12 @@ Inset * InsetTabular::clone(Buffer const & buf, bool same_id) const
|
||||
}
|
||||
|
||||
|
||||
BufferView * InsetTabular::view() const
|
||||
{
|
||||
return buffer->getUser();
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::write(Buffer const * buf, ostream & os) const
|
||||
{
|
||||
os << " Tabular" << endl;
|
||||
@ -708,7 +735,8 @@ bool InsetTabular::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
||||
if (the_locking_inset->unlockInsetInInset(bv, inset, lr)) {
|
||||
if (inset->lyxCode() == TABULAR_CODE &&
|
||||
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) {
|
||||
bv->owner()->getDialogs().updateTabular(this);
|
||||
InsetTabularMailer mailer(*this);
|
||||
mailer.updateDialog();
|
||||
oldcell = actcell;
|
||||
}
|
||||
return true;
|
||||
@ -855,7 +883,8 @@ bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
|
||||
ret = the_locking_inset->localDispatch(cmd1);
|
||||
}
|
||||
if (cmd.button() == mouse_button::button3 && !ret) {
|
||||
cmd.view()->owner()->getDialogs().showTabular(this);
|
||||
InsetTabularMailer mailer(*this);
|
||||
mailer.showDialog();
|
||||
return true;
|
||||
}
|
||||
return ret;
|
||||
@ -1139,9 +1168,16 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
||||
case LFUN_ENDBUF:
|
||||
case LFUN_ENDBUFSEL:
|
||||
break;
|
||||
case LFUN_LAYOUT_TABULAR:
|
||||
bv->owner()->getDialogs().showTabular(this);
|
||||
case LFUN_LAYOUT_TABULAR: {
|
||||
InsetTabularMailer mailer(*this);
|
||||
mailer.showDialog();
|
||||
break;
|
||||
}
|
||||
case LFUN_INSET_DIALOG_UPDATE: {
|
||||
InsetTabularMailer mailer(*this);
|
||||
mailer.updateDialog();
|
||||
break;
|
||||
}
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
if (!tabularFeatures(bv, arg))
|
||||
result = UNDISPATCHED;
|
||||
@ -1630,7 +1666,8 @@ void InsetTabular::resetPos(BufferView * bv) const
|
||||
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) &&
|
||||
actcell != oldcell) {
|
||||
InsetTabular * inset = const_cast<InsetTabular *>(this);
|
||||
bv->owner()->getDialogs().updateTabular(inset);
|
||||
InsetTabularMailer mailer(*inset);
|
||||
mailer.updateDialog();
|
||||
oldcell = actcell;
|
||||
}
|
||||
in_reset_pos = 0;
|
||||
@ -2314,9 +2351,11 @@ LyXText * InsetTabular::getLyXText(BufferView const * bv,
|
||||
|
||||
bool InsetTabular::showInsetDialog(BufferView * bv) const
|
||||
{
|
||||
if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv))
|
||||
bv->owner()->getDialogs().
|
||||
showTabular(const_cast<InsetTabular *>(this));
|
||||
if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv)) {
|
||||
InsetTabular * tmp = const_cast<InsetTabular *>(this);
|
||||
InsetTabularMailer mailer(*tmp);
|
||||
mailer.showDialog();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2331,8 +2370,9 @@ void InsetTabular::openLayoutDialog(BufferView * bv) const
|
||||
return;
|
||||
}
|
||||
}
|
||||
bv->owner()->getDialogs().showTabular(
|
||||
const_cast<InsetTabular *>(this));
|
||||
InsetTabular * tmp = const_cast<InsetTabular *>(this);
|
||||
InsetTabularMailer mailer(*tmp);
|
||||
mailer.showDialog();
|
||||
}
|
||||
|
||||
|
||||
@ -2998,3 +3038,76 @@ void InsetTabular::addPreview(grfx::PreviewLoader & loader) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string const InsetTabularMailer:: name_("tabular");
|
||||
|
||||
InsetTabularMailer::InsetTabularMailer(InsetTabular & inset)
|
||||
: inset_(inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetTabularMailer::inset2string() const
|
||||
{
|
||||
return params2string(inset_);
|
||||
}
|
||||
|
||||
|
||||
int InsetTabularMailer::string2params(string const & in, InsetTabular & inset)
|
||||
{
|
||||
istringstream data(in);
|
||||
LyXLex lex(0,0);
|
||||
lex.setStream(data);
|
||||
|
||||
if (lex.isOK()) {
|
||||
lex.next();
|
||||
string const token = lex.getString();
|
||||
if (token != name_)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cell = -1;
|
||||
if (lex.isOK()) {
|
||||
lex.next();
|
||||
string const token = lex.getString();
|
||||
if (token != "active_cell")
|
||||
return -1;
|
||||
lex.next();
|
||||
cell = lex.getInteger();
|
||||
}
|
||||
|
||||
// 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 != "Tabular")
|
||||
return -1;
|
||||
}
|
||||
|
||||
BufferView * const bv = inset.view();
|
||||
Buffer const * const buffer = bv ? bv->buffer() : 0;
|
||||
if (buffer)
|
||||
inset.read(buffer, lex);
|
||||
|
||||
// We can't set the active cell, but we can tell the frontend
|
||||
// what it is.
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
string const
|
||||
InsetTabularMailer::params2string(InsetTabular const & inset)
|
||||
{
|
||||
BufferView * const bv = inset.view();
|
||||
Buffer const * const buffer = bv ? bv->buffer() : 0;
|
||||
if (!buffer)
|
||||
return string();
|
||||
|
||||
ostringstream data;
|
||||
data << name_ << " active_cell " << inset.getActCell() << '\n';
|
||||
inset.write(buffer, data);
|
||||
data << "\\end_inset\n";
|
||||
|
||||
return data.str();
|
||||
}
|
||||
|
@ -53,8 +53,7 @@
|
||||
#include "FuncStatus.h"
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/signals/signal0.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
|
||||
class LyXLex;
|
||||
class Painter;
|
||||
@ -234,13 +233,14 @@ public:
|
||||
// Public structures and variables
|
||||
///
|
||||
boost::scoped_ptr<LyXTabular> tabular;
|
||||
///
|
||||
boost::signal0<void> hideDialog;
|
||||
|
||||
/// are some cells selected ?
|
||||
bool hasSelection() const {
|
||||
return has_selection;
|
||||
}
|
||||
|
||||
///
|
||||
virtual BufferView * view() const;
|
||||
private:
|
||||
///
|
||||
void lfunMousePress(FuncRequest const &);
|
||||
@ -367,4 +367,32 @@ private:
|
||||
///
|
||||
mutable int in_reset_pos;
|
||||
};
|
||||
|
||||
|
||||
#include "mailinset.h"
|
||||
|
||||
|
||||
class InsetTabularMailer : public MailInset {
|
||||
public:
|
||||
///
|
||||
InsetTabularMailer(InsetTabular & inset);
|
||||
///
|
||||
virtual Inset & inset() const { return inset_; }
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
/// Returns the active cell if successful, else -1.
|
||||
static int string2params(string const &, InsetTabular &);
|
||||
///
|
||||
static string const params2string(InsetTabular const &);
|
||||
private:
|
||||
///
|
||||
static string const name_;
|
||||
///
|
||||
InsetTabular & inset_;
|
||||
};
|
||||
|
||||
string const featureAsString(LyXTabular::Feature feature);
|
||||
|
||||
#endif
|
||||
|
@ -45,5 +45,7 @@ void MailInset::hideDialog() const
|
||||
if (!bv)
|
||||
return;
|
||||
|
||||
bv->owner()->getDialogs().hide(name());
|
||||
InsetBase * cmp = bv->owner()->getDialogs().getOpenInset(name());
|
||||
if (cmp == &inset())
|
||||
bv->owner()->getDialogs().hide(name());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user