From: Yuriy Skalko Date: Mon, 21 Dec 2020 11:38:34 +0000 (+0200) Subject: Move Buffer argument from methods to constructor to unify interfaces X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6afb87a682c22a5d587b416afebc7d57842cd5f3;p=features.git Move Buffer argument from methods to constructor to unify interfaces Add Buffer member in InsetExternalParams and InsetGraphicsParams. Remove Buffer argument from string2params and params2string. --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index ec89084de7..dafab28c7b 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1743,9 +1743,9 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr) string const newId = cmd.getArg(0); bool fetchId = newId.empty(); //if we wait for groupId from first graphics inset - InsetGraphicsParams grp_par; + InsetGraphicsParams grp_par(&buffer_); if (!fetchId) - InsetGraphics::string2params(graphics::getGroupParams(buffer_, newId), buffer_, grp_par); + InsetGraphics::string2params(graphics::getGroupParams(buffer_, newId), grp_par); if (!from.nextInset()) //move to closest inset from.forwardInset(); diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index fc555c1375..598413e369 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -1351,7 +1351,7 @@ void pasteClipboardGraphics(Cursor & cur, ErrorList & /* errorList */, // create inset for graphic InsetGraphics * inset = new InsetGraphics(cur.buffer()); - InsetGraphicsParams params; + InsetGraphicsParams params(cur.buffer()); params.filename = support::DocFileName(filename.absFileName(), false); inset->setParams(params); cur.recordUndo(); diff --git a/src/Text3.cpp b/src/Text3.cpp index 25bc7ec249..a59eec8b97 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1387,12 +1387,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) string id = to_utf8(cmd.argument()); string grp = graphics::getGroupParams(bv->buffer(), id); - InsetGraphicsParams tmp, inspar = ins->getParams(); + InsetGraphicsParams tmp(&bv->buffer()), inspar = ins->getParams(); if (id.empty()) inspar.groupId = to_utf8(cmd.argument()); else { - InsetGraphics::string2params(grp, bv->buffer(), tmp); + InsetGraphics::string2params(grp, tmp); tmp.filename = inspar.filename; inspar = tmp; } diff --git a/src/factory.cpp b/src/factory.cpp index 6f17797ada..0fb4f1b8a3 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -312,8 +312,8 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd) } case EXTERNAL_CODE: { - InsetExternalParams iep; - InsetExternal::string2params(to_utf8(cmd.argument()), *buf, iep); + InsetExternalParams iep(buf); + InsetExternal::string2params(to_utf8(cmd.argument()), iep); auto inset = make_unique(buf); inset->setBuffer(*buf); inset->setParams(iep); @@ -321,8 +321,8 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd) } case GRAPHICS_CODE: { - InsetGraphicsParams igp; - InsetGraphics::string2params(to_utf8(cmd.argument()), *buf, igp); + InsetGraphicsParams igp(buf); + InsetGraphics::string2params(to_utf8(cmd.argument()), igp); auto inset = make_unique(buf); inset->setParams(igp); return inset.release(); diff --git a/src/frontends/qt/GuiExternal.cpp b/src/frontends/qt/GuiExternal.cpp index 62c56c982d..25f0e65733 100644 --- a/src/frontends/qt/GuiExternal.cpp +++ b/src/frontends/qt/GuiExternal.cpp @@ -83,7 +83,8 @@ char const * const origin_gui_strs[] = { GuiExternal::GuiExternal(GuiView & lv) - : GuiDialog(lv, "external", qt_("External Material")), bbChanged_(false) + : GuiDialog(lv, "external", qt_("External Material")), + params_(&buffer()), bbChanged_(false) { setupUi(this); @@ -629,20 +630,20 @@ void GuiExternal::applyView() bool GuiExternal::initialiseParams(string const & sdata) { - InsetExternal::string2params(sdata, buffer(), params_); + InsetExternal::string2params(sdata, params_); return true; } void GuiExternal::clearParams() { - params_ = InsetExternalParams(); + params_ = InsetExternalParams(&buffer()); } void GuiExternal::dispatchParams() { - string const lfun = InsetExternal::params2string(params_, buffer()); + string const lfun = InsetExternal::params2string(params_); dispatch(FuncRequest(getLfun(), lfun)); connectToNewInset(); } diff --git a/src/frontends/qt/GuiGraphics.cpp b/src/frontends/qt/GuiGraphics.cpp index 9d045275ad..db911613bc 100644 --- a/src/frontends/qt/GuiGraphics.cpp +++ b/src/frontends/qt/GuiGraphics.cpp @@ -110,7 +110,8 @@ static void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit, GuiGraphics::GuiGraphics(GuiView & lv) - : GuiDialog(lv, "graphics", qt_("Graphics")), bbChanged(false) + : GuiDialog(lv, "graphics", qt_("Graphics")), + bbChanged(false), params_(&buffer()) { setupUi(this); @@ -309,7 +310,8 @@ void GuiGraphics::changeGroup(int /* index */) // group exists: load params into the dialog groupCO->blockSignals(true); - InsetGraphics::string2params(grp, buffer(), params_); + params_.setBuffer(&buffer()); + InsetGraphics::string2params(grp, params_); paramsToDialog(params_); groupCO->blockSignals(false); @@ -752,7 +754,8 @@ bool GuiGraphics::isValid() bool GuiGraphics::initialiseParams(string const & sdata) { - InsetGraphics::string2params(sdata, buffer(), params_); + params_.setBuffer(&buffer()); + InsetGraphics::string2params(sdata, params_); paramsToDialog(params_); current_group_ = params_.groupId; return true; @@ -761,14 +764,15 @@ bool GuiGraphics::initialiseParams(string const & sdata) void GuiGraphics::clearParams() { - params_ = InsetGraphicsParams(); + params_ = InsetGraphicsParams(&buffer()); } void GuiGraphics::dispatchParams() { InsetGraphicsParams tmp_params(params_); - string const lfun = InsetGraphics::params2string(tmp_params, buffer()); + tmp_params.setBuffer(&buffer()); + string const lfun = InsetGraphics::params2string(tmp_params); dispatch(FuncRequest(getLfun(), lfun)); connectToNewInset(); } diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp index 9ca958b5f8..1089247f83 100644 --- a/src/insets/InsetCommand.cpp +++ b/src/insets/InsetCommand.cpp @@ -383,8 +383,8 @@ bool decodeInsetParam(string const & name, string & data, break; } case EXTERNAL_CODE: { - InsetExternalParams p; - data = InsetExternal::params2string(p, buffer); + InsetExternalParams p(&buffer); + data = InsetExternal::params2string(p); break; } case FLOAT_CODE: { @@ -403,8 +403,8 @@ bool decodeInsetParam(string const & name, string & data, break; } case GRAPHICS_CODE: { - InsetGraphicsParams p; - data = InsetGraphics::params2string(p, buffer); + InsetGraphicsParams p(&buffer); + data = InsetGraphics::params2string(p); break; } case MATH_SPACE_CODE: { diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 92308db704..eba8756056 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -117,11 +117,12 @@ support::FileName TempName::operator()() const } // namespace external -InsetExternalParams::InsetExternalParams() +InsetExternalParams::InsetExternalParams(Buffer const * b) : display(true), preview_mode(PREVIEW_OFF), lyxscale(defaultLyxScale), - draft(false) + draft(false), + buffer_(b) { if (defaultTemplateName.empty()) { external::TemplateManager const & etm = @@ -176,13 +177,13 @@ void InsetExternalParams::settemplate(string const & name) } -void InsetExternalParams::write(Buffer const & buf, ostream & os) const +void InsetExternalParams::write(ostream & os) const { os << "External\n" << "\ttemplate " << templatename() << '\n'; if (!filename.empty()) - os << "\tfilename " << filename.outputFileName(buf.filePath()) << '\n'; + os << "\tfilename " << filename.outputFileName(buffer_->filePath()) << '\n'; if (!display) os << "\tdisplay false\n"; @@ -233,7 +234,7 @@ void InsetExternalParams::write(Buffer const & buf, ostream & os) const } -bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex) +void InsetExternalParams::read(Lexer & lex) { enum { EX_TEMPLATE = 1, @@ -286,7 +287,7 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex) case EX_FILENAME: { lex.eatLine(); string const name = lex.getString(); - filename = buffer.getReferencedFileName(name); + filename = buffer_->getReferencedFileName(name); break; } @@ -385,10 +386,12 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex) if (lyxerr.debugging(Debug::EXTERNAL)) { lyxerr << "InsetExternalParams::read:\n"; - write(buffer, lyxerr); + write(lyxerr); } - return !read_error; + if (read_error) + throw ExceptionMessage(WarningException, from_ascii("Read Error: "), + from_ascii("Wrong tag in External inset")); } @@ -419,7 +422,7 @@ docstring screenLabel(InsetExternalParams const & params, InsetExternal::InsetExternal(Buffer * buf) - : Inset(buf), renderer_(new RenderButton) + : Inset(buf), params_(buf), renderer_(new RenderButton) { } @@ -456,25 +459,29 @@ void InsetExternal::doDispatch(Cursor & cur, FuncRequest & cmd) switch (cmd.action()) { case LFUN_INSET_EDIT: { - InsetExternalParams p = params(); + InsetExternalParams p(params()); + p.setBuffer(&buffer()); if (!cmd.argument().empty()) - string2params(to_utf8(cmd.argument()), buffer(), p); + string2params(to_utf8(cmd.argument()), p); external::editExternal(p, buffer()); break; } case LFUN_INSET_MODIFY: { - InsetExternalParams p; - string2params(to_utf8(cmd.argument()), buffer(), p); + InsetExternalParams p(&buffer()); + string2params(to_utf8(cmd.argument()), p); cur.recordUndo(); setParams(p); break; } - case LFUN_INSET_DIALOG_UPDATE: + case LFUN_INSET_DIALOG_UPDATE: { + InsetExternalParams p(params()); + p.setBuffer(&cur.bv().buffer()); cur.bv().updateDialog("external", - params2string(params(), cur.bv().buffer())); + params2string(p)); break; + } default: Inset::doDispatch(cur, cmd); @@ -511,7 +518,9 @@ void InsetExternal::addToToc(DocIterator const & cpit, bool output_active, bool InsetExternal::showInsetDialog(BufferView * bv) const { - bv->showDialog("external", params2string(params(), bv->buffer()), + InsetExternalParams p(params()); + p.setBuffer(&bv->buffer()); + bv->showDialog("external", params2string(p), const_cast(this)); return true; } @@ -681,15 +690,19 @@ void InsetExternal::fileChanged() const void InsetExternal::write(ostream & os) const { - params_.write(buffer(), os); + params_.write(os); } void InsetExternal::read(Lexer & lex) { - InsetExternalParams params; - if (params.read(buffer(), lex)) - setParams(params); + InsetExternalParams params(&buffer()); + try { + params.read(lex); + } catch (ExceptionMessage &) { + return; + } + setParams(params); } @@ -890,10 +903,9 @@ string InsetExternal::contextMenuName() const } -void InsetExternal::string2params(string const & in, Buffer const & buffer, - InsetExternalParams & params) +void InsetExternal::string2params(string const & in, InsetExternalParams & params) { - params = InsetExternalParams(); + params = InsetExternalParams(params.buffer()); if (in.empty()) return; @@ -919,16 +931,15 @@ void InsetExternal::string2params(string const & in, Buffer const & buffer, return; } - params.read(buffer, lex); + params.read(lex); } -string InsetExternal::params2string(InsetExternalParams const & params, - Buffer const & buffer) +string InsetExternal::params2string(InsetExternalParams const & params) { ostringstream data; data << "external" << ' '; - params.write(buffer, data); + params.write(data); data << "\\end_inset\n"; return data.str(); } diff --git a/src/insets/InsetExternal.h b/src/insets/InsetExternal.h index f124445f5e..1649802d07 100644 --- a/src/insets/InsetExternal.h +++ b/src/insets/InsetExternal.h @@ -46,12 +46,16 @@ private: /// hold parameters settable from the GUI -class InsetExternalParams { +class InsetExternalParams : public InsetParams { public: - InsetExternalParams(); + explicit InsetExternalParams(Buffer const * b); + InsetExternalParams(InsetExternalParams const &) = default; - void write(Buffer const &, std::ostream &) const; - bool read(Buffer const &, Lexer &); + void write(std::ostream &) const override; + void read(Lexer &) override; + + Buffer const * buffer() { return buffer_; } + void setBuffer(Buffer const * b) { buffer_ = b; } /// The name of the tempfile used for manipulations. support::FileName tempname() const { return tempname_(); } @@ -82,6 +86,7 @@ public: private: external::TempName tempname_; std::string templatename_; + Buffer const * buffer_; }; @@ -98,11 +103,9 @@ public: /// ~InsetExternal(); /// - static void string2params(std::string const &, Buffer const &, - InsetExternalParams &); + static void string2params(std::string const &, InsetExternalParams &); /// - static std::string params2string(InsetExternalParams const &, - Buffer const &); + static std::string params2string(InsetExternalParams const &); /// InsetExternalParams const & params() const; /// diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 7daa40d9aa..8d56fc9f1c 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -148,8 +148,7 @@ string findTargetFormat(string const & format, OutputParams const & runparams) } -void readInsetGraphics(Lexer & lex, Buffer const & buf, bool allowOrigin, - InsetGraphicsParams & params) +void readInsetGraphics(Lexer & lex, bool allowOrigin, InsetGraphicsParams & params) { bool finished = false; @@ -165,7 +164,7 @@ void readInsetGraphics(Lexer & lex, Buffer const & buf, bool allowOrigin, if (token == "\\end_inset") { finished = true; } else { - if (!params.Read(lex, token, buf, allowOrigin)) + if (!params.read(lex, token, allowOrigin)) lyxerr << "Unknown token, " << token << ", skipping." @@ -178,14 +177,14 @@ void readInsetGraphics(Lexer & lex, Buffer const & buf, bool allowOrigin, InsetGraphics::InsetGraphics(Buffer * buf) - : Inset(buf), graphic_label(xml::uniqueID(from_ascii("graph"))), + : Inset(buf), params_(buf), graphic_label(xml::uniqueID(from_ascii("graph"))), graphic_(new RenderGraphic(this)) { } InsetGraphics::InsetGraphics(InsetGraphics const & ig) - : Inset(ig), + : Inset(ig), params_(nullptr), graphic_label(xml::uniqueID(from_ascii("graph"))), graphic_(new RenderGraphic(*ig.graphic_, this)) { @@ -210,9 +209,10 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd) { switch (cmd.action()) { case LFUN_INSET_EDIT: { - InsetGraphicsParams p = params(); + InsetGraphicsParams p(params()); + p.setBuffer(&buffer()); if (!cmd.argument().empty()) - string2params(to_utf8(cmd.argument()), buffer(), p); + string2params(to_utf8(cmd.argument()), p); editGraphics(p); break; } @@ -223,8 +223,8 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd) break; } - InsetGraphicsParams p; - string2params(to_utf8(cmd.argument()), buffer(), p); + InsetGraphicsParams p(&buffer()); + string2params(to_utf8(cmd.argument()), p); if (p.filename.empty()) { cur.noScreenUpdate(); break; @@ -240,9 +240,12 @@ void InsetGraphics::doDispatch(Cursor & cur, FuncRequest & cmd) break; } - case LFUN_INSET_DIALOG_UPDATE: - cur.bv().updateDialog("graphics", params2string(params(), buffer())); + case LFUN_INSET_DIALOG_UPDATE: { + InsetGraphicsParams p(params()); + p.setBuffer(&buffer()); + cur.bv().updateDialog("graphics", params2string(p)); break; + } case LFUN_GRAPHICS_RELOAD: params_.filename.refresh(); @@ -278,7 +281,9 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd, bool InsetGraphics::showInsetDialog(BufferView * bv) const { - bv->showDialog("graphics", params2string(params(), bv->buffer()), + InsetGraphicsParams p(params()); + p.setBuffer(&bv->buffer()); + bv->showDialog("graphics", params2string(p), const_cast(this)); return true; } @@ -300,7 +305,7 @@ void InsetGraphics::draw(PainterInfo & pi, int x, int y) const void InsetGraphics::write(ostream & os) const { os << "Graphics\n"; - params().Write(os, buffer()); + params().write(os); } @@ -308,7 +313,7 @@ void InsetGraphics::read(Lexer & lex) { lex.setContext("InsetGraphics::read"); //lex >> "Graphics"; - readInsetGraphics(lex, buffer(), true, params_); + readInsetGraphics(lex, true, params_); graphic_->update(params().as_grfxParams()); } @@ -1158,8 +1163,7 @@ string InsetGraphics::contextMenuName() const } -void InsetGraphics::string2params(string const & in, Buffer const & buffer, - InsetGraphicsParams & params) +void InsetGraphics::string2params(string const & in, InsetGraphicsParams & params) { if (in.empty()) return; @@ -1169,17 +1173,16 @@ void InsetGraphics::string2params(string const & in, Buffer const & buffer, lex.setStream(data); lex.setContext("InsetGraphics::string2params"); lex >> "graphics"; - params = InsetGraphicsParams(); - readInsetGraphics(lex, buffer, false, params); + params = InsetGraphicsParams(params.buffer()); + readInsetGraphics(lex, false, params); } -string InsetGraphics::params2string(InsetGraphicsParams const & params, - Buffer const & buffer) +string InsetGraphics::params2string(InsetGraphicsParams const & params) { ostringstream data; data << "graphics" << ' '; - params.Write(data, buffer); + params.write(data); data << "\\end_inset\n"; return data.str(); } @@ -1232,8 +1235,9 @@ string getGroupParams(Buffer const & b, string const & groupId) InsetGraphicsParams const & inspar = ins->getParams(); if (inspar.groupId == groupId) { InsetGraphicsParams tmp = inspar; + tmp.setBuffer(&b); tmp.filename.erase(); - return InsetGraphics::params2string(tmp, b); + return InsetGraphics::params2string(tmp); } } return string(); @@ -1242,8 +1246,8 @@ string getGroupParams(Buffer const & b, string const & groupId) void unifyGraphicsGroups(Buffer & b, string const & argument) { - InsetGraphicsParams params; - InsetGraphics::string2params(argument, b, params); + InsetGraphicsParams params(&b); + InsetGraphics::string2params(argument, params); // This handles undo groups automagically UndoGroupHelper ugh(&b); diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h index 2f0156dfc9..151e4313f2 100644 --- a/src/insets/InsetGraphics.h +++ b/src/insets/InsetGraphics.h @@ -40,11 +40,9 @@ public: /// static void string2params(std::string const & data, - Buffer const & buffer, InsetGraphicsParams &); /// - static std::string params2string(InsetGraphicsParams const &, - Buffer const &); + static std::string params2string(InsetGraphicsParams const &); /** Set the inset parameters, used by the GUIndependent dialog. Return true of new params are different from what was so far. diff --git a/src/insets/InsetGraphicsParams.cpp b/src/insets/InsetGraphicsParams.cpp index 13b57c0775..a33ef66103 100644 --- a/src/insets/InsetGraphicsParams.cpp +++ b/src/insets/InsetGraphicsParams.cpp @@ -35,9 +35,9 @@ using namespace lyx::support; namespace lyx { -InsetGraphicsParams::InsetGraphicsParams() +InsetGraphicsParams::InsetGraphicsParams(Buffer const * b) { - init(); + init(b); } @@ -60,7 +60,7 @@ InsetGraphicsParams & InsetGraphicsParams::operator=(InsetGraphicsParams const & } -void InsetGraphicsParams::init() +void InsetGraphicsParams::init(Buffer const * b) { filename.erase(); lyxscale = 100; // lyx scaling in percentage @@ -80,6 +80,7 @@ void InsetGraphicsParams::init() rotateOrigin.erase(); // Origin of rotation special.erase(); // additional userdefined stuff groupId.clear(); + buffer_ = b; } @@ -103,6 +104,8 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & params) rotateOrigin = params.rotateOrigin; special = params.special; groupId = params.groupId; + + buffer_ = params.buffer_; } @@ -137,11 +140,11 @@ bool operator!=(InsetGraphicsParams const & left, } -void InsetGraphicsParams::Write(ostream & os, Buffer const & buffer) const +void InsetGraphicsParams::write(ostream & os) const { // Do not write the default values if (!filename.empty()) - os << "\tfilename " << filename.outputFileName(buffer.filePath()) << '\n'; + os << "\tfilename " << filename.outputFileName(buffer_->filePath()) << '\n'; if (lyxscale != 100) os << "\tlyxscale " << lyxscale << '\n'; if (!display) @@ -180,15 +183,14 @@ void InsetGraphicsParams::Write(ostream & os, Buffer const & buffer) const } -bool InsetGraphicsParams::Read(Lexer & lex, string const & token, - Buffer const & buf, bool allowOrigin) +bool InsetGraphicsParams::read(Lexer & lex, string const & token, bool allowOrigin) { if (token == "filename") { lex.eatLine(); if (allowOrigin) - filename = buf.getReferencedFileName(lex.getString()); + filename = buffer_->getReferencedFileName(lex.getString()); else - filename.set(lex.getString(), buf.filePath()); + filename.set(lex.getString(), buffer_->filePath()); } else if (token == "lyxscale") { lex.next(); lyxscale = lex.getInteger(); diff --git a/src/insets/InsetGraphicsParams.h b/src/insets/InsetGraphicsParams.h index 1aa0b23d5b..bae4d35982 100644 --- a/src/insets/InsetGraphicsParams.h +++ b/src/insets/InsetGraphicsParams.h @@ -13,6 +13,7 @@ #ifndef INSETGRAPHICSPARAMS_H #define INSETGRAPHICSPARAMS_H +#include "insets/InsetParams.h" #include "graphics/GraphicsParams.h" @@ -62,35 +63,40 @@ public: std::string rotateOrigin; /// any userdefined special command std::string special; + /// + Buffer const * buffer_; /// Does this need to be handled specifically /// in dark mode? (use by InsetInfo) bool darkModeSensitive; /// - InsetGraphicsParams(); + InsetGraphicsParams(Buffer const * b); /// InsetGraphicsParams(InsetGraphicsParams const &); /// InsetGraphicsParams & operator=(InsetGraphicsParams const &); /// Save the parameters in the LyX format stream. /// Buffer is needed to figure out if a figure is embedded. - void Write(std::ostream & os, Buffer const & buf) const; + void write(std::ostream & os) const; /// If the token belongs to our parameters, read it. - bool Read(Lexer & lex, std::string const & token, Buffer const & buf, - bool allowOrigin); + bool read(Lexer & lex, std::string const & token, bool allowOrigin); /// convert // Only a subset of InsetGraphicsParams is needed for display purposes. // This function also interrogates lyxrc to ascertain whether // to display or not. graphics::Params as_grfxParams() const; + /// + Buffer const * buffer() { return buffer_; } + /// + void setBuffer(Buffer const * b) { buffer_ = b; } // FIXME UNICODE. Write functions need to use odostream instead of ostream firstly. /// Identification of the graphics template. No template equals empty string. std::string groupId; private: /// Initialize the object to a default status. - void init(); + void init(Buffer const * b); /// Copy the other objects content to us, used in copy c-tor and assignment void copy(InsetGraphicsParams const & params); }; diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index 819d8ff62e..dc321d6e4b 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -1073,7 +1073,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype, bool cons } } InsetGraphics * inset = new InsetGraphics(buffer_); - InsetGraphicsParams igp; + InsetGraphicsParams igp(buffer_); igp.filename = file; igp.lyxscale = percent_scale; igp.scale = string();