]> git.lyx.org Git - lyx.git/commitdiff
* lyx_main.C (readUIFile): when reading an include file which name
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 19 Jan 2007 14:30:30 +0000 (14:30 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 19 Jan 2007 14:30:30 +0000 (14:30 +0000)
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
src/lyx_main.h

index a98d69f3dd3ad36de7570566dd67a7e4c4305efe..1deaa8ca251cef5ab784c43b0bf8b3f3cb6093dc 100644 (file)
@@ -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;
                }
index a1887887cc191d03778641cb920fc5002b00b957..b4f3c0ddb4e0ec03f95bddb25a934061df158862 100644 (file)
@@ -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