+2003-07-21 Angus Leeming <leeming@lyx.org>
+
+ * factory.C (createInset): pass a
+ buffer_path parameter to InsetGraphicsMailer's string2params.
+
2003-07-21 Angus Leeming <leeming@lyx.org>
* BufferView_pimpl.C (buffer):
return inset;
} else if (name == "graphics") {
+ string const fpath = cmd.view()->buffer()->filePath();
InsetGraphicsParams igp;
- InsetGraphicsMailer::string2params(cmd.argument, igp);
+ InsetGraphicsMailer::string2params(cmd.argument, fpath,
+ igp);
InsetGraphics * inset = new InsetGraphics;
inset->setParams(igp);
return inset;
2003-07-21 Angus Leeming <leeming@lyx.org>
- * ControlGraphics.C (readBB): use namespace lyx::graphics rather than grfx shortcut.
+ * ControlGraphics.C (initialiseParams, dispatchParams): pass a
+ buffer_path parameter to InsetGraphicsMailer's string2params,
+ params2string.
+
+2003-07-21 Angus Leeming <leeming@lyx.org>
+
+ * ControlGraphics.C (readBB): use namespace lyx::graphics rather
+ than grfx shortcut.
2003-07-18 Lars Gullik Bjønnes <larsbj@gullik.net>
bool ControlGraphics::initialiseParams(string const & data)
{
+ string const bufpath = kernel().buffer()->filePath();
InsetGraphicsParams params;
- InsetGraphicsMailer::string2params(data, params);
+ InsetGraphicsMailer::string2params(data, bufpath, params);
params_.reset(new InsetGraphicsParams(params));
// make relative for good UI
- params_->filename = MakeRelPath(params_->filename,
- kernel().buffer()->filePath());
+ params_->filename = MakeRelPath(params_->filename, bufpath);
return true;
}
void ControlGraphics::dispatchParams()
{
+ string const buffer_path = kernel().buffer()->filePath();
InsetGraphicsParams tmp_params(params());
// core requires absolute path during runtime
- tmp_params.filename = MakeAbsPath(tmp_params.filename,
- kernel().buffer()->filePath());
- string const lfun = InsetGraphicsMailer::params2string(tmp_params);
+ tmp_params.filename = MakeAbsPath(tmp_params.filename, buffer_path);
+ string const lfun =
+ InsetGraphicsMailer::params2string(tmp_params, buffer_path);
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
+2003-07-21 Angus Leeming <leeming@lyx.org>
+
+ * insetgraphics.[Ch] (string2params, params2string): passed a
+ buffer_path argument.
+ (view): new method.
+
2003-07-21 Angus Leeming <leeming@lyx.org>
* insetexternal.C:
{
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
+ string const bufpath = cmd.view()->buffer()->filePath();
InsetGraphicsParams p;
- InsetGraphicsMailer::string2params(cmd.argument, p);
+ InsetGraphicsMailer::string2params(cmd.argument, bufpath, p);
if (!p.filename.empty()) {
setParams(p);
cmd.view()->updateInset(this);
}
+BufferView * InsetGraphics::view() const
+{
+ return graphic_->view();
+}
+
+
string const InsetGraphicsMailer::name_("graphics");
InsetGraphicsMailer::InsetGraphicsMailer(InsetGraphics & inset)
string const InsetGraphicsMailer::inset2string() const
{
- return params2string(inset_.params());
+ BufferView * bv = inset_.view();
+ if (bv)
+ return params2string(inset_.params(), bv->buffer()->filePath());
+ return string();
}
void InsetGraphicsMailer::string2params(string const & in,
- InsetGraphicsParams & params)
+ string const & buffer_path,
+ InsetGraphicsParams & params)
{
params = InsetGraphicsParams();
if (lex.isOK()) {
InsetGraphics inset;
-#warning FIXME not setting bufpath is dubious
- inset.readInsetGraphics(lex, string());
+ inset.readInsetGraphics(lex, buffer_path);
params = inset.params();
}
}
string const
-InsetGraphicsMailer::params2string(InsetGraphicsParams const & params)
+InsetGraphicsMailer::params2string(InsetGraphicsParams const & params,
+ string const & buffer_path)
{
ostringstream data;
data << name_ << ' ';
-#warning FIXME not setting bufpath is dubious
- params.Write(data, string());
+ params.Write(data, buffer_path);
data << "\\end_inset\n";
return STRCONV(data.str());
}
/// Get the inset parameters, used by the GUIndependent dialog.
InsetGraphicsParams const & params() const;
+ virtual BufferView * view() const;
private:
///
friend class InsetGraphicsMailer;
///
virtual string const inset2string() const;
///
- static void string2params(string const &, InsetGraphicsParams &);
+ static void string2params(string const & data,
+ string const & buffer_path,
+ InsetGraphicsParams &);
///
- static string const params2string(InsetGraphicsParams const &);
+ static string const params2string(InsetGraphicsParams const &,
+ string const & buffer_path);
private:
///
static string const name_;