]> git.lyx.org Git - features.git/blobdiff - src/LyXRC.cpp
Move Color::color enum to ColorCode.h
[features.git] / src / LyXRC.cpp
index 099de7575cc7cf701a69a941dce31d0025ee681d..f415aecce6aa2d1e64f6b77d4f61355c6f6f0c11 100644 (file)
 #include "LyXRC.h"
 
 #include "debug.h"
+#include "Color.h"
 #include "Converter.h"
 #include "Format.h"
 #include "gettext.h"
 #include "Session.h"
-#include "Color.h"
 #include "Lexer.h"
 #include "Font.h"
 #include "Mover.h"
@@ -84,6 +84,7 @@ keyword_item lyxrcTags[] = {
        { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
        { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
        { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
+       { "\\def_file", LyXRC::RC_DEFFILE },
        { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
        { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
        { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
@@ -189,6 +190,7 @@ LyXRC::LyXRC()
 
 void LyXRC::setDefaults() {
        bind_file = "cua";
+       def_file = "default";
        ui_file = "default";
        // Get printer from the environment. If fail, use default "",
        // assuming that everything is set up correctly.
@@ -370,6 +372,12 @@ int LyXRC::read(Lexer & lexrc)
                        }
                        break;
 
+               case RC_DEFFILE:
+                       if (lexrc.next()) {
+                               def_file = os::internal_path(lexrc.getString());
+                       }
+                       break;
+
                case RC_UIFILE:
                        if (lexrc.next()) {
                                ui_file = os::internal_path(lexrc.getString());
@@ -812,11 +820,11 @@ int LyXRC::read(Lexer & lexrc)
                                break;
                        }
 
-                       Color::color const col =
+                       ColorCode const col =
                                lcolor.getFromLyXName(lyx_name);
-                       if (col == Color::none ||
-                           col == Color::inherit ||
-                           col == Color::ignore)
+                       if (col == Color_none ||
+                           col == Color_inherit ||
+                           col == Color_ignore)
                                break;
 
                        if (!lcolor.setColor(col, x11_name)) {
@@ -1215,7 +1223,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
        LyXRCTags tag = RC_LAST;
        
        if (!name.empty()) {
-               for (size_t i = 0; i < lyxrcCount; ++i)
+               for (int i = 0; i != lyxrcCount; ++i)
                        if ("\\" + name == lyxrcTags[i].tag)
                                tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
        }
@@ -1226,7 +1234,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                   << "###          LyX, The Document Processor\n"
                   << "###\n"
                   << "###          Copyright 1995 Matthias Ettrich\n"
-                  << "###          Copyright 1995-2001 The LyX Team.\n"
+                  << "###          Copyright 1995-2007 The LyX Team.\n"
                   << "###\n"
                   << "### ========================================================\n"
                   << "\n"
@@ -1252,6 +1260,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
 
+       case RC_DEFFILE:
+               if (ignore_system_lyxrc ||
+                   def_file != system_lyxrc.def_file) {
+                       string const path = os::external_path(def_file);
+                       os << "\\def_file \"" << path << "\"\n";
+               }
+               if (tag != RC_LAST)
+                       break;
+
                //
                // Misc Section
                //
@@ -1679,8 +1696,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                   << "#\n\n";
 
        case RC_SET_COLOR:
-               for (int i = 0; i < Color::ignore; ++i) {
-                       Color::color lc = static_cast<Color::color>(i);
+               for (int i = 0; i < Color_ignore; ++i) {
+                       ColorCode lc = static_cast<ColorCode>(i);
 
                        string const col(lcolor.getX11Name(lc));
                        if (ignore_system_lyxrc ||