]> git.lyx.org Git - lyx.git/blobdiff - src/LyXRC.cpp
* LaTeXFeatures.cpp (getI18nPreamble):
[lyx.git] / src / LyXRC.cpp
index 487255f5fba67f1f4aa1783eb728e4b464cb3bed..b196c1c838fb2cb2223c55eaba7cf50dfa7d460a 100644 (file)
@@ -85,6 +85,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
        { "\\copier", LyXRC::RC_COPIER },
        { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
+       { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
        { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
        { "\\def_file", LyXRC::RC_DEFFILE },
        { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
@@ -99,6 +100,7 @@ LexerKeyword lyxrcTags[] = {
        { "\\example_path", LyXRC::RC_EXAMPLEPATH },
        { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
        { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
+       { "\\force_paint_single_char", LyXRC::RC_FORCE_PAINT_SINGLE_CHAR },
        { "\\format", LyXRC::RC_FILEFORMAT },
        { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
        { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
@@ -359,6 +361,7 @@ void LyXRC::setDefaults()
        completion_inline_dots = -1;
        completion_inline_delay = 0.2;
        default_decimal_point = ".";
+       cursor_width = 1;
 }
 
 
@@ -377,13 +380,13 @@ void oldFontFormat(string & family, string & foundry)
 } // namespace anon
 
 
-bool LyXRC::read(FileName const & filename)
+bool LyXRC::read(FileName const & filename, bool check_format)
 {
        Lexer lexrc(lyxrcTags);
        lexrc.setFile(filename);
        LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
-       ReturnValues retval = read(lexrc);
-       if (retval != FormatMismatch)
+       ReturnValues retval = read(lexrc, check_format);
+       if (!check_format || retval != FormatMismatch)
                return retval == ReadOK;
 
        LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
@@ -397,7 +400,7 @@ bool LyXRC::read(FileName const & filename)
        Lexer lexrc2(lyxrcTags);
        lexrc2.setFile(tempfile);
        LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
-       retval = read(lexrc2);
+       retval = read(lexrc2, check_format);
        tempfile.removeFile();
        return retval == ReadOK;
 }
@@ -410,11 +413,11 @@ bool LyXRC::read(istream & is)
        Lexer lexrc(lyxrcTags);
        lexrc.setStream(is);
        LYXERR(Debug::LYXRC, "Reading istream...");
-       return read(lexrc) == ReadOK;
+       return read(lexrc, false) == ReadOK;
 }
 
 
-LyXRC::ReturnValues LyXRC::read(Lexer & lexrc)
+LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
 {
        if (lyxerr.debugging(Debug::PARSER))
                lexrc.printTable(lyxerr);
@@ -422,6 +425,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc)
        if (!lexrc.isOK())
                return ReadError;
 
+       // default for current rowpainter capabilities
+       force_paint_single_char = true;
+
        // format prior to 2.0 and introduction of format tag
        unsigned int format = 0;
 
@@ -453,9 +459,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc)
                                FileName const tmp =
                                        libFileSearch(string(),
                                                      lexrc.getString());
-                               if (read(tmp)) {
-                                       lexrc.printError("Error reading "
-                                                        "included file: " + tmp.absFileName());
+                               if (read(tmp, check_format)) {
+                                       lexrc.printError(
+                                           "Error reading included file: " + tmp.absFileName());
                                }
                        }
                        break;
@@ -523,6 +529,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc)
                        lexrc >> fontenc;
                        break;
 
+               case RC_FORCE_PAINT_SINGLE_CHAR:
+                       lexrc >> force_paint_single_char;
+                       break;
+                               
                case RC_PRINTER:
                        lexrc >> printer;
                        break;
@@ -895,6 +905,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc)
                        lexrc >> cursor_follows_scrollbar;
                        break;
 
+               case RC_CURSOR_WIDTH:
+                       lexrc >> cursor_width;
+                       break;
+
                case RC_SCROLL_BELOW_DOCUMENT:
                        lexrc >> scroll_below_document;
                        break;
@@ -1090,6 +1104,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc)
                                        flgs |= Format::document;
                                else if (flag == "vector")
                                        flgs |= Format::vector;
+                               else if (flag == "menu=export")
+                                       flgs |= Format::export_menu;
                                else
                                        LYXERR0("Ignoring unknown flag `"
                                               << flag << "' for format `"
@@ -1262,7 +1278,7 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc)
 
                // This is triggered the first time through the loop unless
                // we hit a format tag.
-               if (format != LYXRC_FILEFORMAT)
+               if (check_format && format != LYXRC_FILEFORMAT)
                        return FormatMismatch;
        }
 
@@ -1744,6 +1760,15 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                }
                if (tag != RC_LAST)
                        break;
+       case RC_CURSOR_WIDTH:
+               if (ignore_system_lyxrc ||
+                       cursor_width
+                       != system_lyxrc.cursor_width) {
+                       os << "\\cursor_width "
+                       << cursor_width << '\n';
+               }
+               if (tag != RC_LAST)
+                       break;
        case RC_SCROLL_BELOW_DOCUMENT:
                if (ignore_system_lyxrc ||
                    scroll_below_document
@@ -2178,6 +2203,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
                if (tag != RC_LAST)
                        break;
 
+       case RC_FORCE_PAINT_SINGLE_CHAR:
+               if (ignore_system_lyxrc ||
+                   force_paint_single_char != system_lyxrc.force_paint_single_char) {
+                       os << "\\force_paint_single_char \"" << force_paint_single_char << "\"\n";
+               }
+               if (tag != RC_LAST)
+                       break;
+
                os << "\n#\n"
                   << "# FILE SECTION ######################################\n"
                   << "#\n\n";
@@ -2878,6 +2911,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_ESC_CHARS:
        case LyXRC::RC_EXAMPLEPATH:
        case LyXRC::RC_FONT_ENCODING:
+       case LyXRC::RC_FORCE_PAINT_SINGLE_CHAR:
        case LyXRC::RC_FILEFORMAT:
        case LyXRC::RC_GROUP_LAYOUTS:
        case LyXRC::RC_HUNSPELLDIR_PATH:
@@ -2986,6 +3020,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_EXPORT_OVERWRITE:
        case LyXRC::RC_DEFAULT_DECIMAL_POINT:
        case LyXRC::RC_SCROLL_WHEEL_ZOOM:
+       case LyXRC::RC_CURSOR_WIDTH:
        case LyXRC::RC_LAST:
                break;
        }
@@ -3059,6 +3094,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen.");
                break;
 
+       case RC_CURSOR_WIDTH:
+               str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
+               break;
+
        case RC_SCROLL_BELOW_DOCUMENT:
                str = _("LyX normally doesn't allow the user to scroll further than the bottom of the document. Set to true if you prefer to scroll the bottom of the document to the top of the screen");
                break;
@@ -3120,6 +3159,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
                str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
                break;
 
+       case RC_FORCE_PAINT_SINGLE_CHAR:
+               str = _("Disable any kerning and ligatures for text drawing on screen.");
+               break;
+
        case RC_FILEFORMAT:
                break;