From 9a600f0e3027e84d6b9be41d5521a1bd5ad340df Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 19 Jan 2007 14:30:30 +0000 Subject: [PATCH] * 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 --- src/lyx_main.C | 19 +++++++++++++++---- src/lyx_main.h | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/lyx_main.C b/src/lyx_main.C index a98d69f3dd..1deaa8ca25 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -74,6 +74,7 @@ namespace lyx { using support::addName; using support::addPath; using support::bformat; +using support::changeExtension; using support::createDirectory; using support::createLyXTmpDir; using support::destroyDir; @@ -1126,7 +1127,7 @@ bool LyX::readRcFile(string const & name) // Read the ui file `name' -bool LyX::readUIFile(string const & name) +bool LyX::readUIFile(string const & name, bool include) { enum Uitags { ui_menuset = 1, @@ -1158,13 +1159,23 @@ bool LyX::readUIFile(string const & name) 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()) { lyxerr[Debug::INIT] << "Could not find " << name << endl; showFileError(name); return false; } + uifiles.push_back(name); lyxerr[Debug::INIT] << "Found " << name @@ -1184,7 +1195,7 @@ bool LyX::readUIFile(string const & name) case ui_include: { lex.next(true); string const file = lex.getString(); - if (!readUIFile(file)) + if (!readUIFile(file, true)) return false; break; } diff --git a/src/lyx_main.h b/src/lyx_main.h index a1887887cc..b4f3c0ddb4 100644 --- a/src/lyx_main.h +++ b/src/lyx_main.h @@ -146,7 +146,7 @@ private: /// read lyxrc/preferences bool readRcFile(std::string const & name); /// 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 bool readLanguagesFile(std::string const & name); /// read the given encodings file -- 2.39.2