mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
InsetCommand ctor: Pass 'Buffer *'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31902 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
82c7e15e64
commit
882e2eeb7b
@ -2008,7 +2008,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
setParagraphs(cur, p);
|
||||
// FIXME This should be simplified when InsetFloatList takes a
|
||||
// Buffer in its constructor.
|
||||
InsetFloatList * ifl = new InsetFloatList(to_utf8(cmd.argument()));
|
||||
InsetFloatList * ifl = new InsetFloatList(cur.buffer(), to_utf8(cmd.argument()));
|
||||
ifl->setBuffer(bv->buffer());
|
||||
insertInset(cur, ifl);
|
||||
cur.posForward();
|
||||
|
@ -184,7 +184,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
||||
case LFUN_NOMENCL_INSERT: {
|
||||
InsetCommandParams icp(NOMENCL_CODE);
|
||||
icp["symbol"] = cmd.argument();
|
||||
return new InsetNomencl(icp);
|
||||
return new InsetNomencl(buf, icp);
|
||||
}
|
||||
|
||||
case LFUN_TABULAR_INSERT: {
|
||||
@ -206,17 +206,17 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
||||
case LFUN_INDEX_PRINT: {
|
||||
InsetCommandParams icp(INDEX_PRINT_CODE);
|
||||
icp["type"] = cmd.argument();
|
||||
return new InsetPrintIndex(icp);
|
||||
return new InsetPrintIndex(buf, icp);
|
||||
}
|
||||
|
||||
case LFUN_NOMENCL_PRINT: {
|
||||
InsetCommandParams icp(NOMENCL_PRINT_CODE);
|
||||
icp["set_width"] = from_ascii("auto");
|
||||
return new InsetPrintNomencl(icp);
|
||||
return new InsetPrintNomencl(buf, icp);
|
||||
}
|
||||
|
||||
case LFUN_TOC_INSERT:
|
||||
return new InsetTOC(InsetCommandParams(TOC_CODE));
|
||||
return new InsetTOC(buf, InsetCommandParams(TOC_CODE));
|
||||
|
||||
case LFUN_INFO_INSERT: {
|
||||
InsetInfo * inset = new InsetInfo(buf, to_utf8(cmd.argument()));
|
||||
@ -247,7 +247,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
||||
case CITE_CODE: {
|
||||
InsetCommandParams icp(code);
|
||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
||||
return new InsetCitation(icp);
|
||||
return new InsetCitation(buf, icp);
|
||||
}
|
||||
|
||||
case ERT_CODE: {
|
||||
@ -281,13 +281,13 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
||||
case HYPERLINK_CODE: {
|
||||
InsetCommandParams icp(code);
|
||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
||||
return new InsetHyperlink(icp);
|
||||
return new InsetHyperlink(buf, icp);
|
||||
}
|
||||
|
||||
case INCLUDE_CODE: {
|
||||
InsetCommandParams icp(code);
|
||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
||||
return new InsetInclude(icp);
|
||||
return new InsetInclude(buf, icp);
|
||||
}
|
||||
|
||||
case INDEX_CODE: {
|
||||
@ -298,19 +298,19 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
||||
case INDEX_PRINT_CODE: {
|
||||
InsetCommandParams icp(code);
|
||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
||||
return new InsetPrintIndex(icp);
|
||||
return new InsetPrintIndex(buf, icp);
|
||||
}
|
||||
|
||||
case NOMENCL_CODE: {
|
||||
InsetCommandParams icp(code);
|
||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
||||
return new InsetNomencl(icp);
|
||||
return new InsetNomencl(buf, icp);
|
||||
}
|
||||
|
||||
case LABEL_CODE: {
|
||||
InsetCommandParams icp(code);
|
||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
||||
return new InsetLabel(icp);
|
||||
return new InsetLabel(buf, icp);
|
||||
}
|
||||
|
||||
case REF_CODE: {
|
||||
@ -328,7 +328,7 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd)
|
||||
case TOC_CODE: {
|
||||
InsetCommandParams icp(code);
|
||||
InsetCommand::string2params(name, to_utf8(cmd.argument()), icp);
|
||||
return new InsetTOC(icp);
|
||||
return new InsetTOC(buf, icp);
|
||||
}
|
||||
|
||||
case VSPACE_CODE: {
|
||||
@ -482,25 +482,25 @@ Inset * readInset(Lexer & lex, Buffer * buf)
|
||||
inset.reset(new InsetBibtex(buf, inscmd));
|
||||
break;
|
||||
case CITE_CODE:
|
||||
inset.reset(new InsetCitation(inscmd));
|
||||
inset.reset(new InsetCitation(buf, inscmd));
|
||||
break;
|
||||
case HYPERLINK_CODE:
|
||||
inset.reset(new InsetHyperlink(inscmd));
|
||||
inset.reset(new InsetHyperlink(buf, inscmd));
|
||||
break;
|
||||
case INCLUDE_CODE:
|
||||
inset.reset(new InsetInclude(inscmd));
|
||||
inset.reset(new InsetInclude(buf, inscmd));
|
||||
break;
|
||||
case INDEX_PRINT_CODE:
|
||||
inset.reset(new InsetPrintIndex(inscmd));
|
||||
inset.reset(new InsetPrintIndex(buf, inscmd));
|
||||
break;
|
||||
case LABEL_CODE:
|
||||
inset.reset(new InsetLabel(inscmd));
|
||||
inset.reset(new InsetLabel(buf, inscmd));
|
||||
break;
|
||||
case NOMENCL_CODE:
|
||||
inset.reset(new InsetNomencl(inscmd));
|
||||
inset.reset(new InsetNomencl(buf, inscmd));
|
||||
break;
|
||||
case NOMENCL_PRINT_CODE:
|
||||
inset.reset(new InsetPrintNomencl(inscmd));
|
||||
inset.reset(new InsetPrintNomencl(buf, inscmd));
|
||||
break;
|
||||
case REF_CODE:
|
||||
if (inscmd["name"].empty() && inscmd["reference"].empty())
|
||||
@ -508,7 +508,7 @@ Inset * readInset(Lexer & lex, Buffer * buf)
|
||||
inset.reset(new InsetRef(buf, inscmd));
|
||||
break;
|
||||
case TOC_CODE:
|
||||
inset.reset(new InsetTOC(inscmd));
|
||||
inset.reset(new InsetTOC(buf, inscmd));
|
||||
break;
|
||||
case NO_CODE:
|
||||
default:
|
||||
@ -583,7 +583,7 @@ Inset * readInset(Lexer & lex, Buffer * buf)
|
||||
} else if (tmptok == "Index") {
|
||||
inset.reset(new InsetIndex(buf, InsetIndexParams()));
|
||||
} else if (tmptok == "FloatList") {
|
||||
inset.reset(new InsetFloatList);
|
||||
inset.reset(new InsetFloatList(buf));
|
||||
} else if (tmptok == "Info") {
|
||||
inset.reset(new InsetInfo(buf));
|
||||
} else {
|
||||
|
@ -49,9 +49,8 @@ docstring const key_prefix = from_ascii("key-");
|
||||
|
||||
|
||||
InsetBibitem::InsetBibitem(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(p, "bibitem")
|
||||
: InsetCommand(buf, p, "bibitem")
|
||||
{
|
||||
Inset::setBuffer(*buf);
|
||||
buffer_->invalidateBibinfoCache();
|
||||
if (getParam("key").empty())
|
||||
setParam("key", key_prefix + convert<docstring>(++key_counter));
|
||||
|
@ -52,7 +52,7 @@ namespace os = support::os;
|
||||
|
||||
|
||||
InsetBibtex::InsetBibtex(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(p, "bibtex")
|
||||
: InsetCommand(buf, p, "bibtex")
|
||||
{
|
||||
Inset::setBuffer(const_cast<Buffer &>(*buf));
|
||||
buffer_->invalidateBibinfoCache();
|
||||
|
@ -355,8 +355,8 @@ docstring basicLabel(docstring const & keyList, docstring const & after)
|
||||
ParamInfo InsetCitation::param_info_;
|
||||
|
||||
|
||||
InsetCitation::InsetCitation(InsetCommandParams const & p)
|
||||
: InsetCommand(p, "citation")
|
||||
InsetCitation::InsetCitation(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(buf, p, "citation")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ class InsetCitation : public InsetCommand
|
||||
{
|
||||
public:
|
||||
///
|
||||
explicit InsetCitation(InsetCommandParams const &);
|
||||
explicit InsetCitation(Buffer * buf, InsetCommandParams const &);
|
||||
///
|
||||
bool isLabeled() const { return true; }
|
||||
///
|
||||
|
@ -51,7 +51,7 @@ namespace lyx {
|
||||
|
||||
// FIXME Would it now be possible to use the InsetCode in
|
||||
// place of the mailer name and recover that information?
|
||||
InsetCommand::InsetCommand(InsetCommandParams const & p,
|
||||
InsetCommand::InsetCommand(Buffer *, InsetCommandParams const & p,
|
||||
string const & mailer_name)
|
||||
: Inset(0), p_(p),
|
||||
mailer_name_(mailer_name),
|
||||
|
@ -34,8 +34,9 @@ namespace lyx {
|
||||
class InsetCommand : public Inset
|
||||
{
|
||||
public:
|
||||
/// FIXME: pass Buffer here!
|
||||
InsetCommand(InsetCommandParams const &, std::string const & mailer_name);
|
||||
///
|
||||
InsetCommand(Buffer *, InsetCommandParams const &,
|
||||
std::string const & mailer_name);
|
||||
///
|
||||
~InsetCommand();
|
||||
|
||||
|
@ -36,13 +36,13 @@ using namespace lyx::support;
|
||||
namespace lyx {
|
||||
|
||||
|
||||
InsetFloatList::InsetFloatList()
|
||||
: InsetCommand(InsetCommandParams(FLOAT_LIST_CODE), "toc")
|
||||
InsetFloatList::InsetFloatList(Buffer * buf)
|
||||
: InsetCommand(buf, InsetCommandParams(FLOAT_LIST_CODE), "toc")
|
||||
{}
|
||||
|
||||
|
||||
InsetFloatList::InsetFloatList(string const & type)
|
||||
: InsetCommand(InsetCommandParams(FLOAT_LIST_CODE), "toc")
|
||||
InsetFloatList::InsetFloatList(Buffer * buf, string const & type)
|
||||
: InsetCommand(buf, InsetCommandParams(FLOAT_LIST_CODE), "toc")
|
||||
{
|
||||
setParam("type", from_ascii(type));
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ namespace lyx {
|
||||
class InsetFloatList : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetFloatList();
|
||||
InsetFloatList(Buffer *);
|
||||
///
|
||||
InsetFloatList(std::string const & type);
|
||||
InsetFloatList(Buffer *, std::string const & type);
|
||||
///
|
||||
docstring screenLabel() const;
|
||||
///
|
||||
|
@ -28,8 +28,8 @@ using namespace lyx::support;
|
||||
namespace lyx {
|
||||
|
||||
|
||||
InsetHyperlink::InsetHyperlink(InsetCommandParams const & p)
|
||||
: InsetCommand(p, "href")
|
||||
InsetHyperlink::InsetHyperlink(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(buf, p, "href")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ class InsetHyperlink : public InsetCommand
|
||||
{
|
||||
public:
|
||||
///
|
||||
explicit InsetHyperlink(InsetCommandParams const &);
|
||||
explicit InsetHyperlink(Buffer * buf, InsetCommandParams const &);
|
||||
///
|
||||
InsetCode lyxCode() const { return HYPERLINK_CODE; }
|
||||
///
|
||||
|
@ -147,20 +147,20 @@ FileName const includedFilename(Buffer const & buffer,
|
||||
}
|
||||
|
||||
|
||||
InsetLabel * createLabel(docstring const & label_str)
|
||||
InsetLabel * createLabel(Buffer * buf, docstring const & label_str)
|
||||
{
|
||||
if (label_str.empty())
|
||||
return 0;
|
||||
InsetCommandParams icp(LABEL_CODE);
|
||||
icp["name"] = label_str;
|
||||
return new InsetLabel(icp);
|
||||
return new InsetLabel(buf, icp);
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
InsetInclude::InsetInclude(InsetCommandParams const & p)
|
||||
: InsetCommand(p, "include"), include_label(uniqueID()),
|
||||
InsetInclude::InsetInclude(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(buf, p, "include"), include_label(uniqueID()),
|
||||
preview_(new RenderMonitoredPreview(this)), failedtoload_(false),
|
||||
set_label_(false), label_(0), child_buffer_(0)
|
||||
{
|
||||
@ -168,7 +168,7 @@ InsetInclude::InsetInclude(InsetCommandParams const & p)
|
||||
|
||||
if (isListings(params())) {
|
||||
InsetListingsParams listing_params(to_utf8(p["lstparams"]));
|
||||
label_ = createLabel(from_utf8(listing_params.getParamValue("label")));
|
||||
label_ = createLabel(buffer_, from_utf8(listing_params.getParamValue("label")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (label_)
|
||||
old_label = label_->getParam("name");
|
||||
else {
|
||||
label_ = createLabel(new_label);
|
||||
label_ = createLabel(buffer_, new_label);
|
||||
label_->setBuffer(buffer());
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class RenderMonitoredPreview;
|
||||
class InsetInclude : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetInclude(InsetCommandParams const &);
|
||||
InsetInclude(Buffer * buf, InsetCommandParams const &);
|
||||
~InsetInclude();
|
||||
|
||||
void setBuffer(Buffer & buffer);
|
||||
|
@ -396,8 +396,8 @@ void InsetIndexParams::read(Lexer & lex)
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
|
||||
: InsetCommand(p, "index_print")
|
||||
InsetPrintIndex::InsetPrintIndex(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(buf, p, "index_print")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@ private:
|
||||
class InsetPrintIndex : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetPrintIndex(InsetCommandParams const &);
|
||||
InsetPrintIndex(Buffer * buf, InsetCommandParams const &);
|
||||
///
|
||||
InsetCode lyxCode() const { return INDEX_PRINT_CODE; }
|
||||
|
||||
|
@ -42,8 +42,8 @@ using namespace lyx::support;
|
||||
namespace lyx {
|
||||
|
||||
|
||||
InsetLabel::InsetLabel(InsetCommandParams const & p)
|
||||
: InsetCommand(p, "label")
|
||||
InsetLabel::InsetLabel(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(buf, p, "label")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace lyx {
|
||||
class InsetLabel : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetLabel(InsetCommandParams const &);
|
||||
InsetLabel(Buffer * buf, InsetCommandParams const &);
|
||||
|
||||
/// verify label and update references.
|
||||
/**
|
||||
|
@ -46,8 +46,8 @@ namespace lyx {
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
InsetNomencl::InsetNomencl(InsetCommandParams const & p)
|
||||
: InsetCommand(p, "nomenclature"),
|
||||
InsetNomencl::InsetNomencl(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(buf, p, "nomenclature"),
|
||||
nomenclature_entry_id(sgml::uniqueID(from_ascii("nomen")))
|
||||
{}
|
||||
|
||||
@ -130,8 +130,8 @@ void InsetNomencl::validate(LaTeXFeatures & features) const
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
|
||||
: InsetCommand(p, "nomencl_print")
|
||||
InsetPrintNomencl::InsetPrintNomencl(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(buf, p, "nomencl_print")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ class LaTeXFeatures;
|
||||
class InsetNomencl : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetNomencl(InsetCommandParams const &);
|
||||
InsetNomencl(Buffer * buf, InsetCommandParams const &);
|
||||
///
|
||||
docstring screenLabel() const;
|
||||
///
|
||||
@ -60,7 +60,7 @@ private:
|
||||
class InsetPrintNomencl : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
InsetPrintNomencl(InsetCommandParams const &);
|
||||
InsetPrintNomencl(Buffer * buf, InsetCommandParams const &);
|
||||
/// Updates needed features for this inset.
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
|
@ -33,7 +33,7 @@ namespace lyx {
|
||||
|
||||
|
||||
InsetRef::InsetRef(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(p, "ref"), isLatex(buf->isLatex())
|
||||
: InsetCommand(buf, p, "ref"), isLatex(buf->isLatex())
|
||||
{}
|
||||
|
||||
|
||||
|
@ -28,8 +28,8 @@ using namespace std;
|
||||
namespace lyx {
|
||||
|
||||
|
||||
InsetTOC::InsetTOC(InsetCommandParams const & p)
|
||||
: InsetCommand(p, "toc")
|
||||
InsetTOC::InsetTOC(Buffer * buf, InsetCommandParams const & p)
|
||||
: InsetCommand(buf, p, "toc")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace lyx {
|
||||
class InsetTOC : public InsetCommand {
|
||||
public:
|
||||
///
|
||||
explicit InsetTOC(InsetCommandParams const &);
|
||||
InsetTOC(Buffer * buf, InsetCommandParams const &);
|
||||
///
|
||||
docstring screenLabel() const;
|
||||
///
|
||||
|
@ -508,7 +508,7 @@ void InsetMathHull::label(row_type row, docstring const & label)
|
||||
}
|
||||
InsetCommandParams p(LABEL_CODE);
|
||||
p["name"] = label;
|
||||
label_[row] = new InsetLabel(p);
|
||||
label_[row] = new InsetLabel(buffer_, p);
|
||||
if (buffer_)
|
||||
label_[row]->setBuffer(buffer());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user