From 5ed5e01fd71a7a9ff8c4c646b002819eeda59268 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 13 Feb 2008 14:39:16 +0000 Subject: [PATCH] *TextClass::readStyle(): return true on success! git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22980 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/TextClass.cpp | 24 ++++++++++++------------ src/TextClass.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 18d28752f9..4c3b643a1d 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -143,16 +143,16 @@ bool TextClass::isTeXClassAvailable() const bool TextClass::readStyle(Lexer & lexrc, Layout & lay) { LYXERR(Debug::TCLASS, "Reading style " << to_utf8(lay.name())); - if (!lay.read(lexrc, *this)) { - // Resolve fonts - lay.resfont = lay.font; - lay.resfont.realize(defaultfont()); - lay.reslabelfont = lay.labelfont; - lay.reslabelfont.realize(defaultfont()); - return false; // no errors + if (lay.read(lexrc, *this)) { + lyxerr << "Error parsing style `" << to_utf8(lay.name()) << '\'' << endl; + return false; } - lyxerr << "Error parsing style `" << to_utf8(lay.name()) << '\'' << endl; - return true; + // Resolve fonts + lay.resfont = lay.font; + lay.resfont.realize(defaultfont()); + lay.reslabelfont = lay.labelfont; + lay.reslabelfont.realize(defaultfont()); + return true; // no errors } @@ -321,16 +321,16 @@ bool TextClass::read(FileName const & filename, ReadType rt) + lexrc.getString() + " is probably not valid UTF-8!"; lexrc.printError(s.c_str()); Layout lay; - error = readStyle(lexrc, lay); + error = !readStyle(lexrc, lay); } else if (hasLayout(name)) { Layout * lay = operator[](name).get(); - error = readStyle(lexrc, *lay); + error = !readStyle(lexrc, *lay); } else { Layout lay; lay.setName(name); if (le == TC_ENVIRONMENT) lay.is_environment = true; - error = readStyle(lexrc, lay); + error = !readStyle(lexrc, lay); if (!error) layoutlist_.push_back( boost::shared_ptr(new Layout(lay)) diff --git a/src/TextClass.h b/src/TextClass.h index bdfe8aa14c..644fb9c153 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -184,7 +184,7 @@ public: private: /// bool deleteLayout(docstring const &); - /// + /// \return true for success. bool readStyle(Lexer &, Layout &); /// Layout file name std::string name_;