mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
remove InsetVSpaceMailer class
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23992 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
209b04eaa9
commit
241575ed86
@ -1243,7 +1243,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
case VSPACE_CODE: {
|
||||
VSpace space;
|
||||
data = InsetVSpaceMailer::params2string(space);
|
||||
data = InsetVSpace::params2string(space);
|
||||
break;
|
||||
}
|
||||
case WRAP_CODE: {
|
||||
|
@ -315,7 +315,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
|
||||
|
||||
case VSPACE_CODE: {
|
||||
VSpace vspace;
|
||||
InsetVSpaceMailer::string2params(to_utf8(cmd.argument()), vspace);
|
||||
InsetVSpace::string2params(to_utf8(cmd.argument()), vspace);
|
||||
return new InsetVSpace(vspace);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "LyXRC.h" // to set the default length values
|
||||
#include "Spacing.h"
|
||||
#include "FuncRequest.h"
|
||||
|
||||
#include "insets/InsetVSpace.h"
|
||||
|
||||
#include "support/gettext.h"
|
||||
@ -168,9 +169,8 @@ void GuiVSpace::updateContents()
|
||||
|
||||
bool GuiVSpace::initialiseParams(string const & data)
|
||||
{
|
||||
InsetVSpaceMailer::string2params(data, params_);
|
||||
InsetVSpace::string2params(data, params_);
|
||||
setButtonsValid(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ void GuiVSpace::clearParams()
|
||||
|
||||
void GuiVSpace::dispatchParams()
|
||||
{
|
||||
dispatch(FuncRequest(getLfun(), InsetVSpaceMailer::params2string(params_)));
|
||||
dispatch(FuncRequest(getLfun(), InsetVSpace::params2string(params_)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,17 +14,21 @@
|
||||
#include "InsetVSpace.h"
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "Cursor.h"
|
||||
#include "Dimension.h"
|
||||
#include "DispatchResult.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "FuncStatus.h"
|
||||
#include "support/gettext.h"
|
||||
#include "Lexer.h"
|
||||
#include "Text.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
#include "support/gettext.h"
|
||||
|
||||
#include "frontends/Application.h"
|
||||
#include "frontends/FontMetrics.h"
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
@ -48,7 +52,7 @@ InsetVSpace::InsetVSpace(VSpace const & space)
|
||||
|
||||
InsetVSpace::~InsetVSpace()
|
||||
{
|
||||
InsetVSpaceMailer(*this).hideDialog();
|
||||
hideDialogs("vspace", this);
|
||||
}
|
||||
|
||||
|
||||
@ -57,13 +61,14 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetVSpaceMailer::string2params(to_utf8(cmd.argument()), space_);
|
||||
InsetVSpace::string2params(to_utf8(cmd.argument()), space_);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
if (!cur.selection() && cmd.button() == mouse_button::button1)
|
||||
InsetVSpaceMailer(*this).showDialog(&cur.bv());
|
||||
cur.bv().showDialog("vspace", params2string(space()),
|
||||
const_cast<InsetVSpace *>(this));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -81,10 +86,11 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (cmd.getArg(0) == "vspace") {
|
||||
VSpace vspace;
|
||||
InsetVSpaceMailer::string2params(to_utf8(cmd.argument()), vspace);
|
||||
InsetVSpace::string2params(to_utf8(cmd.argument()), vspace);
|
||||
status.setOnOff(vspace == space_);
|
||||
} else
|
||||
} else {
|
||||
status.enabled(true);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return Inset::getStatus(cur, cmd, status);
|
||||
@ -94,7 +100,8 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
void InsetVSpace::edit(Cursor & cur, bool, EntryDirection)
|
||||
{
|
||||
InsetVSpaceMailer(*this).showDialog(&cur.bv());
|
||||
cur.bv().showDialog("vspace", params2string(space()),
|
||||
const_cast<InsetVSpace *>(this));
|
||||
}
|
||||
|
||||
|
||||
@ -241,21 +248,7 @@ docstring InsetVSpace::contextMenu(BufferView const &, int, int) const
|
||||
}
|
||||
|
||||
|
||||
string const InsetVSpaceMailer::name_ = "vspace";
|
||||
|
||||
|
||||
InsetVSpaceMailer::InsetVSpaceMailer(InsetVSpace & inset)
|
||||
: inset_(inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetVSpaceMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(inset_.space());
|
||||
}
|
||||
|
||||
|
||||
void InsetVSpaceMailer::string2params(string const & in, VSpace & vspace)
|
||||
void InsetVSpace::string2params(string const & in, VSpace & vspace)
|
||||
{
|
||||
vspace = VSpace();
|
||||
if (in.empty())
|
||||
@ -267,8 +260,11 @@ void InsetVSpaceMailer::string2params(string const & in, VSpace & vspace)
|
||||
|
||||
string name;
|
||||
lex >> name;
|
||||
if (!lex || name != name_)
|
||||
return print_mailer_error("InsetVSpaceMailer", in, 1, name_);
|
||||
if (!lex || name != "ert") {
|
||||
LYXERR0("InsetVSPace::string2params(" << in << ")\n"
|
||||
"Expected arg 1 to be \"vspace\"\n");
|
||||
return;
|
||||
}
|
||||
|
||||
string vsp;
|
||||
lex >> vsp;
|
||||
@ -277,10 +273,10 @@ void InsetVSpaceMailer::string2params(string const & in, VSpace & vspace)
|
||||
}
|
||||
|
||||
|
||||
string const InsetVSpaceMailer::params2string(VSpace const & vspace)
|
||||
string InsetVSpace::params2string(VSpace const & vspace)
|
||||
{
|
||||
ostringstream data;
|
||||
data << name_ << ' ' << vspace.asLyXCommand();
|
||||
data << "vspace" << ' ' << vspace.asLyXCommand();
|
||||
return data.str();
|
||||
}
|
||||
|
||||
|
@ -12,15 +12,14 @@
|
||||
#ifndef INSET_VSPACE_H
|
||||
#define INSET_VSPACE_H
|
||||
|
||||
|
||||
#include "Inset.h"
|
||||
#include "VSpace.h"
|
||||
#include "MailInset.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class InsetVSpace : public Inset {
|
||||
class InsetVSpace : public Inset
|
||||
{
|
||||
public:
|
||||
///
|
||||
InsetVSpace() {}
|
||||
@ -38,7 +37,11 @@ public:
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
static void string2params(std::string const &, VSpace &);
|
||||
///
|
||||
static std::string params2string(VSpace const &);
|
||||
private:
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
@ -70,28 +73,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class InsetVSpaceMailer : public MailInset {
|
||||
public:
|
||||
///
|
||||
InsetVSpaceMailer(InsetVSpace & inset);
|
||||
///
|
||||
virtual Inset & inset() const { return inset_; }
|
||||
///
|
||||
virtual std::string const & name() const { return name_; }
|
||||
///
|
||||
virtual std::string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(std::string const &, VSpace &);
|
||||
///
|
||||
static std::string const params2string(VSpace const &);
|
||||
private:
|
||||
///
|
||||
static std::string const name_;
|
||||
///
|
||||
InsetVSpace & inset_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user