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

View File

@ -32,8 +32,9 @@ namespace lyx {
InsetLayout::InsetLayout() : InsetLayout::InsetLayout() :
name_(from_ascii("undefined")), lyxtype_(STANDARD), name_(from_ascii("undefined")), lyxtype_(STANDARD),
labelstring_(from_ascii("UNDEFINED")), decoration_(InsetLayout::DEFAULT), labelstring_(from_ascii("UNDEFINED")), decoration_(DEFAULT),
font_(sane_font), labelfont_(sane_font), bgcolor_(Color_error), latextype_(NOLATEXTYPE), font_(sane_font),
labelfont_(sane_font), bgcolor_(Color_error),
multipar_(false), custompars_(false), forceplain_(true), multipar_(false), custompars_(false), forceplain_(true),
passthru_(false), needprotect_(false), freespacing_(false), passthru_(false), needprotect_(false), freespacing_(false),
keepempty_(false), forceltr_(false) keepempty_(false), forceltr_(false)
@ -55,6 +56,17 @@ InsetLayout::InsetDecoration translateDecoration(std::string const & str)
return InsetLayout::DEFAULT; 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 << "'."); LYXERR0("Unknown LyXType `" << lt << "'.");
break; break;
} }
case IL_LATEXTYPE: case IL_LATEXTYPE: {
lex >> latextype_; string lt;
lex >> lt;
latextype_ = translateLaTeXType(lt);
if (latextype_ == ILT_ERROR)
LYXERR0("Unknown LaTeXType `" << lt << "'.");
break; break;
}
case IL_LABELSTRING: case IL_LABELSTRING:
lex >> labelstring_; lex >> labelstring_;
break; break;

View File

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