icp["before"] = from_utf8(opt1);
icp["literal"] =
from_ascii(InsetCitation::last_literal ? "true" : "false");
- string icstr = InsetCommand::params2string(icp);
+ string icstr = icp.toString();
FuncRequest fr(LFUN_INSET_INSERT, icstr);
lyx::dispatch(fr);
break;
} else
p["name"] = content;
}
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
// we need to have a target. if we already have one, then
// that gets used at the default for the name, too, which
p["name"] = (cmd.argument().empty()) ?
cur.getPossibleLabel() :
cmd.argument();
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
if (cmd.argument().empty()) {
bv->showDialog("label", data);
cur.clearSelection();
} else
p["symbol"] = cmd.argument();
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
bv->showDialog("nomenclature", data);
break;
}
p["type"] = from_ascii("idx");
else
p["type"] = cmd.argument();
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
FuncRequest fr(LFUN_INSET_INSERT, data);
dispatch(cur, fr);
break;
params.sideways = sidewaysCB->isChecked();
params.alignment = getAlignment();
params.placement = getPlacement();
- return from_ascii(InsetFloat::params2string(params));
+ return from_ascii(params.toString());
}
params["label"] = qstring_to_ucs4(label);
params["literal"] = literalCB->isChecked()
? from_ascii("true") : from_ascii("false");
- return from_utf8(InsetCommand::params2string(params));
+ return from_utf8(params.toString());
}
void GuiBibtex::dispatchParams()
{
- std::string const lfun = InsetCommand::params2string(params_);
+ std::string const lfun = params_.toString();
dispatch(FuncRequest(getLfun(), lfun));
connectToNewInset();
}
else
params.backgroundcolor = "none";
- return from_ascii(InsetBox::params2string(params));
+ return from_ascii(params.toString());
}
docstring GuiBranch::dialogToParams() const
{
InsetBranchParams params(qstring_to_ucs4(branchCO->currentText()), invertedCB->isChecked());
- return from_utf8(InsetBranch::params2string(params));
+ return from_utf8(params.toString());
}
void GuiCitation::dispatchParams()
{
- std::string const lfun = InsetCommand::params2string(params_);
+ std::string const lfun = params_.toString();
dispatch(FuncRequest(getLfun(), lfun));
}
params["value"] = convert<docstring>(valueSB->value());
params.setCmdName(fromqstr(actionCB->itemData(actionCB->currentIndex()).toString()));
params["lyxonly"] = from_ascii(lyxonlyXB->isChecked() ? "true" : "false");
- return from_utf8(InsetCounter::params2string(params));
+ return from_utf8(params.toString());
}
void GuiExternal::dispatchParams()
{
- string const lfun = InsetExternal::params2string(params_);
+ string const lfun = params_.toString();
dispatch(FuncRequest(getLfun(), lfun));
connectToNewInset();
}
{
InsetGraphicsParams tmp_params(params_);
tmp_params.setBuffer(&buffer());
- string const lfun = InsetGraphics::params2string(tmp_params);
+ string const lfun = tmp_params.toString();
dispatch(FuncRequest(getLfun(), lfun));
connectToNewInset();
}
} else if (item == "visible")
params.kind = InsetSpaceParams::VISIBLE;
- return from_ascii(InsetSpace::params2string(params));
+ return from_ascii(params.toString());
}
params["literal"] = literalCB->isChecked()
? from_ascii("true") : from_ascii("false");
params.setCmdName("href");
- return from_utf8(InsetHyperlink::params2string(params));
+ return from_utf8(params.toString());
}
void GuiInclude::dispatchParams()
{
- std::string const lfun = InsetCommand::params2string(params_);
+ std::string const lfun = params_.toString();
dispatch(FuncRequest(getLfun(), lfun));
}
void GuiIndex::dispatchParams()
{
- dispatch(FuncRequest(getLfun(), InsetIndex::params2string(params_)));
+ dispatch(FuncRequest(getLfun(), params_.toString()));
}
{
InsetCommandParams params(insetCode());
params["name"] = qstring_to_ucs4(keywordED->text());
- return from_utf8(InsetLabel::params2string(params));
+ return from_utf8(params.toString());
}
params["width"] = from_utf8(widgetsToLength(WidthLE, WidthUnitCO));
params["height"] = from_utf8(widgetsToLength(HeightLE, HeightUnitCO));
params.setCmdName("rule");
- return from_ascii(InsetLine::params2string(params));
+ return from_ascii(params.toString());
}
void GuiListings::dispatchParams()
{
- string const lfun = InsetListings::params2string(params_);
+ string const lfun = params_.toString();
dispatch(FuncRequest(getLfun(), lfun));
}
params["description"] = qstring_to_ucs4(description);
params["literal"] = literalCB->isChecked()
? from_ascii("true") : from_ascii("false");
- return from_utf8(InsetNomencl::params2string(params));
+ return from_utf8(params.toString());
}
void GuiNote::dispatchParams()
{
- dispatch(FuncRequest(getLfun(), InsetNote::params2string(params_)));
+ dispatch(FuncRequest(getLfun(), params_.toString()));
}
void GuiPhantom::dispatchParams()
{
- dispatch(FuncRequest(getLfun(), InsetPhantom::params2string(params_)));
+ dispatch(FuncRequest(getLfun(), params_.toString()));
}
if (set_width == from_ascii("custom"))
width = from_utf8(widgetsToLength(valueLE, unitLC));
params["width"] = width;
- return from_ascii(InsetNomencl::params2string(params));
+ return from_ascii(params.toString());
}
void GuiPrintindex::dispatchParams()
{
- std::string const lfun = InsetCommand::params2string(params_);
+ std::string const lfun = params_.toString();
dispatch(FuncRequest(getLfun(), lfun));
}
void GuiRef::dispatchParams()
{
- std::string const lfun = InsetCommand::params2string(params_);
+ std::string const lfun = params_.toString();
dispatch(FuncRequest(getLfun(), lfun));
connectToNewInset();
}
void GuiWrap::dispatchParams()
{
- string const lfun = InsetWrap::params2string(params_);
+ string const lfun = params_.toString();
dispatch(FuncRequest(getLfun(), lfun));
}
if (listof) {
InsetCommandParams p(INDEX_PRINT_CODE);
p["type"] = cit->shortcut();
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(cit->index()),
FuncRequest(LFUN_INSET_MODIFY, data)));
} else {
}
-string InsetBox::params2string(InsetBoxParams const & params)
+string InsetBoxParams::toString() const
{
ostringstream data;
data << "box" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
void write(std::ostream & os) const override;
///
void read(Lexer & lex) override;
+ ///
+ std::string toString() const override;
///
std::string type;
///
InsetBox(Buffer *, std::string const &);
- ///
- static std::string params2string(InsetBoxParams const &);
///
static void string2params(std::string const &, InsetBoxParams &);
///
}
-string InsetBranch::params2string(InsetBranchParams const & params)
+string InsetBranchParams::toString() const
{
ostringstream data;
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+ ///
docstring branch;
///
bool inverted;
///
InsetBranch(Buffer *, InsetBranchParams const &);
- ///
- static std::string params2string(InsetBranchParams const &);
///
static void string2params(std::string const &, InsetBranchParams &);
///
InsetCommandParams p(p_.code());
p = p_;
p.setCmdName(new_name);
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
} else
if (buffer().masterParams().track_changes) {
// With change tracking, we insert a new inset and
// delete the old one
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
cur.forceBufferUpdate();
case LFUN_INSET_DIALOG_UPDATE: {
string const name = to_utf8(cmd.argument());
- cur.bv().updateDialog(name, params2string(params()));
+ cur.bv().updateDialog(name, params().toString());
break;
}
bool InsetCommand::showInsetDialog(BufferView * bv) const
{
if (p_.code() != NO_CODE)
- bv->showDialog(insetName(p_.code()), params2string(p_),
+ bv->showDialog(insetName(p_.code()), p_.toString(),
const_cast<InsetCommand *>(this));
return true;
}
}
-string InsetCommand::params2string(InsetCommandParams const & params)
-{
- ostringstream data;
- data << insetName(params.code()) << ' ';
- params.write(data);
- data << "\\end_inset\n";
- return data.str();
-}
-
-
bool decodeInsetParam(string const & name, string & data,
Buffer const & buffer)
{
case TOC_CODE:
case HYPERLINK_CODE:
case COUNTER_CODE: {
- InsetCommandParams p(code);
- data = InsetCommand::params2string(p);
+ data = InsetCommandParams(code).toString();
break;
}
case INCLUDE_CODE: {
if (data.empty())
// default type is requested
data = "include";
- InsetCommandParams p(INCLUDE_CODE, data);
- data = InsetCommand::params2string(p);
+ data = InsetCommandParams(INCLUDE_CODE, data).toString();
break;
}
case BOX_CODE: {
// \c data == "Boxed" || "Frameless" etc
- InsetBoxParams p(data);
- data = InsetBox::params2string(p);
+ data = InsetBoxParams(data).toString();
break;
}
case BRANCH_CODE: {
- InsetBranchParams p;
- data = InsetBranch::params2string(p);
+ data = InsetBranchParams().toString();
break;
}
case CITE_CODE: {
- InsetCommandParams p(CITE_CODE);
- data = InsetCommand::params2string(p);
+ data = InsetCommandParams(CITE_CODE).toString();
break;
}
case ERT_CODE: {
break;
}
case EXTERNAL_CODE: {
- InsetExternalParams p(&buffer);
- data = InsetExternal::params2string(p);
+ data = InsetExternalParams(&buffer).toString();
break;
}
case FLOAT_CODE: {
- InsetFloatParams p;
- data = InsetFloat::params2string(p);
+ data = InsetFloatParams().toString();
break;
}
case INDEX_CODE: {
- InsetIndexParams p;
- data = InsetIndex::params2string(p);
+ data = InsetIndexParams().toString();
break;
}
case LISTINGS_CODE: {
- InsetListingsParams p;
- data = InsetListings::params2string(p);
+ data = InsetListingsParams().toString();
break;
}
case GRAPHICS_CODE: {
- InsetGraphicsParams p(&buffer);
- data = InsetGraphics::params2string(p);
+ data = InsetGraphicsParams(&buffer).toString();
break;
}
case MATH_SPACE_CODE: {
- InsetSpaceParams p(true);
- data = InsetSpace::params2string(p);
+ data = InsetSpaceParams(true).toString();
break;
}
case NOTE_CODE: {
- InsetNoteParams p;
- data = InsetNote::params2string(p);
+ data = InsetNoteParams().toString();
break;
}
case PHANTOM_CODE: {
- InsetPhantomParams p;
- data = InsetPhantom::params2string(p);
+ data = InsetPhantomParams().toString();
break;
}
case SPACE_CODE: {
- InsetSpaceParams p;
- data = InsetSpace::params2string(p);
+ data = InsetSpaceParams().toString();
break;
}
case VSPACE_CODE: {
break;
}
case WRAP_CODE: {
- InsetWrapParams p;
- data = InsetWrap::params2string(p);
+ data = InsetWrapParams().toString();
break;
}
default:
static bool string2params(std::string const & data,
InsetCommandParams &);
///
- static std::string params2string(InsetCommandParams const &);
- ///
InsetCommandParams const & params() const { return p_; }
///
void setParams(InsetCommandParams const &);
}
+string InsetCommandParams::toString() const
+{
+ ostringstream data;
+ data << insetName(code()) << ' ';
+ write(data);
+ data << "\\end_inset\n";
+ return data.str();
+}
+
+
docstring const & InsetCommandParams::operator[](string const & name) const
{
static const docstring dummy;
void write(std::ostream &) const override;
///
void Write(std::ostream & os, Buffer const * buf) const;
+ ///
+ std::string toString() const override;
/// Build the complete LaTeX command
docstring getCommand(OutputParams const &) const;
/// Return the command name
case LFUN_INSET_DIALOG_UPDATE: {
InsetExternalParams p(params());
p.setBuffer(&cur.bv().buffer());
- cur.bv().updateDialog("external",
- params2string(p));
+ cur.bv().updateDialog("external", p.toString());
break;
}
{
InsetExternalParams p(params());
p.setBuffer(&bv->buffer());
- bv->showDialog("external", params2string(p),
+ bv->showDialog("external", p.toString(),
const_cast<InsetExternal *>(this));
return true;
}
}
-string InsetExternal::params2string(InsetExternalParams const & params)
+string InsetExternalParams::toString() const
{
ostringstream data;
data << "external" << ' ';
- params.write(data);
+ write(data);
data << "\\end_inset\n";
return data.str();
}
void write(std::ostream &) const override;
void read(Lexer &) override;
+ std::string toString() const override;
Buffer const * buffer() { return buffer_; }
void setBuffer(Buffer const * b) { buffer_ = b; }
///
static void string2params(std::string const &, InsetExternalParams &);
///
- static std::string params2string(InsetExternalParams const &);
- ///
InsetExternalParams const & params() const;
///
void setParams(InsetExternalParams const &);
}
case LFUN_INSET_DIALOG_UPDATE: {
- cur.bv().updateDialog("float", params2string(params()));
+ cur.bv().updateDialog("float", params().toString());
break;
}
{
if (type.empty()) {
// Better this than creating a parse error. This in fact happens in the
- // parameters dialog via InsetFloatParams::params2string.
+ // parameters dialog via InsetFloatParams::toString.
os << "senseless" << '\n';
} else
os << type << '\n';
}
-string InsetFloat::params2string(InsetFloatParams const & params)
+string InsetFloatParams::toString() const
{
ostringstream data;
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+ ///
std::string type;
///
std::string placement;
///
static void string2params(std::string const &, InsetFloatParams &);
///
- static std::string params2string(InsetFloatParams const &);
- ///
void setWide(bool w, bool update_label = true);
///
void setSideways(bool s, bool update_label = true);
switch (cmd.action()) {
case LFUN_MOUSE_RELEASE:
if (!cur.selection() && cmd.button() == mouse_button::button1) {
- cur.bv().showDialog("toc", params2string(params()));
+ cur.bv().showDialog("toc", params().toString());
cur.dispatched();
}
break;
case LFUN_INSET_DIALOG_UPDATE: {
InsetGraphicsParams p(params());
p.setBuffer(&buffer());
- cur.bv().updateDialog("graphics", params2string(p));
+ cur.bv().updateDialog("graphics", p.toString());
break;
}
{
InsetGraphicsParams p(params());
p.setBuffer(&bv->buffer());
- bv->showDialog("graphics", params2string(p),
+ bv->showDialog("graphics", p.toString(),
const_cast<InsetGraphics *>(this));
return true;
}
}
-string InsetGraphics::params2string(InsetGraphicsParams const & params)
-{
- ostringstream data;
- data << "graphics" << ' ';
- params.write(data);
- data << "\\end_inset\n";
- return data.str();
-}
-
-
docstring InsetGraphics::toolTip(BufferView const &, int, int) const
{
return from_utf8(params().filename.onlyFileName());
InsetGraphicsParams tmp = inspar;
tmp.setBuffer(&b);
tmp.filename.erase();
- return InsetGraphics::params2string(tmp);
+ return tmp.toString();
}
}
return string();
///
static void string2params(std::string const & data,
InsetGraphicsParams &);
- ///
- 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.
#include "support/Translator.h"
#include <ostream>
+#include <sstream>
using namespace std;
using namespace lyx::support;
}
+string InsetGraphicsParams::toString() const
+{
+ ostringstream data;
+ data << "graphics" << ' ';
+ write(data);
+ data << "\\end_inset\n";
+ return data.str();
+}
+
+
graphics::Params InsetGraphicsParams::as_grfxParams() const
{
graphics::Params pars;
void write(std::ostream & os) const;
/// If the token belongs to our parameters, read it.
bool read(Lexer & lex, std::string const & token, bool allowOrigin);
+ ///
+ std::string toString() const;
/// convert
// Only a subset of InsetGraphicsParams is needed for display purposes.
// This function also interrogates lyxrc to ascertain whether
}
-string InsetIPADeco::params2string(InsetIPADecoParams const & params)
+string InsetIPADecoParams::toString() const
{
ostringstream data;
data << "IPADeco" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+ ///
Type type;
};
///
~InsetIPADeco();
///
- static std::string params2string(InsetIPADecoParams const &);
- ///
static void string2params(std::string const &, InsetIPADecoParams &);
///
InsetIPADecoParams const & params() const { return params_; }
bool InsetIndex::showInsetDialog(BufferView * bv) const
{
- bv->showDialog("index", params2string(params_),
+ bv->showDialog("index", params_.toString(),
const_cast<InsetIndex *>(this));
return true;
}
}
case LFUN_INSET_DIALOG_UPDATE:
- cur.bv().updateDialog("index", params2string(params_));
+ cur.bv().updateDialog("index", params_.toString());
break;
default:
}
-string InsetIndex::params2string(InsetIndexParams const & params)
+string InsetIndexParams::toString() const
{
ostringstream data;
data << "index";
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+
docstring index;
};
///
InsetIndex(Buffer *, InsetIndexParams const &);
///
- static std::string params2string(InsetIndexParams const &);
- ///
static void string2params(std::string const &, InsetIndexParams &);
private:
///
// delete the old one
InsetCommandParams p(LABEL_CODE, "label");
p["name"] = label;
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
} else
case LFUN_LABEL_INSERT_AS_REFERENCE: {
InsetCommandParams p(REF_CODE, "ref");
p["reference"] = getParam("name");
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
break;
}
}
case LFUN_INSET_DIALOG_UPDATE:
- cur.bv().updateDialog("listings", params2string(params()));
+ cur.bv().updateDialog("listings", params().toString());
break;
default:
bool InsetListings::showInsetDialog(BufferView * bv) const
{
- bv->showDialog("listings", params2string(params()),
+ bv->showDialog("listings", params().toString(),
const_cast<InsetListings *>(this));
return true;
}
}
-string InsetListings::params2string(InsetListingsParams const & params)
-{
- ostringstream data;
- data << "listings" << ' ';
- params.write(data);
- return data.str();
-}
-
-
} // namespace lyx
~InsetListings();
///
static void string2params(std::string const &, InsetListingsParams &);
- ///
- static std::string params2string(InsetListingsParams const &);
private:
///
bool isLabeled() const override { return true; }
}
+string InsetListingsParams::toString() const
+{
+ ostringstream data;
+ data << "listings" << ' ';
+ write(data);
+ return data.str();
+}
+
+
string InsetListingsParams::params(string const & sep) const
{
string par;
/// read parameters from an ostream
void read(Lexer &) override;
+ ///
+ std::string toString() const override;
+
/// valid parameter string
std::string params(std::string const & sep=",") const;
}
-string InsetNewline::params2string(InsetNewlineParams const & params)
+string InsetNewlineParams::toString() const
{
ostringstream data;
data << "newline" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+ ///
Kind kind;
};
RowFlags rowFlags() const override { return BreakAfter | RowAfter; }
///
static void string2params(std::string const &, InsetNewlineParams &);
- ///
- static std::string params2string(InsetNewlineParams const &);
private:
///
InsetCode lyxCode() const override { return NEWLINE_CODE; }
}
-string InsetNewpage::params2string(InsetNewpageParams const & params)
+string InsetNewpageParams::toString() const
{
ostringstream data;
data << "newpage" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+ ///
Kind kind;
};
explicit InsetNewpage(InsetNewpageParams const & par);
///
static void string2params(std::string const &, InsetNewpageParams &);
- ///
- static std::string params2string(InsetNewpageParams const &);
private:
///
InsetCode lyxCode() const override { return NEWPAGE_CODE; }
bool InsetNote::showInsetDialog(BufferView * bv) const
{
- bv->showDialog("note", params2string(params()),
+ bv->showDialog("note", params().toString(),
const_cast<InsetNote *>(this));
return true;
}
}
case LFUN_INSET_DIALOG_UPDATE:
- cur.bv().updateDialog("note", params2string(params()));
+ cur.bv().updateDialog("note", params().toString());
break;
default:
}
-string InsetNote::params2string(InsetNoteParams const & params)
+string InsetNoteParams::toString() const
{
ostringstream data;
data << "note" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+
Type type;
};
///
~InsetNote();
///
- static std::string params2string(InsetNoteParams const &);
- ///
static void string2params(std::string const &, InsetNoteParams &);
///
InsetNoteParams const & params() const { return params_; }
#define INSETPARAMS_H
#include <ostream>
+#include <string>
namespace lyx {
virtual void write(std::ostream & os) const = 0;
///
virtual void read(Lexer & lex) = 0;
+ ///
+ virtual std::string toString() const = 0;
};
bool InsetPhantom::showInsetDialog(BufferView * bv) const
{
- bv->showDialog("phantom", params2string(params()),
+ bv->showDialog("phantom", params().toString(),
const_cast<InsetPhantom *>(this));
return true;
}
break;
case LFUN_INSET_DIALOG_UPDATE:
- cur.bv().updateDialog("phantom", params2string(params()));
+ cur.bv().updateDialog("phantom", params().toString());
break;
default:
}
-string InsetPhantom::params2string(InsetPhantomParams const & params)
+string InsetPhantomParams::toString() const
{
ostringstream data;
data << "phantom" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
Type type;
};
///
~InsetPhantom();
///
- static std::string params2string(InsetPhantomParams const &);
- ///
static void string2params(std::string const &, InsetPhantomParams &);
///
InsetPhantomParams const & params() const { return params_; }
if (buffer().masterParams().track_changes) {
InsetCommandParams icp(REF_CODE, "ref");
icp["reference"] = new_label;
- string const data = InsetCommand::params2string(icp);
+ string const data = icp.toString();
lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
} else
}
-string InsetScript::params2string(InsetScriptParams const & params)
+string InsetScriptParams::toString() const
{
ostringstream data;
data << "script ";
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+ ///
int shift(FontInfo const & font) const;
///
Type type;
///
~InsetScript();
///
- static std::string params2string(InsetScriptParams const &);
- ///
static void string2params(std::string const &, InsetScriptParams &);
///
InsetScriptParams const & params() const { return params_; }
}
-string InsetSeparator::params2string(InsetSeparatorParams const & params)
+string InsetSeparatorParams::toString() const
{
ostringstream data;
data << "separator" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+
Kind kind;
};
explicit InsetSeparator(InsetSeparatorParams const & params);
///
static void string2params(std::string const &, InsetSeparatorParams &);
- ///
- static std::string params2string(InsetSeparatorParams const &);
/// To be used in combination with inset-forall
/// Here's a command that removes every latexpar separator:
/// inset-forall Separator:latexpar char-delete-forward
}
case LFUN_INSET_DIALOG_UPDATE:
- cur.bv().updateDialog("space", params2string(params()));
+ cur.bv().updateDialog("space", params().toString());
break;
default:
}
-string InsetSpace::params2string(InsetSpaceParams const & params)
+string InsetSpaceParams::toString() const
{
ostringstream data;
- if (params.math)
+ if (math)
data << "math";
data << "space" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
///
void read(Lexer & lex) override;
///
+ std::string toString() const override;
+ ///
Kind kind;
///
GlueLength length;
///
static void string2params(std::string const &, InsetSpaceParams &);
///
- static std::string params2string(InsetSpaceParams const &);
- ///
GlueLength length() const;
///
switch (cmd.action()) {
case LFUN_MOUSE_RELEASE:
if (!cur.selection() && cmd.button() == mouse_button::button1) {
- cur.bv().showDialog("toc", params2string(params()));
+ cur.bv().showDialog("toc", params().toString());
cur.dispatched();
}
break;
}
case LFUN_INSET_DIALOG_UPDATE:
- cur.bv().updateDialog("wrap", params2string(params()));
+ cur.bv().updateDialog("wrap", params().toString());
break;
default:
bool InsetWrap::showInsetDialog(BufferView * bv) const
{
if (!InsetText::showInsetDialog(bv))
- bv->showDialog("wrap", params2string(params()),
+ bv->showDialog("wrap", params().toString(),
const_cast<InsetWrap *>(this));
return true;
}
}
-string InsetWrap::params2string(InsetWrapParams const & params)
+string InsetWrapParams::toString() const
{
ostringstream data;
data << "wrap" << ' ';
- params.write(data);
+ write(data);
return data.str();
}
void write(std::ostream &) const override;
///
void read(Lexer &) override;
-
+ ///
+ std::string toString() const override;
///
std::string type;
///
InsetWrapParams const & params() const { return params_; }
///
static void string2params(std::string const &, InsetWrapParams &);
- ///
- static std::string params2string(InsetWrapParams const &);
private:
///
void setCaptionType(std::string const & type) override;
InsetCommandParams p(LABEL_CODE);
p["name"] = cmd.argument().empty() ? old_label : cmd.argument();
- string const data = InsetCommand::params2string(p);
+ string const data = p.toString();
if (cmd.argument().empty())
cur.bv().showDialog("label", data);
icp["reference"] = asString(cell(0));
if (!cell(1).empty())
icp["name"] = asString(cell(1));
- return InsetCommand::params2string(icp);
+ return icp.toString();
}
MathData ar;
Buffer & buf = buffer();
if (createInsetMath_fromDialogStr(
- from_utf8(InsetCommand::params2string(icp)), ar)) {
+ from_utf8(icp.toString()), ar)) {
*this = *ar[0].nucleus()->asRefInset();
// FIXME audit setBuffer calls
setBuffer(buf);