Inset configurability, LaTeX work

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19665 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2007-08-20 19:02:38 +00:00
parent e710636ee8
commit f289399bf5
5 changed files with 38 additions and 33 deletions

View File

@ -204,23 +204,6 @@ bool InsetCharStyle::getStatus(Cursor & cur, FuncRequest const & cmd,
}
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
{
@ -262,7 +245,7 @@ void InsetCharStyle::textString(Buffer const & buf, odocstream & os) 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);
}

View File

@ -68,9 +68,6 @@ public:
///
virtual Decoration decoration() const { return Conglomerate; }
///
int latex(Buffer const &, odocstream &,
OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
OutputParams const &) const;

View File

@ -618,4 +618,37 @@ docstring InsetCollapsable::floatName(string const & type, BufferParams 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

View File

@ -130,6 +130,9 @@ public:
void setStatus(Cursor & cur, CollapseStatus st);
///
bool setMouseHover(bool mouse_hover);
///
int latex(Buffer const &, odocstream &,
OutputParams const &) const;
protected:
///

View File

@ -232,14 +232,6 @@ void InsetNote::doDispatch(Cursor & cur, FuncRequest & cmd)
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;
@ -285,10 +277,7 @@ int InsetNote::latex(Buffer const & buf, odocstream & os,
}
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: