]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
* src/LyXRC.{cpp,h}:
[lyx.git] / src / LyXRC.cpp
index f415aecce6aa2d1e64f6b77d4f61355c6f6f0c11..c8cf673b3b1b52ac132f12e5aaabde40a1ab0806 100644 (file)
@@ -28,7 +28,7 @@
 #include "gettext.h"
 #include "Session.h"
 #include "Lexer.h"
-#include "Font.h"
+#include "FontEnums.h"
 #include "Mover.h"
 
 #include "graphics/GraphicsTypes.h"
@@ -165,6 +165,7 @@ keyword_item lyxrcTags[] = {
        { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
        { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
        { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
+       { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
        // compatibility with versions older than 1.4.0 only
        { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
        { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
@@ -224,16 +225,16 @@ void LyXRC::setDefaults() {
        geometry_height = 0;
        geometry_xysaved = true;
        // Default LaTeX font size:
-       font_sizes[Font::SIZE_TINY] = "5.0";
-       font_sizes[Font::SIZE_SCRIPT] = "7.0";
-       font_sizes[Font::SIZE_FOOTNOTE] = "8.0";
-       font_sizes[Font::SIZE_SMALL] = "9.0";
-       font_sizes[Font::SIZE_NORMAL] = "10.0";
-       font_sizes[Font::SIZE_LARGE] = "12.0";
-       font_sizes[Font::SIZE_LARGER] = "14.4";
-       font_sizes[Font::SIZE_LARGEST] = "17.26";
-       font_sizes[Font::SIZE_HUGE] = "20.74";
-       font_sizes[Font::SIZE_HUGER] = "24.88";
+       font_sizes[FONT_SIZE_TINY] = "5.0";
+       font_sizes[FONT_SIZE_SCRIPT] = "7.0";
+       font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
+       font_sizes[FONT_SIZE_SMALL] = "9.0";
+       font_sizes[FONT_SIZE_NORMAL] = "10.0";
+       font_sizes[FONT_SIZE_LARGE] = "12.0";
+       font_sizes[FONT_SIZE_LARGER] = "14.4";
+       font_sizes[FONT_SIZE_LARGEST] = "17.26";
+       font_sizes[FONT_SIZE_HUGE] = "20.74";
+       font_sizes[FONT_SIZE_HUGER] = "24.88";
        use_scalable_fonts = true;
        roman_font_name = "";
        sans_font_name = "";
@@ -280,6 +281,7 @@ void LyXRC::setDefaults() {
        preview_hashed_labels  = false;
        preview_scale_factor = "0.9";
        use_converter_cache = true;
+       use_pixmap_cache = false;
        converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
 
        user_name = to_utf8(support::user_name());
@@ -657,43 +659,43 @@ int LyXRC::read(Lexer & lexrc)
 
                case RC_SCREEN_FONT_SIZES:
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_TINY] =
+                               font_sizes[FONT_SIZE_TINY] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_SCRIPT] =
+                               font_sizes[FONT_SIZE_SCRIPT] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_FOOTNOTE] =
+                               font_sizes[FONT_SIZE_FOOTNOTE] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_SMALL] =
+                               font_sizes[FONT_SIZE_SMALL] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_NORMAL] =
+                               font_sizes[FONT_SIZE_NORMAL] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_LARGE] =
+                               font_sizes[FONT_SIZE_LARGE] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_LARGER] =
+                               font_sizes[FONT_SIZE_LARGER] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_LARGEST] =
+                               font_sizes[FONT_SIZE_LARGEST] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_HUGE] =
+                               font_sizes[FONT_SIZE_HUGE] =
                                        lexrc.getString();
                        }
                        if (lexrc.next()) {
-                               font_sizes[Font::SIZE_HUGER] =
+                               font_sizes[FONT_SIZE_HUGER] =
                                        lexrc.getString();
                        }
                        break;
@@ -901,6 +903,11 @@ int LyXRC::read(Lexer & lexrc)
                                isp_use_pers_dict = lexrc.getBool();
                        }
                        break;
+               case RC_USE_PIXMAP_CACHE:
+                       if (lexrc.next()) {
+                               use_pixmap_cache = lexrc.getBool();
+                       }
+                       break;
                case RC_USE_ESC_CHARS:
                        if (lexrc.next()) {
                                isp_use_esc_chars = lexrc.getBool();
@@ -1327,7 +1334,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                        os << "# Display graphics within LyX\n"
                           << "# monochrome|grayscale|color|none\n"
                           << "\\display_graphics "
-                          << graphics::displayTranslator().find(display_graphics)
+                          << graphics::displayTranslator().find(
+                                graphics::DisplayType(display_graphics))
                           << '\n';
                }
                if (tag != RC_LAST)
