X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetArgument.cpp;h=5dd8644fa3131fe4c92a4d1cc9aabe2f6552f86c;hb=62af7ee772f16f154225d2d0b65d77f4376b6001;hp=88e733613ad3d13fbb9d56ffbba381a6c742a9cd;hpb=b498646b2eb880b420b493a94144dd8dce2e32c7;p=lyx.git diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index 88e733613a..5dd8644fa3 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -40,24 +40,25 @@ namespace lyx { InsetArgument::InsetArgument(Buffer * buf, string const & name) - : InsetCollapsable(buf), name_(name), labelstring_(docstring()), + : InsetCollapsible(buf), name_(name), labelstring_(docstring()), font_(inherit_font), labelfont_(inherit_font), decoration_(string()), pass_thru_context_(false), pass_thru_local_(false), pass_thru_(false), - pass_thru_chars_(docstring()) + free_spacing_(false), pass_thru_chars_(docstring()), is_toc_caption_(false), + newline_cmd_(string()) {} void InsetArgument::write(ostream & os) const { os << "Argument " << name_ << "\n"; - InsetCollapsable::write(os); + InsetCollapsible::write(os); } void InsetArgument::read(Lexer & lex) { lex >> name_; - InsetCollapsable::read(lex); + InsetCollapsible::read(lex); } @@ -118,12 +119,16 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype) labelfont_ = (*lait).second.labelfont; decoration_ = (*lait).second.decoration; pass_thru_chars_ = (*lait).second.pass_thru_chars; + newline_cmd_ = (*lait).second.newlinecmd; + free_spacing_ = (*lait).second.free_spacing; pass_thru_local_ = false; - if (lait->second.is_toc_caption) + if (lait->second.is_toc_caption) { + is_toc_caption_ = true; // empty if AddToToc is not set caption_of_toc_ = insetlayout ? it.inset().getLayout().tocType() : it.paragraph().layout().tocType(); + } switch ((*lait).second.passthru) { case PT_INHERITED: @@ -152,7 +157,7 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype) } setButtonLabel(); - InsetCollapsable::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype); } @@ -207,11 +212,11 @@ void InsetArgument::doDispatch(Cursor & cur, FuncRequest & cmd) fixParagraphLanguage(buffer().params().language); } else - InsetCollapsable::doDispatch(cur, cmd); + InsetCollapsible::doDispatch(cur, cmd); break; default: - InsetCollapsable::doDispatch(cur, cmd); + InsetCollapsible::doDispatch(cur, cmd); break; } } @@ -251,11 +256,11 @@ bool InsetArgument::getStatus(Cursor & cur, FuncRequest const & cmd, flag.setEnabled(false); return true; } - return InsetCollapsable::getStatus(cur, cmd, flag); + return InsetCollapsible::getStatus(cur, cmd, flag); } default: - return InsetCollapsable::getStatus(cur, cmd, flag); + return InsetCollapsible::getStatus(cur, cmd, flag); } } @@ -273,7 +278,7 @@ FontInfo InsetArgument::getFont() const { if (font_ != inherit_font) return font_; - return InsetCollapsable::getFont(); + return InsetCollapsible::getFont(); } @@ -281,14 +286,14 @@ FontInfo InsetArgument::getLabelfont() const { if (labelfont_ != inherit_font) return labelfont_; - return InsetCollapsable::getLabelfont(); + return InsetCollapsible::getLabelfont(); } ColorCode InsetArgument::labelColor() const { if (labelfont_.color() != Color_inherit) return labelfont_.color(); - return InsetCollapsable::labelColor(); + return InsetCollapsible::labelColor(); } @@ -309,10 +314,13 @@ void InsetArgument::latexArgument(otexstream & os, OutputParams runparams = runparams_in; if (!pass_thru_chars_.empty()) runparams.pass_thru_chars += pass_thru_chars_; + if (!newline_cmd_.empty()) + runparams.newlinecmd = newline_cmd_; runparams.pass_thru = isPassThru(); InsetText::latex(ots, runparams); TexString ts = ots.release(); - bool const add_braces = ldelim != "{" && support::contains(ts.str, rdelim); + bool const add_braces = !ldelim.empty() && ldelim != "{" + && support::contains(ts.str, rdelim); os << ldelim; if (add_braces) os << '{';