Improve on fix r31610 for ticket #5702. Replacing DefaultModule with

Input did not preserve the loading order of modules.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@31639 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-10-15 14:25:43 +00:00
parent 783b1434ea
commit 543d12d62e

View File

@ -493,24 +493,6 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
break; break;
} }
#ifdef TEX2LYX
case TC_DEFAULTMODULE: // Include file
if (lexrc.next()) {
string const inc = lexrc.getString();
FileName tmp = libFileSearch("layouts", inc,
"module");
if (tmp.empty()) {
lexrc.printError("Could not find module: " + inc);
error = true;
} else if (!read(tmp, MERGE)) {
lexrc.printError("Error reading module"
"file: " + tmp.absFilename());
error = true;
}
}
break;
#else
case TC_DEFAULTMODULE: { case TC_DEFAULTMODULE: {
lexrc.next(); lexrc.next();
string const module = lexrc.getString(); string const module = lexrc.getString();
@ -518,7 +500,6 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
default_modules_.push_back(module); default_modules_.push_back(module);
break; break;
} }
#endif
case TC_PROVIDESMODULE: { case TC_PROVIDESMODULE: {
lexrc.next(); lexrc.next();
@ -633,6 +614,22 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
if (rt != BASECLASS) if (rt != BASECLASS)
return (error ? ERROR : OK); return (error ? ERROR : OK);
#ifdef TEX2LYX
list<string>::const_iterator it = default_modules_.begin();
list<string>::const_iterator const endit = default_modules_.end();
for ( ; it != endit ; ++it) {
FileName tmp = libFileSearch("layouts", *it, "module");
if (tmp.empty()) {
lexrc.printError("Could not find module: " + *it);
error = true;
} else if (!read(tmp, MERGE)) {
lexrc.printError("Error reading module"
"file: " + tmp.absFilename());
error = true;
}
}
#endif
if (defaultlayout_.empty()) { if (defaultlayout_.empty()) {
LYXERR0("Error: Textclass '" << name_ LYXERR0("Error: Textclass '" << name_
<< "' is missing a defaultstyle."); << "' is missing a defaultstyle.");