@@ -1653,39 +1661,39 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                        break;
        case RC_SCREEN_FONT_SIZES:
                if (ignore_system_lyxrc ||
-                   font_sizes[Font::SIZE_TINY]
-                   != system_lyxrc.font_sizes[Font::SIZE_TINY] ||
-                   font_sizes[Font::SIZE_SCRIPT]
-                   != system_lyxrc.font_sizes[Font::SIZE_SCRIPT] ||
-                   font_sizes[Font::SIZE_FOOTNOTE]
-                   != system_lyxrc.font_sizes[Font::SIZE_FOOTNOTE] ||
-                   font_sizes[Font::SIZE_SMALL]
-                   != system_lyxrc.font_sizes[Font::SIZE_SMALL] ||
-                   font_sizes[Font::SIZE_NORMAL]
-                   != system_lyxrc.font_sizes[Font::SIZE_NORMAL] ||
-                   font_sizes[Font::SIZE_LARGE]
-                   != system_lyxrc.font_sizes[Font::SIZE_LARGE] ||
-                   font_sizes[Font::SIZE_LARGER]
-                   != system_lyxrc.font_sizes[Font::SIZE_LARGER] ||
-                   font_sizes[Font::SIZE_LARGEST]
-                   != system_lyxrc.font_sizes[Font::SIZE_LARGEST] ||
-                   font_sizes[Font::SIZE_HUGE]
-                   != system_lyxrc.font_sizes[Font::SIZE_HUGE] ||
-                   font_sizes[Font::SIZE_HUGER]
-                   != system_lyxrc.font_sizes[Font::SIZE_HUGER]) {
+                   font_sizes[FONT_SIZE_TINY]
+                   != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
+                   font_sizes[FONT_SIZE_SCRIPT]
+                   != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
+                   font_sizes[FONT_SIZE_FOOTNOTE]
+                   != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
+                   font_sizes[FONT_SIZE_SMALL]
+                   != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
+                   font_sizes[FONT_SIZE_NORMAL]
+                   != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
+                   font_sizes[FONT_SIZE_LARGE]
+                   != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
+                   font_sizes[FONT_SIZE_LARGER]
+                   != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
+                   font_sizes[FONT_SIZE_LARGEST]
+                   != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
+                   font_sizes[FONT_SIZE_HUGE]
+                   != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
+                   font_sizes[FONT_SIZE_HUGER]
+                   != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
                        os.setf(ios::fixed);
                        os.precision(2);
                        os << "\\screen_font_sizes"
-                          << ' ' << font_sizes[Font::SIZE_TINY]
-                          << ' ' << font_sizes[Font::SIZE_SCRIPT]
-                          << ' ' << font_sizes[Font::SIZE_FOOTNOTE]
-                          << ' ' << font_sizes[Font::SIZE_SMALL]
-                          << ' ' << font_sizes[Font::SIZE_NORMAL]
-                          << ' ' << font_sizes[Font::SIZE_LARGE]
-                          << ' ' << font_sizes[Font::SIZE_LARGER]
-                          << ' ' << font_sizes[Font::SIZE_LARGEST]
-                          << ' ' << font_sizes[Font::SIZE_HUGE]
-                          << ' ' << font_sizes[Font::SIZE_HUGER]
+                          << ' ' << font_sizes[FONT_SIZE_TINY]
+                          << ' ' << font_sizes[FONT_SIZE_SCRIPT]
+                          << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
+                          << ' ' << font_sizes[FONT_SIZE_SMALL]
+                          << ' ' << font_sizes[FONT_SIZE_NORMAL]
+                          << ' ' << font_sizes[FONT_SIZE_LARGE]
+                          << ' ' << font_sizes[FONT_SIZE_LARGER]
+                          << ' ' << font_sizes[FONT_SIZE_LARGEST]
+                          << ' ' << font_sizes[FONT_SIZE_HUGE]
+                          << ' ' << font_sizes[FONT_SIZE_HUGER]
                           << '\n';
                }
                if (tag != RC_LAST)
@@ -2063,6 +2071,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
+       case RC_USE_PIXMAP_CACHE:
+               if (ignore_system_lyxrc ||
+                   use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
+                       os << "\\use_pixmap_cache "
+                          << convert<string>(use_pixmap_cache)
+                          << '\n';
+               }
        case RC_PERS_DICT:
                if (isp_pers_dict != system_lyxrc.isp_pers_dict) {
                        string const path = os::external_path(isp_pers_dict);
@@ -2497,6 +2512,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
                break;
 
+       case RC_USE_PIXMAP_CACHE:
+               str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
+               break;
+
        case RC_PREVIEW:
                str = _("Shows a typeset preview of things such as math");
                break;