mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
The inset mailers' inset2string function now requires a Buffer const & arg.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7351 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5a714d510d
commit
7668244a77
@ -1,3 +1,8 @@
|
||||
2003-07-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* factory.C (createInset): changed interface to the external and
|
||||
graphics mailers' string2params functions.
|
||||
|
||||
2003-07-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* factory.C (createInset): pass a
|
||||
|
@ -198,7 +198,7 @@ Inset * createInset(FuncRequest const & cmd)
|
||||
return inset;
|
||||
|
||||
} else if (name == "external") {
|
||||
Buffer const * buffer = cmd.view()->buffer();
|
||||
Buffer const & buffer = *cmd.view()->buffer();
|
||||
InsetExternal::Params iep;
|
||||
InsetExternalMailer::string2params(cmd.argument,
|
||||
buffer, iep);
|
||||
@ -207,10 +207,10 @@ Inset * createInset(FuncRequest const & cmd)
|
||||
return inset;
|
||||
|
||||
} else if (name == "graphics") {
|
||||
string const fpath = cmd.view()->buffer()->filePath();
|
||||
Buffer const & buffer = *cmd.view()->buffer();
|
||||
InsetGraphicsParams igp;
|
||||
InsetGraphicsMailer::string2params(cmd.argument, fpath,
|
||||
igp);
|
||||
InsetGraphicsMailer::string2params(cmd.argument,
|
||||
buffer, igp);
|
||||
InsetGraphics * inset = new InsetGraphics;
|
||||
inset->setParams(igp);
|
||||
return inset;
|
||||
|
@ -1,3 +1,11 @@
|
||||
2003-07-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlExternal.C: pass a Buffer const & rather than a Buffer const *
|
||||
to the mailer's string2params, params2string functions.
|
||||
|
||||
* ControlGraphics.C pass a Buffer const & rather than a string const &
|
||||
buffer_path to the mailer's string2params, params2string functions.
|
||||
|
||||
2003-07-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Kernel.[Ch] (bufferFilepath): new wrapper for Buffer::filePath.
|
||||
|
@ -36,7 +36,7 @@ ControlExternal::ControlExternal(Dialog & parent)
|
||||
bool ControlExternal::initialiseParams(string const & data)
|
||||
{
|
||||
params_.reset(new InsetExternal::Params);
|
||||
InsetExternalMailer::string2params(data, kernel().buffer(), *params_);
|
||||
InsetExternalMailer::string2params(data, *kernel().buffer(), *params_);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -49,8 +49,8 @@ void ControlExternal::clearParams()
|
||||
|
||||
void ControlExternal::dispatchParams()
|
||||
{
|
||||
string const lfun =
|
||||
InsetExternalMailer::params2string(params(), kernel().buffer());
|
||||
string const lfun = InsetExternalMailer::params2string(params(),
|
||||
*kernel().buffer());
|
||||
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ void ControlExternal::editExternal()
|
||||
|
||||
dialog().view().apply();
|
||||
string const lfun =
|
||||
InsetExternalMailer::params2string(params(), kernel().buffer());
|
||||
InsetExternalMailer::params2string(params(), *kernel().buffer());
|
||||
kernel().dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun));
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,8 @@ ControlGraphics::ControlGraphics(Dialog & parent)
|
||||
|
||||
bool ControlGraphics::initialiseParams(string const & data)
|
||||
{
|
||||
string const bufpath = kernel().bufferFilepath();
|
||||
InsetGraphicsParams params;
|
||||
InsetGraphicsMailer::string2params(data, bufpath, params);
|
||||
InsetGraphicsMailer::string2params(data, *kernel().buffer(), params);
|
||||
params_.reset(new InsetGraphicsParams(params));
|
||||
return true;
|
||||
}
|
||||
@ -65,10 +64,9 @@ void ControlGraphics::clearParams()
|
||||
|
||||
void ControlGraphics::dispatchParams()
|
||||
{
|
||||
string const buffer_path = kernel().bufferFilepath();
|
||||
InsetGraphicsParams tmp_params(params());
|
||||
string const lfun =
|
||||
InsetGraphicsMailer::params2string(tmp_params, buffer_path);
|
||||
InsetGraphicsMailer::params2string(tmp_params, *kernel().buffer());
|
||||
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
2003-07-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* mailinset.[Ch] (inset2string):
|
||||
* insetcommand.[Ch] (inset2string):
|
||||
* insetert.[Ch] (inset2string):
|
||||
* insetexternal.[Ch] (inset2string):
|
||||
* insetfloat.[Ch] (inset2string):
|
||||
* insetgraphics.[Ch] (inset2string):
|
||||
* insetinclude.[Ch] (inset2string):
|
||||
* insetminipage.[Ch] (inset2string):
|
||||
* insetnote.[Ch] (inset2string):
|
||||
* insettabular.[Ch] (inset2string):
|
||||
* insetwrap.[Ch] (inset2string): now requires a Buffer const & arg.
|
||||
|
||||
* insetexternal.[Ch]:
|
||||
* insetgraphics.[Ch]: get rid of the view() function. Associated
|
||||
changes to the mailers' string2params and params2string functions.
|
||||
|
||||
2003-07-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetexternal.[Ch]: store the external file name in a FileName
|
||||
|
@ -126,7 +126,7 @@ InsetCommandMailer::InsetCommandMailer(string const & name,
|
||||
{}
|
||||
|
||||
|
||||
string const InsetCommandMailer::inset2string() const
|
||||
string const InsetCommandMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(name(), inset_.params());
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(string const &, InsetCommandParams &);
|
||||
///
|
||||
|
@ -654,7 +654,7 @@ InsetERTMailer::InsetERTMailer(InsetERT & inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetERTMailer::inset2string() const
|
||||
string const InsetERTMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(inset_.status());
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(string const &, InsetERT::ERTStatus &);
|
||||
///
|
||||
|
@ -128,17 +128,17 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
|
||||
case LFUN_EXTERNAL_EDIT: {
|
||||
Assert(cmd.view());
|
||||
|
||||
Buffer const * buffer = cmd.view()->buffer();
|
||||
Buffer const & buffer = *cmd.view()->buffer();
|
||||
InsetExternal::Params p;
|
||||
InsetExternalMailer::string2params(cmd.argument, buffer, p);
|
||||
editExternal(p, buffer);
|
||||
editExternal(p, &buffer);
|
||||
return DISPATCHED_NOUPDATE;
|
||||
}
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
Assert(cmd.view());
|
||||
|
||||
Buffer const * buffer = cmd.view()->buffer();
|
||||
Buffer const & buffer = *cmd.view()->buffer();
|
||||
InsetExternal::Params p;
|
||||
InsetExternalMailer::string2params(cmd.argument, buffer, p);
|
||||
setParams(p);
|
||||
@ -261,12 +261,6 @@ void InsetExternal::setParams(Params const & p)
|
||||
}
|
||||
|
||||
|
||||
BufferView * InsetExternal::view() const
|
||||
{
|
||||
return renderer_->view();
|
||||
}
|
||||
|
||||
|
||||
string const InsetExternal::editMessage() const
|
||||
{
|
||||
return getScreenLabel(params_);
|
||||
@ -620,17 +614,14 @@ InsetExternalMailer::InsetExternalMailer(InsetExternal & inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetExternalMailer::inset2string() const
|
||||
string const InsetExternalMailer::inset2string(Buffer const & buffer) const
|
||||
{
|
||||
BufferView * bv = inset_.view();
|
||||
if (!bv)
|
||||
return string();
|
||||
return params2string(inset_.params(), bv->buffer());
|
||||
return params2string(inset_.params(), buffer);
|
||||
}
|
||||
|
||||
|
||||
void InsetExternalMailer::string2params(string const & in,
|
||||
Buffer const * buffer,
|
||||
Buffer const & buffer,
|
||||
InsetExternal::Params & params)
|
||||
{
|
||||
params = InsetExternal::Params();
|
||||
@ -660,7 +651,7 @@ void InsetExternalMailer::string2params(string const & in,
|
||||
|
||||
if (lex.isOK()) {
|
||||
InsetExternal inset;
|
||||
inset.read(buffer, lex);
|
||||
inset.read(&buffer, lex);
|
||||
params = inset.params();
|
||||
}
|
||||
}
|
||||
@ -668,13 +659,13 @@ void InsetExternalMailer::string2params(string const & in,
|
||||
|
||||
string const
|
||||
InsetExternalMailer::params2string(InsetExternal::Params const & params,
|
||||
Buffer const * buffer)
|
||||
Buffer const & buffer)
|
||||
{
|
||||
InsetExternal inset;
|
||||
inset.setParams(params);
|
||||
ostringstream data;
|
||||
data << name_ << ' ';
|
||||
inset.write(buffer, data);
|
||||
inset.write(&buffer, data);
|
||||
data << "\\end_inset\n";
|
||||
return STRCONV(data.str());
|
||||
}
|
||||
|
@ -92,8 +92,6 @@ public:
|
||||
/// Set the inset parameters.
|
||||
virtual void setParams(Params const &);
|
||||
|
||||
virtual BufferView * view() const;
|
||||
|
||||
/** update the file represented by the template.
|
||||
If \param external_in_tmpdir == true, then the generated file is
|
||||
place in the buffer's temporary directory.
|
||||
@ -134,13 +132,13 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(string const &, Buffer const *,
|
||||
static void string2params(string const &, Buffer const &,
|
||||
InsetExternal::Params &);
|
||||
///
|
||||
static string const params2string(InsetExternal::Params const &,
|
||||
Buffer const *);
|
||||
Buffer const &);
|
||||
private:
|
||||
///
|
||||
static string const name_;
|
||||
|
@ -388,7 +388,7 @@ InsetFloatMailer::InsetFloatMailer(InsetFloat & inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetFloatMailer::inset2string() const
|
||||
string const InsetFloatMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(inset_.params());
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(string const &, InsetFloatParams &);
|
||||
///
|
||||
|
@ -177,9 +177,9 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
string const bufpath = cmd.view()->buffer()->filePath();
|
||||
Buffer const & buffer = *cmd.view()->buffer();
|
||||
InsetGraphicsParams p;
|
||||
InsetGraphicsMailer::string2params(cmd.argument, bufpath, p);
|
||||
InsetGraphicsMailer::string2params(cmd.argument, buffer, p);
|
||||
if (!p.filename.empty()) {
|
||||
setParams(p);
|
||||
cmd.view()->updateInset(this);
|
||||
@ -610,12 +610,6 @@ InsetGraphicsParams const & InsetGraphics::params() const
|
||||
}
|
||||
|
||||
|
||||
BufferView * InsetGraphics::view() const
|
||||
{
|
||||
return graphic_->view();
|
||||
}
|
||||
|
||||
|
||||
string const InsetGraphicsMailer::name_("graphics");
|
||||
|
||||
InsetGraphicsMailer::InsetGraphicsMailer(InsetGraphics & inset)
|
||||
@ -623,17 +617,14 @@ InsetGraphicsMailer::InsetGraphicsMailer(InsetGraphics & inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetGraphicsMailer::inset2string() const
|
||||
string const InsetGraphicsMailer::inset2string(Buffer const & buffer) const
|
||||
{
|
||||
BufferView * bv = inset_.view();
|
||||
if (bv)
|
||||
return params2string(inset_.params(), bv->buffer()->filePath());
|
||||
return string();
|
||||
return params2string(inset_.params(), buffer);
|
||||
}
|
||||
|
||||
|
||||
void InsetGraphicsMailer::string2params(string const & in,
|
||||
string const & buffer_path,
|
||||
Buffer const & buffer,
|
||||
InsetGraphicsParams & params)
|
||||
{
|
||||
params = InsetGraphicsParams();
|
||||
@ -654,7 +645,7 @@ void InsetGraphicsMailer::string2params(string const & in,
|
||||
|
||||
if (lex.isOK()) {
|
||||
InsetGraphics inset;
|
||||
inset.readInsetGraphics(lex, buffer_path);
|
||||
inset.readInsetGraphics(lex, buffer.filePath());
|
||||
params = inset.params();
|
||||
}
|
||||
}
|
||||
@ -662,11 +653,11 @@ void InsetGraphicsMailer::string2params(string const & in,
|
||||
|
||||
string const
|
||||
InsetGraphicsMailer::params2string(InsetGraphicsParams const & params,
|
||||
string const & buffer_path)
|
||||
Buffer const & buffer)
|
||||
{
|
||||
ostringstream data;
|
||||
data << name_ << ' ';
|
||||
params.Write(data, buffer_path);
|
||||
params.Write(data, buffer.filePath());
|
||||
data << "\\end_inset\n";
|
||||
return STRCONV(data.str());
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ public:
|
||||
/// Get the inset parameters, used by the GUIndependent dialog.
|
||||
InsetGraphicsParams const & params() const;
|
||||
|
||||
virtual BufferView * view() const;
|
||||
private:
|
||||
///
|
||||
friend class InsetGraphicsMailer;
|
||||
@ -120,14 +119,14 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(string const & data,
|
||||
string const & buffer_path,
|
||||
Buffer const & buffer,
|
||||
InsetGraphicsParams &);
|
||||
///
|
||||
static string const params2string(InsetGraphicsParams const &,
|
||||
string const & buffer_path);
|
||||
Buffer const &);
|
||||
private:
|
||||
///
|
||||
static string const name_;
|
||||
|
@ -611,7 +611,7 @@ InsetIncludeMailer::InsetIncludeMailer(InsetInclude & inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetIncludeMailer::inset2string() const
|
||||
string const InsetIncludeMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(inset_.params());
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(string const &, InsetInclude::Params &);
|
||||
///
|
||||
|
@ -316,7 +316,7 @@ InsetMinipageMailer::InsetMinipageMailer(InsetMinipage & inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetMinipageMailer::inset2string() const
|
||||
string const InsetMinipageMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(inset_.params());
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(string const &, InsetMinipage::Params &);
|
||||
///
|
||||
|
@ -216,7 +216,7 @@ InsetNoteMailer::InsetNoteMailer(string const & name,
|
||||
}
|
||||
|
||||
|
||||
string const InsetNoteMailer::inset2string() const
|
||||
string const InsetNoteMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(name_, inset_.params());
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static string const params2string(string const &, InsetNoteParams const &);
|
||||
///
|
||||
|
@ -2744,7 +2744,7 @@ InsetTabularMailer::InsetTabularMailer(InsetTabular const & inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetTabularMailer::inset2string() const
|
||||
string const InsetTabularMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(inset_);
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
/// Returns the active cell if successful, else -1.
|
||||
static int string2params(string const &, InsetTabular &);
|
||||
///
|
||||
|
@ -260,7 +260,7 @@ InsetWrapMailer::InsetWrapMailer(InsetWrap & inset)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetWrapMailer::inset2string() const
|
||||
string const InsetWrapMailer::inset2string(Buffer const &) const
|
||||
{
|
||||
return params2string(inset_.params());
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
///
|
||||
virtual string const & name() const { return name_; }
|
||||
///
|
||||
virtual string const inset2string() const;
|
||||
virtual string const inset2string(Buffer const &) const;
|
||||
///
|
||||
static void string2params(string const &, InsetWrapParams &);
|
||||
///
|
||||
|
@ -24,7 +24,8 @@ using namespace lyx::support;
|
||||
void MailInset::showDialog(BufferView * bv) const
|
||||
{
|
||||
Assert(bv);
|
||||
bv->owner()->getDialogs().show(name(), inset2string(), &inset());
|
||||
bv->owner()->getDialogs().show(name(), inset2string(*bv->buffer()),
|
||||
&inset());
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +33,8 @@ void MailInset::updateDialog(BufferView * bv) const
|
||||
{
|
||||
Assert(bv);
|
||||
if(bv->owner()->getDialogs().visible(name()))
|
||||
bv->owner()->getDialogs().update(name(), inset2string());
|
||||
bv->owner()->getDialogs().update(name(),
|
||||
inset2string(*bv->buffer()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
class InsetBase;
|
||||
class Buffer;
|
||||
class BufferView;
|
||||
|
||||
|
||||
@ -31,7 +32,7 @@ public:
|
||||
///
|
||||
void hideDialog() const;
|
||||
///
|
||||
virtual string const inset2string() const = 0;
|
||||
virtual string const inset2string(Buffer const &) const = 0;
|
||||
|
||||
protected:
|
||||
///
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
return theName;
|
||||
}
|
||||
///
|
||||
virtual string const inset2string() const
|
||||
virtual string const inset2string(Buffer const &) const
|
||||
{
|
||||
ostringstream data;
|
||||
//data << name() << " active_cell " << inset.getActCell() << '\n';
|
||||
|
Loading…
x
Reference in New Issue
Block a user