}
-int InsetCharStyle::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
-{
- if (!undefined()) {
- // FIXME UNICODE
- os << '\\' << from_utf8(layout_.latexname);
- if (!layout_.latexparam.empty())
- os << from_utf8(layout_.latexparam);
- os << '{';
- }
- int i = InsetText::latex(buf, os, runparams);
- if (!undefined())
- os << "}";
- return i;
-}
-
-
int InsetCharStyle::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
void InsetCharStyle::validate(LaTeXFeatures & features) const
{
// Force inclusion of preamble snippet in layout file
- features.require(params_.name);
+ features.require(layout_.latexname);
InsetText::validate(features);
}
///
virtual Decoration decoration() const { return Conglomerate; }
- ///
- int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
OutputParams const &) const;
}
+
+int InsetCollapsable::latex(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
+{
+ // This implements the standard way of handling the LaTeX output of
+ // a collapsable inset, either a command or an environment. Standard
+ // collapsable insets should not redefine this, non-standard ones may
+ // call this.
+ if (!layout_.latexname.empty()) {
+ if (layout_.latextype == "command") {
+ // FIXME UNICODE
+ os << '\\' << from_utf8(layout_.latexname);
+ if (!layout_.latexparam.empty())
+ os << from_utf8(layout_.latexparam);
+ os << '{';
+ } else if (layout_.latextype == "environment") {
+ os << "%\n\\begin{" << from_utf8(layout_.latexname) << "}\n";
+ if (!layout_.latexparam.empty())
+ os << from_utf8(layout_.latexparam);
+ }
+ }
+ int i = InsetText::latex(buf, os, runparams);
+ if (!layout_.latexname.empty())
+ if (layout_.latextype == "command") {
+ os << "}";
+ } else if (layout_.latextype == "environment") {
+ os << "\n\\end{" << from_utf8(layout_.latexname) << "}\n";
+ i += 4;
+ }
+ return i;
+}
+
+
} // namespace lyx
void setStatus(Cursor & cur, CollapseStatus st);
///
bool setMouseHover(bool mouse_hover);
+ ///
+ int latex(Buffer const &, odocstream &,
+ OutputParams const &) const;
protected:
///
case LFUN_INSET_DIALOG_UPDATE:
InsetNoteMailer(*this).updateDialog(&cur.bv());
break;
-
- case LFUN_MOUSE_RELEASE:
- if (cmd.button() == mouse_button::button3 && hitButton(cmd))
- InsetNoteMailer(*this).showDialog(&cur.bv());
- else
- InsetCollapsable::doDispatch(cur, cmd);
- break;
-
default:
InsetCollapsable::doDispatch(cur, cmd);
break;
}
odocstringstream ss;
- //ss << "%\n\\begin{" << from_ascii(type) << "}\n";
- ss << "%\n\\begin{" << from_ascii(layout_.latexname) << "}\n";
- InsetText::latex(buf, ss, runparams);
- ss << "\n\\end{" << from_ascii(layout_.latexname) << "}\n";
+ InsetCollapsable::latex(buf, ss, runparams);
// the space after the comment in 'a[comment] b' will be eaten by the
// comment environment since the space before b is ignored with the
// following latex output: