X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXRC.cpp;h=a4520de545474812293b38f58edfb0fc3b621b73;hb=1acedf11da79f509da706bc8d6d2f491c9676087;hp=2ecf9dd08199ea68941b6a6088c442d7e01d53a5;hpb=e1ce2f92db49d50c688414a32944be8e718faa2e;p=lyx.git diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 2ecf9dd081..a4520de545 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -21,11 +21,11 @@ #include "LyXRC.h" -#include "debug.h" +#include "support/debug.h" #include "Color.h" #include "Converter.h" #include "Format.h" -#include "gettext.h" +#include "support/gettext.h" #include "Session.h" #include "Lexer.h" #include "FontEnums.h" @@ -40,28 +40,13 @@ #include "support/os.h" #include "support/userinfo.h" +using namespace std; +using namespace lyx::support; namespace lyx { namespace os = support::os; -using support::ascii_lowercase; -using support::bformat; -using support::expandPath; -using support::FileName; -using support::getEnv; -using support::libFileSearch; -using support::token; - -using std::cout; -using std::endl; - -using std::ios; -using std::ofstream; -using std::ostream; -using std::string; - - namespace { // when adding something to this array keep it sorted! @@ -92,6 +77,7 @@ keyword_item lyxrcTags[] = { { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS }, { "\\document_path", LyXRC::RC_DOCUMENTPATH }, { "\\escape_chars", LyXRC::RC_ESC_CHARS }, + { "\\example_path", LyXRC::RC_EXAMPLEPATH }, { "\\font_encoding", LyXRC::RC_FONT_ENCODING }, { "\\format", LyXRC::RC_FORMAT }, { "\\index_command", LyXRC::RC_INDEX_COMMAND }, @@ -170,6 +156,7 @@ keyword_item lyxrcTags[] = { { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB }, // compatibility with versions older than 1.4.0 only { "\\use_tempdir", LyXRC::RC_USETEMPDIR }, + { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP }, { "\\user_email", LyXRC::RC_USER_EMAIL }, { "\\user_name", LyXRC::RC_USER_NAME }, { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION }, @@ -279,6 +266,7 @@ void LyXRC::setDefaults() { preview_hashed_labels = false; preview_scale_factor = "0.9"; use_converter_cache = true; + use_tooltip = true; use_pixmap_cache = false; converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months @@ -318,7 +306,7 @@ int LyXRC::read(FileName const & filename) } -int LyXRC::read(std::istream & is) +int LyXRC::read(istream & is) { Lexer lexrc(lyxrcTags, lyxrcCount); if (lyxerr.debugging(Debug::PARSER)) @@ -705,6 +693,13 @@ int LyXRC::read(Lexer & lexrc) } break; + case RC_EXAMPLEPATH: + if (lexrc.next()) { + example_path = os::internal_path(lexrc.getString()); + example_path = expandPath(example_path); + } + break; + case RC_TEMPLATEPATH: if (lexrc.next()) { template_path = os::internal_path(lexrc.getString()); @@ -889,6 +884,11 @@ int LyXRC::read(Lexer & lexrc) isp_use_pers_dict = lexrc.getBool(); } break; + case RC_USE_TOOLTIP: + if (lexrc.next()) { + use_tooltip = lexrc.getBool(); + } + break; case RC_USE_PIXMAP_CACHE: if (lexrc.next()) { use_pixmap_cache = lexrc.getBool(); @@ -1068,7 +1068,7 @@ int LyXRC::read(Lexer & lexrc) int flgs = Format::none; while (!flags.empty()) { string flag; - flags = support::split(flags, flag, ','); + flags = split(flags, flag, ','); if (flag == "document") flgs |= Format::document; else if (flag == "vector") @@ -1200,7 +1200,7 @@ void LyXRC::print() const class SameMover { public: - typedef std::pair Data; + typedef pair Data; SameMover(Data const & comparison) : comparison_(comparison) {} @@ -1932,6 +1932,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_EXAMPLEPATH: + if (ignore_system_lyxrc || + example_path != system_lyxrc.example_path) { + string const path = os::external_path(example_path); + os << "\\example_path \"" << path << "\"\n"; + } + if (tag != RC_LAST) + break; case RC_TEMPLATEPATH: if (ignore_system_lyxrc || template_path != system_lyxrc.template_path) { @@ -2053,6 +2061,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; + case RC_USE_TOOLTIP: + if (ignore_system_lyxrc || + use_tooltip != system_lyxrc.use_tooltip) { + os << "\\use_tooltip " + << convert(use_tooltip) + << '\n'; + } case RC_USE_PIXMAP_CACHE: if (ignore_system_lyxrc || use_pixmap_cache != system_lyxrc.use_pixmap_cache) { @@ -2214,12 +2229,12 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c << cit->shortcut() << "\" \"" << cit->viewer() << "\" \"" << cit->editor() << "\" \""; - std::vector flags; + vector flags; if (cit->documentFormat()) flags.push_back("document"); if (cit->vectorFormat()) flags.push_back("vector"); - os << support::getStringFromVector(flags); + os << getStringFromVector(flags); os << "\"\n"; } } @@ -2280,10 +2295,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c for (; it != end; ++it) { Movers::const_iterator const sysit = - std::find_if(sysbegin, sysend, SameMover(*it)); + find_if(sysbegin, sysend, SameMover(*it)); if (sysit == sysend) { - std::string const & fmt = it->first; - std::string const & command = + string const & fmt = it->first; + string const & command = it->second.command(); os << "\\copier " << fmt @@ -2382,8 +2397,7 @@ string const LyXRC::getDescription(LyXRCTags tag) break; case RC_DEFFILE: - //FIXME: fix description. - str = _("Command definition file."); + str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories."); break; case RC_DEFAULT_LANGUAGE: @@ -2411,6 +2425,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Specify additional chars that can be part of a word."); break; + case RC_EXAMPLEPATH: + str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from."); + break; + case RC_FONT_ENCODING: str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages."); break; @@ -2665,6 +2683,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("Specify whether to pass the -T input encoding option to ispell. Enable this if you cannot check the spelling of words containing accented letters. This may not work with all dictionaries."); break; + case RC_USE_TOOLTIP: + str = _("Enable the automatic appearance of tool tips in the work area."); + break; + case RC_USE_PIXMAP_CACHE: str = _("Enable the pixmap cache that might improve performance on Mac and Windows."); break;