* lyx_main.C (readUIFile): when reading an include file which name

ends in .ui, try the .inc version too (support for user ui files)



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16762 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2007-01-19 14:30:30 +00:00
parent d4041ea53b
commit 9a600f0e30
2 changed files with 16 additions and 5 deletions

View File

@ -74,6 +74,7 @@ namespace lyx {
using support::addName; using support::addName;
using support::addPath; using support::addPath;
using support::bformat; using support::bformat;
using support::changeExtension;
using support::createDirectory; using support::createDirectory;
using support::createLyXTmpDir; using support::createLyXTmpDir;
using support::destroyDir; using support::destroyDir;
@ -1126,7 +1127,7 @@ bool LyX::readRcFile(string const & name)
// Read the ui file `name' // Read the ui file `name'
bool LyX::readUIFile(string const & name) bool LyX::readUIFile(string const & name, bool include)
{ {
enum Uitags { enum Uitags {
ui_menuset = 1, ui_menuset = 1,
@ -1158,13 +1159,23 @@ bool LyX::readUIFile(string const & name)
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl; lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
FileName const ui_path = libFileSearch("ui", name, "ui");
FileName ui_path;
if (include) {
ui_path = libFileSearch("ui", name, "inc");
if (ui_path.empty())
ui_path = libFileSearch("ui",
changeExtension(name, "inc"));
}
else
ui_path = libFileSearch("ui", name, "ui");
if (ui_path.empty()) { if (ui_path.empty()) {
lyxerr[Debug::INIT] << "Could not find " << name << endl; lyxerr[Debug::INIT] << "Could not find " << name << endl;
showFileError(name); showFileError(name);
return false; return false;
} }
uifiles.push_back(name); uifiles.push_back(name);
lyxerr[Debug::INIT] << "Found " << name lyxerr[Debug::INIT] << "Found " << name
@ -1184,7 +1195,7 @@ bool LyX::readUIFile(string const & name)
case ui_include: { case ui_include: {
lex.next(true); lex.next(true);
string const file = lex.getString(); string const file = lex.getString();
if (!readUIFile(file)) if (!readUIFile(file, true))
return false; return false;
break; break;
} }

View File

@ -146,7 +146,7 @@ private:
/// read lyxrc/preferences /// read lyxrc/preferences
bool readRcFile(std::string const & name); bool readRcFile(std::string const & name);
/// read the given ui (menu/toolbar) file /// read the given ui (menu/toolbar) file
bool readUIFile(std::string const & name); bool readUIFile(std::string const & name, bool include = false);
/// read the given languages file /// read the given languages file
bool readLanguagesFile(std::string const & name); bool readLanguagesFile(std::string const & name);
/// read the given encodings file /// read the given encodings file