]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrc.C
* Painter.h:
[lyx.git] / src / lyxrc.C
index 6d3d101b332bab4cf79f3fa43e977671c6f66864..a29a55fc56fdd344080274a488f02e004f552c73 100644 (file)
 #include "support/os.h"
 #include "support/userinfo.h"
 
-namespace os = lyx::support::os;
 
-using lyx::docstring;
-using lyx::support::ascii_lowercase;
-using lyx::support::bformat;
-using lyx::support::expandPath;
-using lyx::support::getEnv;
-using lyx::support::libFileSearch;
-using lyx::support::token;
-using lyx::support::tokenPos;
+namespace lyx {
+
+namespace os = support::os;
+
+using support::ascii_lowercase;
+using support::bformat;
+using support::expandPath;
+using support::getEnv;
+using support::libFileSearch;
+using support::token;
 
 using std::cout;
 using std::endl;
@@ -257,7 +258,7 @@ void LyXRC::setDefaults() {
        load_session = false;
        make_backup = true;
        backupdir_path.erase();
-       display_graphics = lyx::graphics::ColorDisplay;
+       display_graphics = graphics::ColorDisplay;
        // Spellchecker settings:
        use_spell_lib = true;
        isp_command = "ispell";
@@ -281,7 +282,7 @@ void LyXRC::setDefaults() {
        show_banner = true;
        windows_style_tex_paths = false;
        tex_allows_spaces = false;
-       date_insert_format = "%A, %e %B %Y";
+       date_insert_format = "%x";
        cursor_follows_scrollbar = false;
        dialogs_iconify_with_main = false;
        label_init_length = 3;
@@ -289,9 +290,9 @@ void LyXRC::setDefaults() {
        preview_hashed_labels  = false;
        preview_scale_factor = "0.9";
 
-       user_name = lyx::support::user_name();
+       user_name = support::user_name();
 
-       user_email = lyx::support::user_email();
+       user_email = support::user_email();
 }
 
 
@@ -393,7 +394,7 @@ int LyXRC::read(LyXLex & lexrc)
 
                case RC_DISPLAY_GRAPHICS:
                        if (lexrc.next()) {
-                               display_graphics = lyx::graphics::displayTranslator().find(lexrc.getString());
+                               display_graphics = graphics::displayTranslator().find(lexrc.getString());
                        }
                        break;
 
@@ -1083,9 +1084,6 @@ int LyXRC::read(LyXLex & lexrc)
                                viewer = lexrc.getString();
                        if (lexrc.next())
                                editor = lexrc.getString();
-                       // The only supported flag for now is "document".
-                       // More flags could be added in the future.
-                       // Therefore we use tokenPos below to read the flag.
                        string flags;
                        // Hack to ensure compatibility with versions older
                        // than 1.5.0
@@ -1101,13 +1099,19 @@ int LyXRC::read(LyXLex & lexrc)
                                        flags.erase();
                                }
                        }
-                       bool const document =
-                               (tokenPos(flags, ',', "document") >= 0);
-                       if (!flags.empty() && flags != "document")
-                               lyxerr << "Ignoring flags other than "
-                                         "`document' in `" << flags
-                                      << "' for format `" << format << "'."
-                                      << endl;
+                       int flgs = Format::none;
+                       while (!flags.empty()) {
+                               string flag;
+                               flags = support::split(flags, flag, ',');
+                               if (flag == "document")
+                                       flgs |= Format::document;
+                               else if (flag == "vector")
+                                       flgs |= Format::vector;
+                               else
+                                       lyxerr << "Ignoring unknown flag `"
+                                              << flag << "' for format `"
+                                              << format << "'." << endl;
+                       }
                        if (prettyname.empty()) {
                                if (converters.formatIsUsed(format)) {
                                        lyxerr << "Can't delete format "
@@ -1117,7 +1121,7 @@ int LyXRC::read(LyXLex & lexrc)
                                }
                        } else {
                                formats.add(format, extension, prettyname,
-                                           shortcut, viewer, editor, document);
+                                           shortcut, viewer, editor, flgs);
                        }
                        break;
                }
@@ -1311,7 +1315,7 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
                        os << "# Display graphics within LyX\n"
                           << "# monochrome|grayscale|color|none\n"
                           << "\\display_graphics "
-                          << lyx::graphics::displayTranslator().find(display_graphics)
+                          << graphics::displayTranslator().find(display_graphics)
                           << '\n';
                }
 
@@ -2017,15 +2021,20 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
                            format->shortcut() != cit->shortcut() ||
                            format->viewer() != cit->viewer() ||
                            format->editor() != cit->editor() ||
-                           format->documentFormat() != cit->documentFormat()) {
+                           format->documentFormat() != cit->documentFormat() ||
+                           format->vectorFormat() != cit->vectorFormat()) {
                                os << "\\format \"" << cit->name() << "\" \""
                                   << cit->extension() << "\" \""
                                   << cit->prettyname() << "\" \""
                                   << cit->shortcut() << "\" \""
                                   << cit->viewer() << "\" \""
                                   << cit->editor() << "\" \"";
+                               std::vector<string> flags;
                                if (cit->documentFormat())
-                                       os << "document";
+                                       flags.push_back("document");
+                               if (cit->vectorFormat())
+                                       flags.push_back("vector");
+                               os << support::getStringFromVector(flags);
                                os << "\"\n";
                        }
                }
@@ -2294,7 +2303,8 @@ string const LyXRC::getDescription(LyXRCTags tag)
                break;
 
        case RC_NUMLASTFILES:
-               str = lyx::from_utf8(bformat(lyx::to_utf8(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu.")), maxlastfiles));
+               str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
+                       maxlastfiles);
                break;
 
        case RC_PATH_PREFIX:
@@ -2509,7 +2519,7 @@ string const LyXRC::getDescription(LyXRCTags tag)
                break;
        }
 
-                                  return lyx::to_utf8(str);
+                                  return to_utf8(str);
 }
 
 // The global instance
@@ -2517,3 +2527,6 @@ LyXRC lyxrc;
 
 // The global copy of the system lyxrc entries (everything except preferences)
 LyXRC system_lyxrc;
+
+
+} // namespace lyx