X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=802e3cd47bd42ecbb24cd725334e82d38f4d55e4;hb=04eef3480faffb98b87f23cf39c09f2bb3c71173;hp=587e1e7c71dda3fa0651f396da7712aa0ce1fa1d;hpb=cc653feb605bcbfdbbad436f23547dc0728a175a;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 587e1e7c71..802e3cd47b 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -59,7 +59,7 @@ namespace { // The format should also be updated in configure.py, and conversion code // should be added to prefs2prefs_prefs.py. -static unsigned int const LYXRC_FILEFORMAT = 20; // tommaso: 'needauth' options +static unsigned int const LYXRC_FILEFORMAT = 22; // ef: pygmentize_command // when adding something to this array keep it sorted! LexerKeyword lyxrcTags[] = { @@ -124,6 +124,7 @@ LexerKeyword lyxrcTags[] = { { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES }, { "\\index_command", LyXRC::RC_INDEX_COMMAND }, { "\\input", LyXRC::RC_INPUT }, + { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES }, { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND }, { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND }, { "\\kbmap", LyXRC::RC_KBMAP }, @@ -157,6 +158,7 @@ LexerKeyword lyxrcTags[] = { { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG }, { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG }, { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG }, + { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND }, { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED }, { "\\save_origin", LyXRC::RC_SAVE_ORIGIN }, { "\\screen_dpi", LyXRC::RC_SCREEN_DPI }, @@ -236,13 +238,15 @@ void LyXRC::setDefaults() default_view_format = "pdf2"; default_otf_view_format = "pdf4"; chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38"; - bibtex_command = "bibtex"; + bibtex_command = "automatic"; fontenc = "default"; index_command = "makeindex -c -q"; nomencl_command = "makeindex -s nomencl.ist"; + pygmentize_command = string(); dpi = 75; // Because a screen is typically wider than a piece of paper: zoom = 150; + currentZoom = zoom; allow_geometry_session = true; // Default LaTeX font size: font_sizes[FONT_SIZE_TINY] = "5.0"; @@ -542,6 +546,12 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) lexrc >> print_paper_flag; break; + case RC_PYGMENTIZE_COMMAND: + if (lexrc.next(true)) { + pygmentize_command = lexrc.getString(); + } + break; + case RC_VIEWDVI_PAPEROPTION: if (lexrc.next()) view_dvi_paper_option = lexrc.getString(); @@ -573,6 +583,12 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) } break; + case RC_JBIBTEX_ALTERNATIVES: + if (lexrc.next(true)) { + jbibtex_alternatives.insert(lexrc.getString()); + } + break; + case RC_INDEX_ALTERNATIVES: if (lexrc.next(true)) { index_alternatives.insert(lexrc.getString()); @@ -987,7 +1003,7 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) case RC_VIEWER: { string format, command; lexrc >> format >> command; - formats.setViewer(format, command); + theFormats().setViewer(format, command); break; } case RC_FILEFORMAT: { @@ -1038,9 +1054,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) if (theConverters().formatIsUsed(format)) LYXERR0("Can't delete format " << format); else - formats.erase(format); + theFormats().erase(format); } else { - formats.add(format, extensions, prettyname, + theFormats().add(format, extensions, prettyname, shortcut, viewer, editor, mime, flgs); } break; @@ -1220,7 +1236,7 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) } /// Update converters data-structures - theConverters().update(formats); + theConverters().update(theFormats()); theConverters().buildGraph(); theBufferList().invalidateConverterCache(); @@ -1441,6 +1457,18 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_JBIBTEX_ALTERNATIVES: { + CommandSet::const_iterator it = jbibtex_alternatives.begin(); + CommandSet::const_iterator end = jbibtex_alternatives.end(); + for ( ; it != end; ++it) { + if (ignore_system_lyxrc + || !system_lyxrc.jbibtex_alternatives.count(*it)) + os << "\\jbibtex_alternatives \"" + << *it << "\"\n"; + } + if (tag != RC_LAST) + break; + } case RC_INDEX_ALTERNATIVES: { CommandSet::const_iterator it = index_alternatives.begin(); CommandSet::const_iterator end = index_alternatives.end(); @@ -1481,6 +1509,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_PYGMENTIZE_COMMAND: + if (ignore_system_lyxrc || + pygmentize_command != system_lyxrc.pygmentize_command) { + os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n"; + } + if (tag != RC_LAST) + break; case RC_TEX_EXPECTS_WINDOWS_PATHS: // Don't write this setting to the preferences file, // but allow temporary changes (bug 7557). @@ -2539,10 +2574,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c case RC_FILEFORMAT: // New/modified formats - for (Formats::const_iterator cit = formats.begin(); - cit != formats.end(); ++cit) { + for (Formats::const_iterator cit = theFormats().begin(); + cit != theFormats().end(); ++cit) { Format const * format = - system_formats.getFormat(cit->name()); + theSystemFormats().getFormat(cit->name()); if (!format || format->extensions() != cit->extensions() || format->prettyname() != cit->prettyname() || @@ -2575,9 +2610,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } // Look for deleted formats - for (Formats::const_iterator cit = system_formats.begin(); - cit != system_formats.end(); ++cit) - if (!formats.getFormat(cit->name())) + for (Formats::const_iterator cit = theSystemFormats().begin(); + cit != theSystemFormats().end(); ++cit) + if (!theFormats().getFormat(cit->name())) os << "\\format \"" << cit->name() << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n"; if (tag != RC_LAST) @@ -2786,8 +2821,10 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_INDEX_ALTERNATIVES: case LyXRC::RC_INDEX_COMMAND: case LyXRC::RC_JBIBTEX_COMMAND: + case LyXRC::RC_JBIBTEX_ALTERNATIVES: case LyXRC::RC_JINDEX_COMMAND: case LyXRC::RC_NOMENCL_COMMAND: + case LyXRC::RC_PYGMENTIZE_COMMAND: case LyXRC::RC_INPUT: case LyXRC::RC_KBMAP: case LyXRC::RC_KBMAP_PRIMARY: @@ -3046,6 +3083,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options."); break; + case RC_PYGMENTIZE_COMMAND: + str = _("The command to run the python pygments syntax highlighter."); + break; + case RC_INPUT: break;