Fix another part of 5403, again to do with case sensitivity.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27109 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-10-25 14:02:25 +00:00
parent e171ec6929
commit 976a59af1b
3 changed files with 33 additions and 10 deletions

View File

@ -785,7 +785,7 @@ int InsetCollapsable::latex(odocstream & os,
// collapsable insets should not redefine this, non-standard ones may
// call this.
if (!layout_->latexname().empty()) {
if (layout_->latextype() == "command") {
if (layout_->latextype() == InsetLayout::COMMAND) {
// FIXME UNICODE
if (runparams.moving_arg)
os << "\\protect";
@ -793,7 +793,7 @@ int InsetCollapsable::latex(odocstream & os,
if (!layout_->latexparam().empty())
os << from_utf8(layout_->latexparam());
os << '{';
} else if (layout_->latextype() == "environment") {
} else if (layout_->latextype() == InsetLayout::ENVIRONMENT) {
os << "%\n\\begin{" << from_utf8(layout_->latexname()) << "}\n";
if (!layout_->latexparam().empty())
os << from_utf8(layout_->latexparam());
@ -806,9 +806,9 @@ int InsetCollapsable::latex(odocstream & os,
rp.moving_arg = true;
int i = InsetText::latex(os, rp);
if (!layout_->latexname().empty()) {
if (layout_->latextype() == "command") {
if (layout_->latextype() == InsetLayout::COMMAND) {
os << "}";
} else if (layout_->latextype() == "environment") {
} else if (layout_->latextype() == InsetLayout::ENVIRONMENT) {
os << "\n\\end{" << from_utf8(layout_->latexname()) << "}\n";
i += 4;
}

View File

@ -32,8 +32,9 @@ namespace lyx {
InsetLayout::InsetLayout() :
name_(from_ascii("undefined")), lyxtype_(STANDARD),
labelstring_(from_ascii("UNDEFINED")), decoration_(InsetLayout::DEFAULT),
font_(sane_font), labelfont_(sane_font), bgcolor_(Color_error),
labelstring_(from_ascii("UNDEFINED")), decoration_(DEFAULT),
latextype_(NOLATEXTYPE), font_(sane_font),
labelfont_(sane_font), bgcolor_(Color_error),
multipar_(false), custompars_(false), forceplain_(true),
passthru_(false), needprotect_(false), freespacing_(false),
keepempty_(false), forceltr_(false)
@ -55,6 +56,17 @@ InsetLayout::InsetDecoration translateDecoration(std::string const & str)
return InsetLayout::DEFAULT;
}
InsetLayout::InsetLaTeXType translateLaTeXType(std::string const & str)
{
if (support::compare_ascii_no_case(str, "command") == 0)
return InsetLayout::COMMAND;
if (support::compare_ascii_no_case(str, "environment") == 0)
return InsetLayout::ENVIRONMENT;
if (support::compare_ascii_no_case(str, "none") == 0)
return InsetLayout::NOLATEXTYPE;
return InsetLayout::ILT_ERROR;
}
}
@ -144,9 +156,14 @@ bool InsetLayout::read(Lexer & lex, TextClass & tclass)
LYXERR0("Unknown LyXType `" << lt << "'.");
break;
}
case IL_LATEXTYPE:
lex >> latextype_;
case IL_LATEXTYPE: {
string lt;
lex >> lt;
latextype_ = translateLaTeXType(lt);
if (latextype_ == ILT_ERROR)
LYXERR0("Unknown LaTeXType `" << lt << "'.");
break;
}
case IL_LABELSTRING:
lex >> labelstring_;
break;

View File

@ -46,6 +46,12 @@ public:
END,
STANDARD
};
enum InsetLaTeXType {
NOLATEXTYPE,
COMMAND,
ENVIRONMENT,
ILT_ERROR
};
///
bool read(Lexer & lexrc, TextClass & tclass);
///
@ -57,7 +63,7 @@ public:
///
InsetDecoration decoration() const { return decoration_; };
///
std::string latextype() const { return latextype_; };
InsetLaTeXType latextype() const { return latextype_; };
///
std::string latexname() const { return latexname_; };
///
@ -102,7 +108,7 @@ private:
///
InsetDecoration decoration_;
///
std::string latextype_;
InsetLaTeXType latextype_;
///
std::string latexname_;
///