3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
21 #include "BufferList.h"
23 #include "Converter.h"
24 #include "FontEnums.h"
30 #include "SpellChecker.h"
33 #include "graphics/GraphicsTypes.h"
35 #include "support/convert.h"
36 #include "support/debug.h"
37 #include "support/environment.h"
38 #include "support/FileName.h"
39 #include "support/filetools.h"
40 #include "support/gettext.h"
41 #include "support/lstrings.h"
42 #include "support/os.h"
43 #include "support/Package.h"
44 #include "support/TempFile.h"
45 #include "support/userinfo.h"
52 using namespace lyx::support;
56 namespace os = support::os;
60 // The format should also be updated in configure.py, and conversion code
61 // should be added to prefs2prefs_prefs.py.
62 static unsigned int const LYXRC_FILEFORMAT = 27; // spitz: add flavor value to needaux flag
63 // when adding something to this array keep it sorted!
64 LexerKeyword lyxrcTags[] = {
65 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
66 { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
67 { "\\alternate_language", LyXRC::RC_ALT_LANG },
68 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
69 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
70 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
71 { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
72 { "\\autosave", LyXRC::RC_AUTOSAVE },
73 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
74 { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
75 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
76 { "\\bind_file", LyXRC::RC_BINDFILE },
77 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
78 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
79 { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW },
80 { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
81 { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
82 { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
83 { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
84 { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
85 { "\\completion_minlength", LyXRC::RC_COMPLETION_MINLENGTH },
86 { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
87 { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
88 { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
89 { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
90 { "\\converter", LyXRC::RC_CONVERTER },
91 { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
92 { "\\copier", LyXRC::RC_COPIER },
93 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
94 { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
95 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
96 { "\\def_file", LyXRC::RC_DEFFILE },
97 { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
98 { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
99 { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT },
100 { "\\default_platex_view_format", LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT },
101 { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
102 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
103 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
104 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
105 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
106 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
107 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
108 { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
109 { "\\format", LyXRC::RC_FILEFORMAT },
110 { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
111 { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
112 { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
113 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
114 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
115 { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
116 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
117 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
118 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
119 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
120 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
121 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
122 { "\\icon_set", LyXRC::RC_ICON_SET },
123 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
124 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
125 { "\\input", LyXRC::RC_INPUT },
126 { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES },
127 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
128 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
129 { "\\kbmap", LyXRC::RC_KBMAP },
130 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
131 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
132 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
133 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
134 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
135 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
136 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
137 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
138 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
139 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
140 { "\\load_session", LyXRC::RC_LOADSESSION },
141 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
142 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
143 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
144 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
145 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
146 { "\\mouse_middlebutton_paste", LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE },
147 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
148 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
149 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
150 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
151 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
152 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
153 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
154 { "\\preview", LyXRC::RC_PREVIEW },
155 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
156 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
157 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
158 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
159 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
160 { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
161 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
162 { "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
163 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
164 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
165 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
166 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
167 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
168 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
169 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
170 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
171 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
172 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
173 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
174 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
175 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
176 { "\\set_color", LyXRC::RC_SET_COLOR },
177 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
178 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
179 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
180 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
181 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
182 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
183 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
184 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
185 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
186 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
187 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
188 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
189 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
190 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
191 { "\\ui_file", LyXRC::RC_UIFILE },
192 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
193 { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
194 { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
195 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
196 { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
197 { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
198 // compatibility with versions older than 1.4.0 only
199 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
200 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
201 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
202 { "\\user_email", LyXRC::RC_USER_EMAIL },
203 { "\\user_name", LyXRC::RC_USER_NAME },
204 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
205 // compatibility with versions older than 1.4.0 only
206 { "\\viewer", LyXRC::RC_VIEWER},
207 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
208 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
209 { "format", LyXRC::RC_LYXRCFORMAT }
212 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
223 void LyXRC::setDefaults()
226 use_system_theme_icons = false;
228 def_file = "default";
230 // The current document directory
231 texinputs_prefix = ".";
232 print_landscape_flag = "-t landscape";
233 print_paper_flag = "-t";
234 print_paper_dimension_flag = "-T";
235 document_path.erase();
236 view_dvi_paper_option.erase();
237 default_view_format = "pdf2";
238 default_otf_view_format = "pdf4";
239 default_platex_view_format = "pdf3";
240 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
241 bibtex_command = "automatic";
242 index_command = "makeindex -c -q";
243 nomencl_command = "makeindex -s nomencl.ist";
244 pygmentize_command = string();
246 // Because a screen is typically wider than a piece of paper:
248 currentZoom = defaultZoom;
249 allow_geometry_session = true;
250 // Default LaTeX font size:
251 font_sizes[FONT_SIZE_TINY] = "5.0";
252 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
253 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
254 font_sizes[FONT_SIZE_SMALL] = "9.0";
255 font_sizes[FONT_SIZE_NORMAL] = "10.0";
256 font_sizes[FONT_SIZE_LARGE] = "12.0";
257 font_sizes[FONT_SIZE_LARGER] = "14.4";
258 font_sizes[FONT_SIZE_LARGEST] = "17.26";
259 font_sizes[FONT_SIZE_HUGE] = "20.74";
260 font_sizes[FONT_SIZE_HUGER] = "24.88";
261 use_scalable_fonts = true;
262 roman_font_name = "";
264 typewriter_font_name = "";
266 auto_region_delete = true;
267 auto_reset_options = false;
268 plaintext_linelen = 65;
269 mouse_wheel_speed = 1.0;
271 check_lastfiles = true;
272 use_lastfilepos = true;
273 use_native_filedialog = true;
274 load_session = false;
276 save_compressed = false;
278 backupdir_path.erase();
279 display_graphics = true;
280 // Spellchecker settings:
281 // FIXME: this check should test the target platform (darwin)
282 #if defined(USE_MACOSX_PACKAGING)
283 spellchecker = "native";
284 #elif defined(USE_ENCHANT)
285 spellchecker = "enchant";
286 #elif defined(USE_ASPELL)
287 spellchecker = "aspell";
288 #elif defined(USE_HUNSPELL)
289 spellchecker = "hunspell";
291 spellchecker = "aspell";
293 spellchecker_accept_compound = false;
294 spellcheck_continuously = false;
295 completion_minlength = 6;
296 spellcheck_notes = true;
298 visual_cursor = false;
300 mark_foreign_language = true;
301 language_auto_begin = true;
302 language_auto_end = true;
303 language_global_options = true;
304 language_package_selection = LP_AUTO;
305 language_custom_package = "\\usepackage{babel}";
306 language_command_begin = "\\selectlanguage{$$lang}";
307 language_command_local = "\\foreignlanguage{$$lang}{";
308 sort_layouts = false;
309 group_layouts = true;
310 gui_language = "auto";
312 windows_style_tex_paths = false;
313 tex_allows_spaces = false;
314 date_insert_format = "%x";
315 cursor_follows_scrollbar = false;
316 scroll_below_document = false;
317 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
318 paragraph_markers = false;
319 mac_dontswap_ctrl_meta = false;
320 mac_like_cursor_movement = false;
321 macro_edit_style = MACRO_EDIT_INLINE_BOX;
322 dialogs_iconify_with_main = false;
323 preview = PREVIEW_OFF;
324 preview_hashed_labels = false;
325 preview_scale_factor = 1.0;
326 use_converter_cache = true;
327 use_converter_needauth_forbidden = true;
328 use_converter_needauth = true;
329 use_system_colors = false;
331 use_pixmap_cache = false;
332 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
333 user_name = to_utf8(support::user_name());
334 user_email = to_utf8(support::user_email());
335 open_buffers_in_tabs = true;
336 single_close_tab_button = false;
337 single_instance = true;
338 forward_search_dvi = string();
339 forward_search_pdf = string();
340 export_overwrite = NO_FILES;
342 // Fullscreen settings
343 full_screen_limit = false;
344 full_screen_toolbars = true;
345 full_screen_tabbar = true;
346 full_screen_menubar = true;
347 full_screen_statusbar = true;
348 full_screen_scrollbar = true;
349 full_screen_width = 700;
351 completion_cursor_text = true;
352 completion_popup_math = true;
353 completion_popup_text = false;
354 completion_popup_delay = 2.0;
355 completion_popup_after_complete = true;
356 autocorrection_math = false;
357 completion_inline_math = true;
358 completion_inline_text = false;
359 completion_inline_dots = -1;
360 completion_inline_delay = 0.2;
361 default_decimal_point = ".";
362 default_length_unit = Length::CM;
364 close_buffer_with_last_view = "yes";
365 mouse_middlebutton_paste = true;
371 void oldFontFormat(string & family, string & foundry)
373 if (family.empty() || family[0] != '-')
375 foundry = token(family, '-', 1);
376 family = token(family, '-', 2);
384 bool LyXRC::read(FileName const & filename, bool check_format)
386 Lexer lexrc(lyxrcTags);
387 lexrc.setFile(filename);
388 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
389 ReturnValues retval = read(lexrc, check_format);
390 if (!check_format || retval != FormatMismatch)
391 return retval == ReadOK;
393 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
394 TempFile tmp("convert_lyxrc");
395 FileName const tempfile = tmp.name();
396 bool const success = prefs2prefs(filename, tempfile, false);
398 LYXERR0 ("Unable to convert " << filename.absFileName() <<
399 " to format " << LYXRC_FILEFORMAT);
402 // Keep this in the else branch, such that lexrc2 goes out
403 // of scope and releases the lock on tempfile before we
404 // attempt to remove it. This matters on Windows.
405 Lexer lexrc2(lyxrcTags);
406 lexrc2.setFile(tempfile);
407 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
408 retval = read(lexrc2, check_format);
409 if (retval == FormatMismatch)
410 LYXERR0("Conversion failed for " << filename.absFileName());
412 return retval == ReadOK;
416 // don't need to worry about conversion, because this is always
417 // from an internal source
418 bool LyXRC::read(istream & is)
420 Lexer lexrc(lyxrcTags);
422 LYXERR(Debug::LYXRC, "Reading istream...");
423 return read(lexrc, false) == ReadOK;
427 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
429 if (lyxerr.debugging(Debug::PARSER))
430 lexrc.printTable(lyxerr);
435 // format prior to 2.0 and introduction of format tag
436 unsigned int rc_format = 0;
438 while (lexrc.isOK()) {
439 // By using two switches we take advantage of the compiler
440 // telling us if we have missed a LyXRCTags element in
441 // the second switch.
442 // Note that this also shows a problem with Lexer since it
443 // helps us avoid taking advantage of the strictness of the
446 int le = lexrc.lex();
448 case Lexer::LEX_UNDEF:
449 lexrc.printError("Unknown tag `$$Token'");
451 case Lexer::LEX_FEOF:
456 switch (static_cast<LyXRCTags>(le)) {
459 rc_format = lexrc.getInteger();
461 case RC_INPUT: // Include file
464 libFileSearch(string(),
466 if (!read(tmp, check_format)) {
468 "Error reading included file: " + tmp.absFileName());
474 bind_file = os::internal_path(lexrc.getString());
479 def_file = os::internal_path(lexrc.getString());
484 ui_file = os::internal_path(lexrc.getString());
487 case RC_AUTORESET_OPTIONS:
488 lexrc >> auto_reset_options;
491 case RC_DISPLAY_GRAPHICS:
493 display_graphics = lexrc.getString() == "true";
496 case RC_TEX_EXPECTS_WINDOWS_PATHS:
497 lexrc >> windows_style_tex_paths;
500 case RC_TEX_ALLOWS_SPACES:
501 lexrc >> tex_allows_spaces;
504 case RC_TEXINPUTS_PREFIX:
505 lexrc >> texinputs_prefix;
512 case RC_KBMAP_PRIMARY:
514 string const kmap(os::internal_path(lexrc.getString()));
515 if (!libFileSearch("kbd", kmap, "kmap").empty()
517 primary_kbmap = kmap;
519 lexrc.printError("LyX: Keymap `$$Token' not found");
524 case RC_KBMAP_SECONDARY:
526 string const kmap(os::internal_path(lexrc.getString()));
527 if (!libFileSearch("kbd", kmap, "kmap").empty()
529 secondary_kbmap = kmap;
531 lexrc.printError("LyX: Keymap `$$Token' not found");
536 case RC_PRINTLANDSCAPEFLAG:
537 lexrc >> print_landscape_flag;
540 case RC_PRINTPAPERDIMENSIONFLAG:
541 lexrc >> print_paper_dimension_flag;
544 case RC_PRINTPAPERFLAG:
545 lexrc >> print_paper_flag;
548 case RC_PYGMENTIZE_COMMAND:
549 if (lexrc.next(true)) {
550 pygmentize_command = lexrc.getString();
554 case RC_VIEWDVI_PAPEROPTION:
556 view_dvi_paper_option = lexrc.getString();
558 view_dvi_paper_option.erase();
561 case RC_CHKTEX_COMMAND:
562 if (lexrc.next(true)) {
563 chktex_command = lexrc.getString();
567 case RC_BIBTEX_ALTERNATIVES:
568 if (lexrc.next(true)) {
569 bibtex_alternatives.insert(lexrc.getString());
573 case RC_BIBTEX_COMMAND:
574 if (lexrc.next(true)) {
575 bibtex_command = lexrc.getString();
579 case RC_JBIBTEX_COMMAND:
580 if (lexrc.next(true)) {
581 jbibtex_command = lexrc.getString();
585 case RC_JBIBTEX_ALTERNATIVES:
586 if (lexrc.next(true)) {
587 jbibtex_alternatives.insert(lexrc.getString());
591 case RC_INDEX_ALTERNATIVES:
592 if (lexrc.next(true)) {
593 index_alternatives.insert(lexrc.getString());
597 case RC_INDEX_COMMAND:
598 if (lexrc.next(true)) {
599 index_command = lexrc.getString();
603 case RC_JINDEX_COMMAND:
604 if (lexrc.next(true)) {
605 jindex_command = lexrc.getString();
609 case RC_SPLITINDEX_COMMAND:
610 if (lexrc.next(true)) {
611 splitindex_command = lexrc.getString();
615 case RC_NOMENCL_COMMAND:
616 if (lexrc.next(true)) {
617 nomencl_command = lexrc.getString();
626 lexrc >> defaultZoom;
627 if (defaultZoom < 10)
631 case RC_GEOMETRY_SESSION:
632 lexrc >> allow_geometry_session;
635 case RC_SCREEN_FONT_SIZES:
636 lexrc >> font_sizes[FONT_SIZE_TINY];
637 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
638 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
639 lexrc >> font_sizes[FONT_SIZE_SMALL];
640 lexrc >> font_sizes[FONT_SIZE_NORMAL];
641 lexrc >> font_sizes[FONT_SIZE_LARGE];
642 lexrc >> font_sizes[FONT_SIZE_LARGER];
643 lexrc >> font_sizes[FONT_SIZE_LARGEST];
644 lexrc >> font_sizes[FONT_SIZE_HUGE];
645 lexrc >> font_sizes[FONT_SIZE_HUGER];
648 case RC_SCREEN_FONT_SCALABLE:
649 lexrc >> use_scalable_fonts;
656 case RC_DOCUMENTPATH:
658 document_path = os::internal_path(lexrc.getString());
663 example_path = os::internal_path(lexrc.getString());
666 case RC_TEMPLATEPATH:
668 template_path = os::internal_path(lexrc.getString());
673 tempdir_path = os::internal_path(lexrc.getString());
676 case RC_THESAURUSDIRPATH:
678 thesaurusdir_path = os::internal_path(lexrc.getString());
681 case RC_HUNSPELLDIR_PATH:
683 hunspelldir_path = os::internal_path(lexrc.getString());
686 case RC_USELASTFILEPOS:
687 lexrc >> use_lastfilepos;
691 lexrc >> load_session;
694 case RC_MOUSE_WHEEL_SPEED:
695 lexrc >> mouse_wheel_speed;
698 case RC_COMPLETION_INLINE_DELAY:
699 lexrc >> completion_inline_delay;
702 case RC_COMPLETION_INLINE_MATH:
703 lexrc >> completion_inline_math;
706 case RC_COMPLETION_INLINE_TEXT:
707 lexrc >> completion_inline_text;
710 case RC_COMPLETION_INLINE_DOTS:
711 lexrc >> completion_inline_dots;
714 case RC_AUTOCORRECTION_MATH:
715 lexrc >> autocorrection_math;
718 case RC_COMPLETION_POPUP_DELAY:
719 lexrc >> completion_popup_delay;
722 case RC_COMPLETION_POPUP_MATH:
723 lexrc >> completion_popup_math;
726 case RC_COMPLETION_POPUP_TEXT:
727 lexrc >> completion_popup_text;
730 case RC_COMPLETION_CURSOR_TEXT:
731 lexrc >> completion_cursor_text;
734 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
735 lexrc >> completion_popup_after_complete;
738 case RC_COMPLETION_MINLENGTH:
739 lexrc >> completion_minlength;
742 case RC_NUMLASTFILES:
743 lexrc >> num_lastfiles;
746 case RC_CHECKLASTFILES:
747 lexrc >> check_lastfiles;
754 case RC_USE_SYSTEM_THEME_ICONS:
755 lexrc >> use_system_theme_icons;
758 case RC_SCREEN_FONT_ROMAN:
760 roman_font_name = lexrc.getString();
761 oldFontFormat(roman_font_name,
766 case RC_SCREEN_FONT_SANS:
768 sans_font_name = lexrc.getString();
769 oldFontFormat(sans_font_name, sans_font_foundry);
773 case RC_SCREEN_FONT_TYPEWRITER:
775 typewriter_font_name = lexrc.getString();
776 oldFontFormat(typewriter_font_name,
777 typewriter_font_foundry);
781 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
782 lexrc >> roman_font_foundry;
785 case RC_SCREEN_FONT_SANS_FOUNDRY:
786 lexrc >> sans_font_foundry;
789 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
790 lexrc >> typewriter_font_foundry;
795 lexrc.printError("Missing color tag.");
798 string lyx_name = lexrc.getString();
801 lexrc.printError("Missing color name for color: `$$Token'");
804 string x11_name = lexrc.getString();
806 ColorCode const col =
807 lcolor.getFromLyXName(lyx_name);
808 if (col == Color_none ||
809 col == Color_inherit ||
813 if (!lcolor.setColor(col, x11_name))
814 LYXERR0("Bad lyxrc set_color for " << lyx_name);
818 case RC_AUTOREGIONDELETE:
819 // Auto region delete defaults to true
820 lexrc >> auto_region_delete;
825 lyxpipes = os::internal_path(lexrc.getString());
828 case RC_CURSOR_FOLLOWS_SCROLLBAR:
829 lexrc >> cursor_follows_scrollbar;
832 case RC_CURSOR_WIDTH:
833 lexrc >> cursor_width;
836 case RC_SCROLL_BELOW_DOCUMENT:
837 lexrc >> scroll_below_document;
840 case RC_PARAGRAPH_MARKERS:
841 lexrc >> paragraph_markers;
844 case RC_MAC_DONTSWAP_CTRL_META:
845 lexrc >> mac_dontswap_ctrl_meta;
848 case RC_MAC_LIKE_CURSOR_MOVEMENT:
849 lexrc >> mac_like_cursor_movement;
852 case RC_MACRO_EDIT_STYLE:
854 switch (lexrc.getInteger()) {
855 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
856 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
857 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
862 case RC_DIALOGS_ICONIFY_WITH_MAIN:
863 lexrc >> dialogs_iconify_with_main;
866 case RC_PLAINTEXT_LINELEN:
867 lexrc >> plaintext_linelen;
869 // Spellchecker settings:
870 case RC_ACCEPT_COMPOUND:
871 lexrc >> spellchecker_accept_compound;
873 case RC_USE_NATIVE_FILEDIALOG:
874 lexrc >> use_native_filedialog;
876 case RC_USE_SYSTEM_COLORS:
877 lexrc >> use_system_colors;
880 lexrc >> use_tooltip;
882 case RC_USE_PIXMAP_CACHE:
883 lexrc >> use_pixmap_cache;
885 case RC_SPELLCHECKER:
886 lexrc >> spellchecker;
889 lexrc >> spellchecker_alt_lang;
892 lexrc >> spellchecker_esc_chars;
894 case RC_SPELLCHECK_CONTINUOUSLY:
895 lexrc >> spellcheck_continuously;
897 case RC_SPELLCHECK_NOTES:
898 lexrc >> spellcheck_notes;
901 lexrc >> make_backup;
903 case RC_SAVE_COMPRESSED:
904 lexrc >> save_compressed;
907 lexrc >> save_origin;
909 case RC_BACKUPDIR_PATH:
911 backupdir_path = os::internal_path(lexrc.getString());
913 case RC_DEFAULT_DECIMAL_POINT:
914 lexrc >> default_decimal_point;
916 case RC_DEFAULT_LENGTH_UNIT:
918 default_length_unit = (Length::UNIT) lexrc.getInteger();
920 case RC_DATE_INSERT_FORMAT:
921 lexrc >> date_insert_format;
923 case RC_LANGUAGE_CUSTOM_PACKAGE:
924 lexrc >> language_custom_package;
926 case RC_LANGUAGE_AUTO_BEGIN:
927 lexrc >> language_auto_begin;
929 case RC_LANGUAGE_AUTO_END:
930 lexrc >> language_auto_end;
932 case RC_LANGUAGE_GLOBAL_OPTIONS:
933 lexrc >> language_global_options;
935 case RC_LANGUAGE_PACKAGE_SELECTION:
937 switch (lexrc.getInteger()) {
939 language_package_selection = LP_AUTO;
942 language_package_selection = LP_BABEL;
945 language_package_selection = LP_CUSTOM;
948 language_package_selection = LP_NONE;
953 case RC_LANGUAGE_COMMAND_BEGIN:
954 lexrc >> language_command_begin;
956 case RC_LANGUAGE_COMMAND_END:
957 lexrc >> language_command_end;
959 case RC_LANGUAGE_COMMAND_LOCAL:
960 lexrc >> language_command_local;
962 case RC_VISUAL_CURSOR:
963 lexrc >> visual_cursor;
965 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
966 lexrc >> close_buffer_with_last_view;
969 lexrc >> auto_number;
971 case RC_MARK_FOREIGN_LANGUAGE:
972 lexrc >> mark_foreign_language;
978 fmt = lexrc.getString();
979 if (lexrc.next(true))
980 command = lexrc.getString();
981 setMover(fmt, command);
986 string from, to, command, flags;
988 from = lexrc.getString();
990 to = lexrc.getString();
991 if (lexrc.next(true))
992 command = lexrc.getString();
994 flags = lexrc.getString();
996 theConverters().erase(from, to);
998 theConverters().add(from, to, command, flags);
1001 // compatibility with versions older than 1.4.0 only
1003 string format, command;
1004 lexrc >> format >> command;
1005 theFormats().setViewer(format, command);
1008 case RC_FILEFORMAT: {
1010 string format, extensions, shortcut;
1011 docstring prettyname;
1012 if (!(lexrc >> format >> extensions))
1014 if (ok && lexrc.next(true))
1015 prettyname = lexrc.getDocString();
1019 if(!(lexrc >> shortcut))
1021 string viewer, editor;
1022 if (ok && lexrc.next(true))
1023 viewer = lexrc.getString();
1026 if (ok && lexrc.next(true))
1027 editor = lexrc.getString();
1031 if (!(lexrc >> flags >> mime))
1033 int flgs = Format::none;
1034 while (!flags.empty()) {
1036 flags = split(flags, flag, ',');
1037 if (flag == "document")
1038 flgs |= Format::document;
1039 else if (flag == "vector")
1040 flgs |= Format::vector;
1041 else if (flag == "zipped=native")
1042 flgs |= Format::zipped_native;
1043 else if (flag == "menu=export")
1044 flgs |= Format::export_menu;
1046 LYXERR0("Ignoring unknown flag `"
1047 << flag << "' for format `"
1051 LYXERR0("Syntax error in format " << format);
1052 else if (prettyname.empty()) {
1053 if (theConverters().formatIsUsed(format))
1054 LYXERR0("Can't delete format " << format);
1056 theFormats().erase(format);
1058 theFormats().add(format, extensions, prettyname,
1059 shortcut, viewer, editor, mime, flgs);
1063 case RC_VIEWER_ALTERNATIVES: {
1064 string format, command;
1065 if ((lexrc >> format) && lexrc.next(true)) {
1066 command = lexrc.getString();
1067 viewer_alternatives[format].insert(command);
1071 case RC_EDITOR_ALTERNATIVES: {
1072 string format, command;
1073 if ((lexrc >> format) && lexrc.next(true)) {
1074 command = lexrc.getString();
1075 editor_alternatives[format].insert(command);
1080 case RC_DEFAULT_OTF_VIEW_FORMAT:
1081 lexrc >> default_otf_view_format;
1084 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
1085 lexrc >> default_platex_view_format;
1088 case RC_DEFAULT_VIEW_FORMAT:
1089 lexrc >> default_view_format;
1092 case RC_GUI_LANGUAGE:
1093 lexrc >> gui_language;
1096 case RC_SHOW_BANNER:
1097 lexrc >> show_banner;
1102 string const tmp = lexrc.getString();
1103 if (tmp == "true" || tmp == "on")
1104 preview = PREVIEW_ON;
1105 else if (tmp == "no_math")
1106 preview = PREVIEW_NO_MATH;
1108 preview = PREVIEW_OFF;
1109 if (tmp != "false" && tmp != "off")
1110 LYXERR0("Unrecognized preview status \""
1116 case RC_PREVIEW_HASHED_LABELS:
1117 lexrc >> preview_hashed_labels;
1120 case RC_PREVIEW_SCALE_FACTOR:
1121 lexrc >> preview_scale_factor;
1128 lexrc >> user_email;
1131 case RC_PATH_PREFIX:
1132 lexrc >> path_prefix;
1135 case RC_USE_CONVERTER_CACHE:
1136 lexrc >> use_converter_cache;
1138 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1139 lexrc >> use_converter_needauth_forbidden;
1141 case RC_USE_CONVERTER_NEEDAUTH:
1142 lexrc >> use_converter_needauth;
1144 case RC_CONVERTER_CACHE_MAXAGE:
1145 lexrc >> converter_cache_maxage;
1148 case RC_SORT_LAYOUTS:
1149 lexrc >> sort_layouts;
1151 case RC_GROUP_LAYOUTS:
1152 lexrc >> group_layouts;
1154 case RC_FULL_SCREEN_LIMIT:
1155 lexrc >> full_screen_limit;
1157 case RC_FULL_SCREEN_TOOLBARS:
1158 lexrc >> full_screen_toolbars;
1160 case RC_FULL_SCREEN_SCROLLBAR:
1161 lexrc >> full_screen_scrollbar;
1163 case RC_FULL_SCREEN_STATUSBAR:
1164 lexrc >> full_screen_statusbar;
1166 case RC_FULL_SCREEN_TABBAR:
1167 lexrc >> full_screen_tabbar;
1169 case RC_FULL_SCREEN_MENUBAR:
1170 lexrc >> full_screen_menubar;
1172 case RC_FULL_SCREEN_WIDTH:
1173 lexrc >> full_screen_width;
1175 case RC_OPEN_BUFFERS_IN_TABS:
1176 lexrc >> open_buffers_in_tabs;
1178 case RC_SINGLE_CLOSE_TAB_BUTTON:
1179 lexrc >> single_close_tab_button;
1181 case RC_SINGLE_INSTANCE:
1182 lexrc >> single_instance;
1183 if (run_mode == PREFERRED)
1184 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1186 case RC_FORWARD_SEARCH_DVI:
1187 if (lexrc.next(true))
1188 forward_search_dvi = lexrc.getString();
1190 case RC_FORWARD_SEARCH_PDF:
1191 if (lexrc.next(true))
1192 forward_search_pdf = lexrc.getString();
1194 case RC_EXPORT_OVERWRITE:
1196 string const tmp = lexrc.getString();
1197 if (tmp == "all" || tmp == "true")
1198 export_overwrite = ALL_FILES;
1199 else if (tmp == "main")
1200 export_overwrite = MAIN_FILE;
1202 export_overwrite = NO_FILES;
1203 if (tmp != "ask" && tmp != "false")
1204 LYXERR0("Unrecognized export_overwrite status \""
1209 case RC_SCROLL_WHEEL_ZOOM:
1211 string const tmp = lexrc.getString();
1213 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1214 else if (tmp == "shift")
1215 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1216 else if (tmp == "alt")
1217 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1219 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1220 if (tmp != "off" && tmp != "false")
1221 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1227 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1228 lexrc >> mouse_middlebutton_paste;
1232 break; // this is just a dummy
1235 // This is triggered the first time through the loop unless
1236 // we hit a format tag.
1237 if (check_format && rc_format != LYXRC_FILEFORMAT)
1238 return FormatMismatch;
1241 /// Update converters data-structures
1242 theConverters().update(theFormats());
1243 theConverters().buildGraph();
1244 theBufferList().invalidateConverterCache();
1250 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1252 ofstream ofs(filename.toFilesystemEncoding().c_str());
1254 write(ofs, ignore_system_lyxrc);
1258 void LyXRC::print() const
1260 if (lyxerr.debugging())
1261 write(lyxerr, false);
1269 typedef pair<string, SpecialisedMover> Data;
1271 SameMover(Data const & comparison)
1272 : comparison_(comparison) {}
1274 bool operator()(Data const & data) const
1276 return data.first == comparison_.first &&
1277 data.second.command() == comparison_.second.command();
1287 // Escape \ and " so that LyXLex can read the string later
1288 string escapeCommand(string const & str) {
1289 return subst(subst(str , "\\", "\\\\"),
1296 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1298 LyXRCTags tag = RC_LAST;
1300 if (!name.empty()) {
1301 for (int i = 0; i != lyxrcCount; ++i)
1302 if ("\\" + name == lyxrcTags[i].tag)
1303 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1307 os << "# LyX " << lyx_version
1308 << " generated this file. If you want to make your own\n"
1309 << "# modifications you should do them from inside LyX and save.\n\n"
1310 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1312 // Why the switch you might ask. It is a trick to ensure that all
1313 // the elements in the LyXRCTags enum are handled. As you can see
1314 // there are no breaks at all. So it is just a huge fall-through.
1315 // The nice thing is that we will get a warning from the compiler
1316 // if we forget an element.
1320 // input/include files are not done here
1321 case RC_LYXRCFORMAT:
1323 if (ignore_system_lyxrc ||
1324 bind_file != system_lyxrc.bind_file) {
1325 string const path = os::external_path(bind_file);
1326 os << "\\bind_file \"" << path << "\"\n";
1332 if (ignore_system_lyxrc ||
1333 def_file != system_lyxrc.def_file) {
1334 string const path = os::external_path(def_file);
1335 os << "\\def_file \"" << path << "\"\n";
1344 << "# MISC SECTION ######################################\n"
1346 // bind files are not done here.
1348 case RC_PATH_PREFIX:
1349 if (ignore_system_lyxrc ||
1350 path_prefix != system_lyxrc.path_prefix) {
1351 os << "\\path_prefix \"" << path_prefix << "\"\n";
1357 if (ignore_system_lyxrc ||
1358 ui_file != system_lyxrc.ui_file) {
1359 string const path = os::external_path(ui_file);
1360 os << "\\ui_file \"" << path << "\"\n";
1365 case RC_AUTOREGIONDELETE:
1366 if (ignore_system_lyxrc ||
1367 auto_region_delete != system_lyxrc.auto_region_delete) {
1368 os << "# Set to false to inhibit automatic replacement of\n"
1369 << "# the current selection.\n"
1370 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1376 case RC_AUTORESET_OPTIONS:
1377 if (ignore_system_lyxrc ||
1378 auto_reset_options != system_lyxrc.auto_reset_options) {
1379 os << "# Set to false to inhibit automatic reset of\n"
1380 << "# the class options to defaults on class change.\n"
1381 << "\\auto_reset_options "
1382 << convert<string>(auto_reset_options)
1389 if (ignore_system_lyxrc ||
1390 autosave != system_lyxrc.autosave) {
1391 os << "# The time interval between auto-saves in seconds.\n"
1392 << "\\autosave " << autosave << '\n';
1397 case RC_DISPLAY_GRAPHICS:
1398 if (ignore_system_lyxrc ||
1399 display_graphics != system_lyxrc.display_graphics) {
1400 os << "# Display graphics within LyX\n"
1402 << "\\display_graphics "
1403 << (display_graphics ? "true" : "false")
1409 case RC_SORT_LAYOUTS:
1410 if (ignore_system_lyxrc ||
1411 sort_layouts != system_lyxrc.sort_layouts) {
1412 os << "# Sort layouts alphabetically.\n"
1413 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1418 case RC_GROUP_LAYOUTS:
1419 if (ignore_system_lyxrc ||
1420 group_layouts != system_lyxrc.group_layouts) {
1421 os << "# Group layouts by their category.\n"
1422 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1427 case RC_VIEWDVI_PAPEROPTION:
1428 if (ignore_system_lyxrc ||
1429 view_dvi_paper_option
1430 != system_lyxrc.view_dvi_paper_option) {
1431 os << "# Options used to specify paper size to the\n"
1432 << "# view_dvi_command (e.g. -paper)\n"
1433 << "\\view_dvi_paper_option \""
1434 << view_dvi_paper_option << "\"\n";
1439 case RC_CHKTEX_COMMAND:
1440 if (ignore_system_lyxrc ||
1441 chktex_command != system_lyxrc.chktex_command) {
1442 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1447 case RC_BIBTEX_ALTERNATIVES: {
1448 CommandSet::const_iterator it = bibtex_alternatives.begin();
1449 CommandSet::const_iterator end = bibtex_alternatives.end();
1450 for ( ; it != end; ++it) {
1451 if (ignore_system_lyxrc
1452 || !system_lyxrc.bibtex_alternatives.count(*it))
1453 os << "\\bibtex_alternatives \""
1460 case RC_BIBTEX_COMMAND:
1461 if (ignore_system_lyxrc ||
1462 bibtex_command != system_lyxrc.bibtex_command) {
1463 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1468 case RC_JBIBTEX_COMMAND:
1469 if (ignore_system_lyxrc ||
1470 jbibtex_command != system_lyxrc.jbibtex_command) {
1471 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1476 case RC_JBIBTEX_ALTERNATIVES: {
1477 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1478 CommandSet::const_iterator end = jbibtex_alternatives.end();
1479 for ( ; it != end; ++it) {
1480 if (ignore_system_lyxrc
1481 || !system_lyxrc.jbibtex_alternatives.count(*it))
1482 os << "\\jbibtex_alternatives \""
1489 case RC_INDEX_ALTERNATIVES: {
1490 CommandSet::const_iterator it = index_alternatives.begin();
1491 CommandSet::const_iterator end = index_alternatives.end();
1492 for ( ; it != end; ++it) {
1493 if (ignore_system_lyxrc
1494 || !system_lyxrc.index_alternatives.count(*it))
1495 os << "\\index_alternatives \""
1502 case RC_INDEX_COMMAND:
1503 if (ignore_system_lyxrc ||
1504 index_command != system_lyxrc.index_command) {
1505 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1510 case RC_JINDEX_COMMAND:
1511 if (ignore_system_lyxrc ||
1512 jindex_command != system_lyxrc.jindex_command) {
1513 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1518 case RC_SPLITINDEX_COMMAND:
1519 if (ignore_system_lyxrc ||
1520 splitindex_command != system_lyxrc.splitindex_command) {
1521 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1526 case RC_NOMENCL_COMMAND:
1527 if (ignore_system_lyxrc ||
1528 nomencl_command != system_lyxrc.nomencl_command) {
1529 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1534 case RC_PYGMENTIZE_COMMAND:
1535 if (ignore_system_lyxrc ||
1536 pygmentize_command != system_lyxrc.pygmentize_command) {
1537 os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1542 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1543 // Don't write this setting to the preferences file,
1544 // but allow temporary changes (bug 7557).
1545 if (ignore_system_lyxrc) {
1546 os << "\\tex_expects_windows_paths "
1547 << convert<string>(windows_style_tex_paths) << '\n';
1552 case RC_TEX_ALLOWS_SPACES:
1553 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1554 os << "\\tex_allows_spaces "
1555 << convert<string>(tex_allows_spaces) << '\n';
1561 if (ignore_system_lyxrc ||
1562 use_kbmap != system_lyxrc.use_kbmap) {
1563 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1568 case RC_KBMAP_PRIMARY:
1569 if (ignore_system_lyxrc ||
1570 primary_kbmap != system_lyxrc.primary_kbmap) {
1571 string const path = os::external_path(primary_kbmap);
1572 os << "\\kbmap_primary \"" << path << "\"\n";
1577 case RC_KBMAP_SECONDARY:
1578 if (ignore_system_lyxrc ||
1579 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1580 string const path = os::external_path(secondary_kbmap);
1581 os << "\\kbmap_secondary \"" << path << "\"\n";
1587 if (ignore_system_lyxrc ||
1588 lyxpipes != system_lyxrc.lyxpipes) {
1589 string const path = os::external_path(lyxpipes);
1590 os << "\\serverpipe \"" << path << "\"\n";
1595 case RC_DATE_INSERT_FORMAT:
1596 if (ignore_system_lyxrc ||
1597 date_insert_format != system_lyxrc.date_insert_format) {
1598 os << "\\date_insert_format \"" << date_insert_format
1605 os << "\\user_name \"" << user_name << "\"\n";
1610 os << "\\user_email \"" << user_email << "\"\n";
1614 case RC_SHOW_BANNER:
1615 if (ignore_system_lyxrc ||
1616 show_banner != system_lyxrc.show_banner) {
1617 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1623 if (ignore_system_lyxrc ||
1624 preview != system_lyxrc.preview) {
1630 case PREVIEW_NO_MATH:
1637 os << "\\preview " << status << '\n';
1642 case RC_PREVIEW_HASHED_LABELS:
1643 if (ignore_system_lyxrc ||
1644 preview_hashed_labels !=
1645 system_lyxrc.preview_hashed_labels) {
1646 os << "\\preview_hashed_labels "
1647 << convert<string>(preview_hashed_labels) << '\n';
1652 case RC_PREVIEW_SCALE_FACTOR:
1653 if (ignore_system_lyxrc ||
1654 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1655 os << "\\preview_scale_factor "
1656 << preview_scale_factor << '\n';
1661 case RC_USE_CONVERTER_CACHE:
1662 if (ignore_system_lyxrc ||
1663 use_converter_cache != system_lyxrc.use_converter_cache) {
1664 os << "\\use_converter_cache "
1665 << convert<string>(use_converter_cache) << '\n';
1670 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1671 if (ignore_system_lyxrc ||
1672 use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1673 os << "\\use_converter_needauth_forbidden "
1674 << convert<string>(use_converter_needauth_forbidden) << '\n';
1679 case RC_USE_CONVERTER_NEEDAUTH:
1680 if (ignore_system_lyxrc ||
1681 use_converter_needauth != system_lyxrc.use_converter_needauth) {
1682 os << "\\use_converter_needauth "
1683 << convert<string>(use_converter_needauth) << '\n';
1688 case RC_CONVERTER_CACHE_MAXAGE:
1689 if (ignore_system_lyxrc ||
1690 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1691 os << "\\converter_cache_maxage "
1692 << converter_cache_maxage << '\n';
1698 << "# SCREEN & FONTS SECTION ############################\n"
1702 if (ignore_system_lyxrc ||
1703 icon_set != system_lyxrc.icon_set) {
1704 os << "\\icon_set \"" << icon_set
1710 case RC_USE_SYSTEM_THEME_ICONS:
1711 if (ignore_system_lyxrc ||
1712 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1713 os << "\\use_system_theme_icons "
1714 << convert<string>(use_system_theme_icons)
1721 if (ignore_system_lyxrc ||
1722 dpi != system_lyxrc.dpi) {
1723 os << "\\screen_dpi " << dpi << '\n';
1728 case RC_SCREEN_ZOOM:
1729 if (ignore_system_lyxrc ||
1730 defaultZoom != system_lyxrc.defaultZoom) {
1731 os << "\\screen_zoom " << defaultZoom << '\n';
1736 case RC_GEOMETRY_SESSION:
1737 if (ignore_system_lyxrc ||
1738 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1739 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1745 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1746 if (ignore_system_lyxrc ||
1747 cursor_follows_scrollbar
1748 != system_lyxrc.cursor_follows_scrollbar) {
1749 os << "\\cursor_follows_scrollbar "
1750 << convert<string>(cursor_follows_scrollbar) << '\n';
1755 case RC_CURSOR_WIDTH:
1756 if (ignore_system_lyxrc ||
1758 != system_lyxrc.cursor_width) {
1759 os << "\\cursor_width "
1760 << cursor_width << '\n';
1765 case RC_SCROLL_BELOW_DOCUMENT:
1766 if (ignore_system_lyxrc ||
1767 scroll_below_document
1768 != system_lyxrc.scroll_below_document) {
1769 os << "\\scroll_below_document "
1770 << convert<string>(scroll_below_document) << '\n';
1775 case RC_PARAGRAPH_MARKERS:
1776 if (ignore_system_lyxrc ||
1778 != system_lyxrc.paragraph_markers) {
1779 os << "\\paragraph_markers "
1780 << convert<string>(paragraph_markers) << '\n';
1785 case RC_MAC_DONTSWAP_CTRL_META:
1786 if (ignore_system_lyxrc ||
1787 mac_dontswap_ctrl_meta
1788 != system_lyxrc.mac_dontswap_ctrl_meta) {
1789 os << "\\mac_dontswap_ctrl_meta "
1790 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1795 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1796 if (ignore_system_lyxrc ||
1797 mac_like_cursor_movement
1798 != system_lyxrc.mac_like_cursor_movement) {
1799 os << "\\mac_like_cursor_movement "
1800 << convert<string>(mac_like_cursor_movement) << '\n';
1805 case RC_MACRO_EDIT_STYLE:
1806 if (ignore_system_lyxrc ||
1808 != system_lyxrc.macro_edit_style) {
1809 os << "\\macro_edit_style ";
1810 switch (macro_edit_style) {
1811 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1812 case MACRO_EDIT_INLINE: os << "1\n"; break;
1813 case MACRO_EDIT_LIST: os << "2\n"; break;
1819 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1820 if (ignore_system_lyxrc ||
1821 dialogs_iconify_with_main
1822 != system_lyxrc.dialogs_iconify_with_main) {
1823 os << "\\dialogs_iconify_with_main "
1824 << convert<string>(dialogs_iconify_with_main) << '\n';
1829 case RC_SCREEN_FONT_ROMAN:
1830 if (ignore_system_lyxrc ||
1831 roman_font_name != system_lyxrc.roman_font_name) {
1832 os << "\\screen_font_roman \"" << roman_font_name
1838 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1839 if (ignore_system_lyxrc ||
1840 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1841 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1847 case RC_SCREEN_FONT_SANS:
1848 if (ignore_system_lyxrc ||
1849 sans_font_name != system_lyxrc.sans_font_name) {
1850 os << "\\screen_font_sans \"" << sans_font_name
1856 case RC_SCREEN_FONT_SANS_FOUNDRY:
1857 if (ignore_system_lyxrc ||
1858 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1859 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1865 case RC_SCREEN_FONT_TYPEWRITER:
1866 if (ignore_system_lyxrc ||
1867 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1868 os << "\\screen_font_typewriter \""
1869 << typewriter_font_name << "\"\n";
1874 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1875 if (ignore_system_lyxrc ||
1876 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1877 os << "\\screen_font_typewriter_foundry \""
1878 << typewriter_font_foundry << "\"\n";
1883 case RC_SCREEN_FONT_SCALABLE:
1884 if (ignore_system_lyxrc ||
1885 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1886 os << "\\screen_font_scalable "
1887 << convert<string>(use_scalable_fonts)
1893 case RC_SCREEN_FONT_SIZES:
1894 if (ignore_system_lyxrc ||
1895 font_sizes[FONT_SIZE_TINY]
1896 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1897 font_sizes[FONT_SIZE_SCRIPT]
1898 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1899 font_sizes[FONT_SIZE_FOOTNOTE]
1900 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1901 font_sizes[FONT_SIZE_SMALL]
1902 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1903 font_sizes[FONT_SIZE_NORMAL]
1904 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1905 font_sizes[FONT_SIZE_LARGE]
1906 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1907 font_sizes[FONT_SIZE_LARGER]
1908 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1909 font_sizes[FONT_SIZE_LARGEST]
1910 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1911 font_sizes[FONT_SIZE_HUGE]
1912 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1913 font_sizes[FONT_SIZE_HUGER]
1914 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1915 streamsize old_prec = os.precision();
1916 os.setf(ios::fixed);
1918 os << "\\screen_font_sizes"
1919 << ' ' << font_sizes[FONT_SIZE_TINY]
1920 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1921 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1922 << ' ' << font_sizes[FONT_SIZE_SMALL]
1923 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1924 << ' ' << font_sizes[FONT_SIZE_LARGE]
1925 << ' ' << font_sizes[FONT_SIZE_LARGER]
1926 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1927 << ' ' << font_sizes[FONT_SIZE_HUGE]
1928 << ' ' << font_sizes[FONT_SIZE_HUGER]
1930 os.precision(old_prec);
1931 os.unsetf(ios::fixed);
1936 case RC_FULL_SCREEN_LIMIT:
1937 if (ignore_system_lyxrc ||
1938 full_screen_limit != system_lyxrc.full_screen_limit) {
1939 os << "\\fullscreen_limit "
1940 << convert<string>(full_screen_limit)
1946 case RC_FULL_SCREEN_TOOLBARS:
1947 if (ignore_system_lyxrc ||
1948 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1949 os << "\\fullscreen_toolbars "
1950 << convert<string>(full_screen_toolbars)
1956 case RC_FULL_SCREEN_SCROLLBAR:
1957 if (ignore_system_lyxrc ||
1958 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1959 os << "\\fullscreen_scrollbar "
1960 << convert<string>(full_screen_scrollbar)
1966 case RC_FULL_SCREEN_STATUSBAR:
1967 if (ignore_system_lyxrc ||
1968 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1969 os << "\\fullscreen_statusbar "
1970 << convert<string>(full_screen_statusbar)
1976 case RC_FULL_SCREEN_TABBAR:
1977 if (ignore_system_lyxrc ||
1978 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1979 os << "\\fullscreen_tabbar "
1980 << convert<string>(full_screen_tabbar)
1986 case RC_FULL_SCREEN_MENUBAR:
1987 if (ignore_system_lyxrc ||
1988 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1989 os << "\\fullscreen_menubar "
1990 << convert<string>(full_screen_menubar)
1996 case RC_FULL_SCREEN_WIDTH:
1997 if (ignore_system_lyxrc ||
1998 full_screen_width != system_lyxrc.full_screen_width) {
1999 os << "\\fullscreen_width "
2000 << convert<string>(full_screen_width)
2006 case RC_OPEN_BUFFERS_IN_TABS:
2007 if (ignore_system_lyxrc ||
2008 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
2009 os << "\\open_buffers_in_tabs "
2010 << convert<string>(open_buffers_in_tabs)
2016 case RC_SINGLE_CLOSE_TAB_BUTTON:
2017 if (ignore_system_lyxrc ||
2018 single_close_tab_button != system_lyxrc.single_close_tab_button) {
2019 os << "\\single_close_tab_button "
2020 << convert<string>(single_close_tab_button)
2026 case RC_SINGLE_INSTANCE:
2027 if (ignore_system_lyxrc ||
2028 single_instance != system_lyxrc.single_instance) {
2029 os << "\\single_instance "
2030 << convert<string>(single_instance)
2036 case RC_FORWARD_SEARCH_DVI:
2037 if (ignore_system_lyxrc ||
2038 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2039 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2044 case RC_FORWARD_SEARCH_PDF:
2045 if (ignore_system_lyxrc ||
2046 forward_search_pdf != system_lyxrc.forward_search_pdf) {
2047 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2053 << "# COLOR SECTION ###################################\n"
2058 for (int i = 0; i < Color_ignore; ++i) {
2059 ColorCode lc = static_cast<ColorCode>(i);
2060 string const col = lcolor.getX11Name(lc);
2061 if (ignore_system_lyxrc
2062 || col != system_lcolor.getX11Name(lc)) {
2063 os << "\\set_color \""
2064 << lcolor.getLyXName(lc) << "\" \""
2072 << "# PRINTER SECTION ###################################\n"
2076 case RC_PRINTLANDSCAPEFLAG:
2077 if (ignore_system_lyxrc ||
2078 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2079 os << "\\print_landscape_flag \"" << print_landscape_flag
2085 case RC_PRINTPAPERFLAG:
2086 if (ignore_system_lyxrc ||
2087 print_paper_flag != system_lyxrc.print_paper_flag) {
2088 os << "\\print_paper_flag \"" << print_paper_flag
2094 case RC_PRINTPAPERDIMENSIONFLAG:
2095 if (ignore_system_lyxrc ||
2096 print_paper_dimension_flag
2097 != system_lyxrc.print_paper_dimension_flag) {
2098 os << "\\print_paper_dimension_flag \""
2099 << print_paper_dimension_flag << "\"\n";
2105 << "# TEX SECTION #######################################\n"
2109 case RC_TEXINPUTS_PREFIX:
2110 if (ignore_system_lyxrc ||
2111 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2112 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2118 << "# FILE SECTION ######################################\n"
2121 case RC_DOCUMENTPATH:
2122 if (ignore_system_lyxrc ||
2123 document_path != system_lyxrc.document_path) {
2124 string const path = os::external_path(document_path);
2125 os << "\\document_path \"" << path << "\"\n";
2130 case RC_USELASTFILEPOS:
2131 if (ignore_system_lyxrc ||
2132 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2133 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2139 case RC_LOADSESSION:
2140 if (ignore_system_lyxrc ||
2141 load_session != system_lyxrc.load_session) {
2142 os << "\\load_session " << convert<string>(load_session)
2148 case RC_MOUSE_WHEEL_SPEED:
2149 if (ignore_system_lyxrc ||
2150 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2151 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2156 case RC_MOUSE_MIDDLEBUTTON_PASTE:
2157 if (ignore_system_lyxrc ||
2158 mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2159 os << "\\mouse_middlebutton_paste "
2160 << convert<string>(mouse_middlebutton_paste) << '\n';
2165 case RC_COMPLETION_INLINE_DELAY:
2166 if (ignore_system_lyxrc ||
2167 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2168 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2173 case RC_COMPLETION_INLINE_MATH:
2174 if (ignore_system_lyxrc ||
2175 completion_inline_math != system_lyxrc.completion_inline_math) {
2176 os << "\\completion_inline_math "
2177 << convert<string>(completion_inline_math) << '\n';
2182 case RC_COMPLETION_INLINE_TEXT:
2183 if (ignore_system_lyxrc ||
2184 completion_inline_text != system_lyxrc.completion_inline_text) {
2185 os << "\\completion_inline_text "
2186 << convert<string>(completion_inline_text) << '\n';
2191 case RC_COMPLETION_INLINE_DOTS:
2192 if (ignore_system_lyxrc ||
2193 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2194 os << "\\completion_inline_dots "
2195 << convert<string>(completion_inline_dots) << '\n';
2200 case RC_AUTOCORRECTION_MATH:
2201 if (ignore_system_lyxrc ||
2202 autocorrection_math != system_lyxrc.autocorrection_math) {
2203 os << "\\autocorrection_math "
2204 << convert<string>(autocorrection_math) << '\n';
2209 case RC_COMPLETION_POPUP_DELAY:
2210 if (ignore_system_lyxrc ||
2211 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2212 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2217 case RC_COMPLETION_POPUP_MATH:
2218 if (ignore_system_lyxrc ||
2219 completion_popup_math != system_lyxrc.completion_popup_math) {
2220 os << "\\completion_popup_math "
2221 << convert<string>(completion_popup_math) << '\n';
2226 case RC_COMPLETION_POPUP_TEXT:
2227 if (ignore_system_lyxrc ||
2228 completion_popup_text != system_lyxrc.completion_popup_text) {
2229 os << "\\completion_popup_text "
2230 << convert<string>(completion_popup_text) << '\n';
2235 case RC_COMPLETION_CURSOR_TEXT:
2236 if (ignore_system_lyxrc ||
2237 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2238 os << "\\completion_cursor_text "
2239 << convert<string>(completion_cursor_text) << '\n';
2244 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2245 if (ignore_system_lyxrc ||
2246 completion_popup_after_complete
2247 != system_lyxrc.completion_popup_after_complete) {
2248 os << "\\completion_popup_after_complete "
2249 << convert<string>(completion_popup_after_complete) << '\n';
2254 case RC_COMPLETION_MINLENGTH:
2255 if (ignore_system_lyxrc ||
2256 completion_minlength != system_lyxrc.completion_minlength) {
2257 os << "\\completion_minlength " << convert<string>(completion_minlength)
2263 case RC_NUMLASTFILES:
2264 if (ignore_system_lyxrc ||
2265 num_lastfiles != system_lyxrc.num_lastfiles) {
2266 os << "\\num_lastfiles " << num_lastfiles << '\n';
2271 case RC_CHECKLASTFILES:
2272 if (ignore_system_lyxrc ||
2273 check_lastfiles != system_lyxrc.check_lastfiles) {
2274 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2280 case RC_EXAMPLEPATH:
2281 if (ignore_system_lyxrc ||
2282 example_path != system_lyxrc.example_path) {
2283 string const path = os::external_path(example_path);
2284 os << "\\example_path \"" << path << "\"\n";
2289 case RC_TEMPLATEPATH:
2290 if (ignore_system_lyxrc ||
2291 template_path != system_lyxrc.template_path) {
2292 string const path = os::external_path(template_path);
2293 os << "\\template_path \"" << path << "\"\n";
2298 case RC_TEMPDIRPATH:
2299 if (ignore_system_lyxrc ||
2300 tempdir_path != system_lyxrc.tempdir_path) {
2301 string const path = os::external_path(tempdir_path);
2302 os << "\\tempdir_path \"" << path << "\"\n";
2307 case RC_THESAURUSDIRPATH:
2308 if (ignore_system_lyxrc ||
2309 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2310 string const path = os::external_path(thesaurusdir_path);
2311 os << "\\thesaurusdir_path \"" << path << "\"\n";
2316 case RC_HUNSPELLDIR_PATH:
2317 if (ignore_system_lyxrc ||
2318 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2319 string const path = os::external_path(hunspelldir_path);
2320 os << "\\hunspelldir_path \"" << path << "\"\n";
2325 case RC_PLAINTEXT_LINELEN:
2326 if (ignore_system_lyxrc ||
2327 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2328 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2333 case RC_MAKE_BACKUP:
2334 if (ignore_system_lyxrc ||
2335 make_backup != system_lyxrc.make_backup) {
2336 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2341 case RC_SAVE_COMPRESSED:
2342 if (ignore_system_lyxrc ||
2343 save_compressed != system_lyxrc.save_compressed) {
2344 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2349 case RC_SAVE_ORIGIN:
2350 if (ignore_system_lyxrc ||
2351 save_origin != system_lyxrc.save_origin) {
2352 os << "\\save_origin " << convert<string>(save_origin) << '\n';
2357 case RC_BACKUPDIR_PATH:
2358 if (ignore_system_lyxrc ||
2359 backupdir_path != system_lyxrc.backupdir_path) {
2360 string const path = os::external_path(backupdir_path);
2361 os << "\\backupdir_path \"" << path << "\"\n";
2367 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2371 << "# SPELLCHECKER SECTION ##############################\n"
2375 case RC_ACCEPT_COMPOUND:
2376 if (ignore_system_lyxrc ||
2377 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2378 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2385 if (ignore_system_lyxrc ||
2386 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2387 os << "\\alternate_language \"" << spellchecker_alt_lang
2394 if (ignore_system_lyxrc ||
2395 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2396 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2401 case RC_USE_NATIVE_FILEDIALOG:
2402 if (ignore_system_lyxrc ||
2403 use_native_filedialog != system_lyxrc.use_native_filedialog) {
2404 os << "\\use_native_filedialog "
2405 << convert<string>(use_native_filedialog)
2411 case RC_USE_SYSTEM_COLORS:
2412 if (ignore_system_lyxrc ||
2413 use_system_colors != system_lyxrc.use_system_colors) {
2414 os << "\\use_system_colors "
2415 << convert<string>(use_system_colors)
2421 case RC_USE_TOOLTIP:
2422 if (ignore_system_lyxrc ||
2423 use_tooltip != system_lyxrc.use_tooltip) {
2424 os << "\\use_tooltip "
2425 << convert<string>(use_tooltip)
2431 case RC_USE_PIXMAP_CACHE:
2432 if (ignore_system_lyxrc ||
2433 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2434 os << "\\use_pixmap_cache "
2435 << convert<string>(use_pixmap_cache)
2443 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2447 case RC_DEFAULT_DECIMAL_POINT:
2448 if (ignore_system_lyxrc ||
2449 default_decimal_point != system_lyxrc.default_decimal_point) {
2450 os << "\\default_decimal_point " << default_decimal_point << '\n';
2455 case RC_DEFAULT_LENGTH_UNIT:
2456 if (ignore_system_lyxrc ||
2457 default_length_unit != system_lyxrc.default_length_unit) {
2458 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2463 case RC_SPELLCHECKER:
2464 if (ignore_system_lyxrc ||
2465 spellchecker != system_lyxrc.spellchecker) {
2466 os << "\\spellchecker " << spellchecker << '\n';
2471 case RC_SPELLCHECK_CONTINUOUSLY:
2472 if (ignore_system_lyxrc ||
2473 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2474 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2480 case RC_SPELLCHECK_NOTES:
2481 if (ignore_system_lyxrc ||
2482 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2483 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2489 case RC_VISUAL_CURSOR:
2490 if (ignore_system_lyxrc ||
2491 visual_cursor != system_lyxrc.visual_cursor) {
2492 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2497 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2498 if (ignore_system_lyxrc ||
2499 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2500 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2501 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2506 case RC_LANGUAGE_CUSTOM_PACKAGE:
2507 if (ignore_system_lyxrc ||
2508 language_custom_package != system_lyxrc.language_custom_package) {
2509 os << "\\language_custom_package \"" << language_custom_package
2515 case RC_LANGUAGE_GLOBAL_OPTIONS:
2516 if (ignore_system_lyxrc ||
2517 language_global_options
2518 != system_lyxrc.language_global_options) {
2519 os << "\\language_global_options \""
2520 << convert<string>(language_global_options)
2526 case RC_LANGUAGE_PACKAGE_SELECTION:
2527 if (ignore_system_lyxrc ||
2528 language_package_selection != system_lyxrc.language_package_selection) {
2529 os << "\\language_package_selection ";
2530 switch (language_package_selection) {
2548 case RC_LANGUAGE_COMMAND_BEGIN:
2549 if (ignore_system_lyxrc ||
2550 language_command_begin
2551 != system_lyxrc.language_command_begin) {
2552 os << "\\language_command_begin \""
2553 << language_command_begin
2559 case RC_LANGUAGE_COMMAND_END:
2560 if (ignore_system_lyxrc ||
2561 language_command_end
2562 != system_lyxrc.language_command_end) {
2563 os << "\\language_command_end \"" << language_command_end
2569 case RC_LANGUAGE_COMMAND_LOCAL:
2570 if (ignore_system_lyxrc ||
2571 language_command_local
2572 != system_lyxrc.language_command_local) {
2573 os << "\\language_command_local \""
2574 << language_command_local
2580 case RC_LANGUAGE_AUTO_BEGIN:
2581 if (ignore_system_lyxrc ||
2582 language_auto_begin != system_lyxrc.language_auto_begin) {
2583 os << "\\language_auto_begin "
2584 << convert<string>(language_auto_begin) << '\n';
2589 case RC_LANGUAGE_AUTO_END:
2590 if (ignore_system_lyxrc ||
2591 language_auto_end != system_lyxrc.language_auto_end) {
2592 os << "\\language_auto_end "
2593 << convert<string>(language_auto_end) << '\n';
2598 case RC_MARK_FOREIGN_LANGUAGE:
2599 if (ignore_system_lyxrc ||
2600 mark_foreign_language
2601 != system_lyxrc.mark_foreign_language) {
2602 os << "\\mark_foreign_language " <<
2603 convert<string>(mark_foreign_language) << '\n';
2609 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2613 case RC_AUTO_NUMBER:
2614 if (ignore_system_lyxrc ||
2615 auto_number != system_lyxrc.auto_number) {
2616 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2621 case RC_GUI_LANGUAGE:
2622 if (ignore_system_lyxrc ||
2623 gui_language != system_lyxrc.gui_language) {
2624 os << "\\gui_language " << gui_language << '\n';
2629 case RC_EXPORT_OVERWRITE:
2630 if (ignore_system_lyxrc ||
2631 export_overwrite != system_lyxrc.export_overwrite) {
2633 switch (export_overwrite) {
2644 os << "\\export_overwrite " << status << '\n';
2649 case RC_SCROLL_WHEEL_ZOOM:
2650 if (ignore_system_lyxrc ||
2651 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2653 switch (scroll_wheel_zoom) {
2654 case SCROLL_WHEEL_ZOOM_OFF:
2657 case SCROLL_WHEEL_ZOOM_CTRL:
2660 case SCROLL_WHEEL_ZOOM_SHIFT:
2663 case SCROLL_WHEEL_ZOOM_ALT:
2667 os << "\\scroll_wheel_zoom " << status << '\n';
2673 << "# FORMATS SECTION ##########################\n"
2678 // New/modified formats
2679 for (Formats::const_iterator cit = theFormats().begin();
2680 cit != theFormats().end(); ++cit) {
2681 Format const * format =
2682 theSystemFormats().getFormat(cit->name());
2684 format->extensions() != cit->extensions() ||
2685 format->prettyname() != cit->prettyname() ||
2686 format->shortcut() != cit->shortcut() ||
2687 format->viewer() != cit->viewer() ||
2688 format->editor() != cit->editor() ||
2689 format->documentFormat() != cit->documentFormat() ||
2690 format->vectorFormat() != cit->vectorFormat() ||
2691 format->inExportMenu() != cit->inExportMenu() ||
2692 format->mime() != cit->mime()) {
2693 os << "\\format \"" << cit->name() << "\" \""
2694 << cit->extensions() << "\" \""
2695 << to_utf8(cit->prettyname()) << "\" \""
2696 << cit->shortcut() << "\" \""
2697 << escapeCommand(cit->viewer()) << "\" \""
2698 << escapeCommand(cit->editor()) << "\" \"";
2699 vector<string> flags;
2700 if (cit->documentFormat())
2701 flags.push_back("document");
2702 if (cit->vectorFormat())
2703 flags.push_back("vector");
2704 if (cit->zippedNative())
2705 flags.push_back("zipped=native");
2706 if (cit->inExportMenu())
2707 flags.push_back("menu=export");
2709 os << getStringFromVector(flags);
2710 os << "\" \"" << cit->mime() << "\"\n";
2714 // Look for deleted formats
2715 for (Formats::const_iterator cit = theSystemFormats().begin();
2716 cit != theSystemFormats().end(); ++cit)
2717 if (!theFormats().getFormat(cit->name()))
2718 os << "\\format \"" << cit->name()
2719 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2723 case RC_VIEWER_ALTERNATIVES: {
2724 Alternatives::const_iterator it = viewer_alternatives.begin();
2725 Alternatives::const_iterator const en = viewer_alternatives.end();
2726 Alternatives::const_iterator const sysend =
2727 system_lyxrc.viewer_alternatives.end();
2728 for (; it != en; ++it) {
2729 string const & fmt = it->first;
2730 CommandSet const & cmd = it->second;
2731 CommandSet::const_iterator sit = cmd.begin();
2732 CommandSet::const_iterator const sen = cmd.end();
2733 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2734 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2735 system_lyxrc.viewer_alternatives.find(fmt);
2736 for (; sit != sen; ++sit) {
2737 string const & cmd = *sit;
2738 if (ignore_system_lyxrc
2739 || sysfmt == sysend // format not found
2740 || sysfmt->second.count(cmd) == 0 // this command not found
2742 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2749 case RC_EDITOR_ALTERNATIVES: {
2750 Alternatives::const_iterator it = editor_alternatives.begin();
2751 Alternatives::const_iterator const en = editor_alternatives.end();
2752 Alternatives::const_iterator const sysend =
2753 system_lyxrc.editor_alternatives.end();
2754 for (; it != en; ++it) {
2755 string const & fmt = it->first;
2756 CommandSet const & cmd = it->second;
2757 CommandSet::const_iterator sit = cmd.begin();
2758 CommandSet::const_iterator const sen = cmd.end();
2759 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2760 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2761 system_lyxrc.editor_alternatives.find(fmt);
2762 for (; sit != sen; ++sit) {
2763 string const & cmd = *sit;
2764 if (ignore_system_lyxrc
2765 || sysfmt == sysend // format not found
2766 || sysfmt->second.count(cmd) == 0 // this command not found
2768 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2775 case RC_DEFAULT_OTF_VIEW_FORMAT:
2776 if ((ignore_system_lyxrc ||
2777 default_otf_view_format != system_lyxrc.default_otf_view_format)
2778 && !default_otf_view_format.empty()) {
2779 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2784 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2785 if ((ignore_system_lyxrc ||
2786 default_platex_view_format != system_lyxrc.default_platex_view_format)
2787 && !default_platex_view_format.empty()) {
2788 os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2793 case RC_DEFAULT_VIEW_FORMAT:
2794 if (ignore_system_lyxrc ||
2795 default_view_format != system_lyxrc.default_view_format) {
2796 os << "\\default_view_format " << default_view_format << '\n';
2807 << "# CONVERTERS SECTION ##########################\n"
2812 // Look for new converters
2813 for (Converters::const_iterator cit = theConverters().begin();
2814 cit != theConverters().end(); ++cit) {
2815 Converter const * converter =
2816 theSystemConverters().getConverter(cit->from(),
2819 converter->command() != cit->command() ||
2820 converter->flags() != cit->flags())
2821 os << "\\converter \"" << cit->from() << "\" \""
2822 << cit->to() << "\" \""
2823 << escapeCommand(cit->command()) << "\" \""
2824 << cit->flags() << "\"\n";
2827 // New/modifed converters
2828 for (Converters::const_iterator cit = theSystemConverters().begin();
2829 cit != theSystemConverters().end(); ++cit)
2830 if (!theConverters().getConverter(cit->from(), cit->to()))
2831 os << "\\converter \"" << cit->from()
2832 << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2839 << "# COPIERS SECTION ##########################\n"
2842 // Look for new movers
2843 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2844 Movers::const_iterator const sysend = theSystemMovers().end();
2845 Movers::const_iterator it = theMovers().begin();
2846 Movers::const_iterator end = theMovers().end();
2848 for (; it != end; ++it) {
2849 Movers::const_iterator const sysit =
2850 find_if(sysbegin, sysend, SameMover(*it));
2851 if (sysit == sysend) {
2852 string const & fmt = it->first;
2853 string const & command =
2854 it->second.command();
2856 os << "\\copier " << fmt
2857 << " \"" << escapeCommand(command) << "\"\n";
2863 // We don't actually delete SpecialisedMover(s) from the
2864 // map, just clear their 'command', so there's no need
2865 // to test for anything else.
2872 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2874 // Why the switch you might ask. It is a trick to ensure that all
2875 // the elements in the LyXRCTags enum is handled. As you can see
2876 // there are no breaks at all. So it is just a huge fall-through.
2877 // The nice thing is that we will get a warning from the compiler
2878 // if we forget an element.
2879 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2881 case LyXRC::RC_LAST:
2882 case LyXRC::RC_ACCEPT_COMPOUND:
2883 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2884 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2886 case LyXRC::RC_ALT_LANG:
2887 case LyXRC::RC_PLAINTEXT_LINELEN:
2888 case LyXRC::RC_AUTOCORRECTION_MATH:
2889 case LyXRC::RC_AUTOREGIONDELETE:
2890 case LyXRC::RC_AUTORESET_OPTIONS:
2891 case LyXRC::RC_AUTOSAVE:
2892 case LyXRC::RC_AUTO_NUMBER:
2893 case LyXRC::RC_BACKUPDIR_PATH:
2894 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2895 case LyXRC::RC_BIBTEX_COMMAND:
2896 case LyXRC::RC_BINDFILE:
2897 case LyXRC::RC_CHECKLASTFILES:
2898 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2899 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2900 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2901 case LyXRC::RC_COMPLETION_INLINE_MATH:
2902 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2903 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2904 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2905 case LyXRC::RC_COMPLETION_POPUP_MATH:
2906 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2907 case LyXRC::RC_COMPLETION_MINLENGTH:
2908 case LyXRC::RC_USELASTFILEPOS:
2909 case LyXRC::RC_LOADSESSION:
2910 case LyXRC::RC_CHKTEX_COMMAND:
2911 case LyXRC::RC_CONVERTER:
2912 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2913 case LyXRC::RC_COPIER:
2914 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2915 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2916 case LyXRC::RC_DATE_INSERT_FORMAT:
2917 case LyXRC::RC_GUI_LANGUAGE:
2918 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2919 case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2920 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2921 case LyXRC::RC_DEFFILE:
2922 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2923 case LyXRC::RC_DISPLAY_GRAPHICS:
2924 case LyXRC::RC_DOCUMENTPATH:
2925 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2926 FileName path(lyxrc_new.document_path);
2927 if (path.exists() && path.isDirectory())
2928 package().document_dir() = FileName(lyxrc.document_path);
2931 case LyXRC::RC_EDITOR_ALTERNATIVES:
2932 case LyXRC::RC_ESC_CHARS:
2933 case LyXRC::RC_EXAMPLEPATH:
2934 case LyXRC::RC_FILEFORMAT:
2935 case LyXRC::RC_GROUP_LAYOUTS:
2936 case LyXRC::RC_HUNSPELLDIR_PATH:
2937 case LyXRC::RC_ICON_SET:
2938 case LyXRC::RC_INDEX_ALTERNATIVES:
2939 case LyXRC::RC_INDEX_COMMAND:
2940 case LyXRC::RC_JBIBTEX_COMMAND:
2941 case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2942 case LyXRC::RC_JINDEX_COMMAND:
2943 case LyXRC::RC_NOMENCL_COMMAND:
2944 case LyXRC::RC_PYGMENTIZE_COMMAND:
2945 case LyXRC::RC_INPUT:
2946 case LyXRC::RC_KBMAP:
2947 case LyXRC::RC_KBMAP_PRIMARY:
2948 case LyXRC::RC_KBMAP_SECONDARY:
2949 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2950 case LyXRC::RC_LANGUAGE_AUTO_END:
2951 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2952 case LyXRC::RC_LANGUAGE_COMMAND_END:
2953 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2954 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2955 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2956 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2957 case LyXRC::RC_LYXRCFORMAT:
2958 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2959 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2960 case LyXRC::RC_MACRO_EDIT_STYLE:
2961 case LyXRC::RC_MAKE_BACKUP:
2962 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2963 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2964 case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2965 case LyXRC::RC_NUMLASTFILES:
2966 case LyXRC::RC_PARAGRAPH_MARKERS:
2967 case LyXRC::RC_PATH_PREFIX:
2968 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2969 prependEnvPath("PATH", lyxrc_new.path_prefix);
2970 // Resets python path
2971 support::os::python(true);
2974 case LyXRC::RC_PREVIEW:
2975 case LyXRC::RC_PREVIEW_HASHED_LABELS:
2976 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2977 case LyXRC::RC_PRINTLANDSCAPEFLAG:
2978 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2979 case LyXRC::RC_PRINTPAPERFLAG:
2980 case LyXRC::RC_SAVE_COMPRESSED:
2981 case LyXRC::RC_SAVE_ORIGIN:
2982 case LyXRC::RC_SCREEN_DPI:
2983 case LyXRC::RC_SCREEN_FONT_ROMAN:
2984 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
2985 case LyXRC::RC_SCREEN_FONT_SANS:
2986 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
2987 case LyXRC::RC_SCREEN_FONT_SCALABLE:
2988 case LyXRC::RC_SCREEN_FONT_SIZES:
2989 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
2990 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2991 case LyXRC::RC_GEOMETRY_SESSION:
2992 case LyXRC::RC_SCREEN_ZOOM:
2993 case LyXRC::RC_SERVERPIPE:
2994 case LyXRC::RC_SET_COLOR:
2995 case LyXRC::RC_SHOW_BANNER:
2996 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
2997 case LyXRC::RC_SPELLCHECKER:
2998 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3001 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3002 case LyXRC::RC_SPELLCHECK_NOTES:
3003 case LyXRC::RC_SPLITINDEX_COMMAND:
3004 case LyXRC::RC_TEMPDIRPATH:
3005 case LyXRC::RC_TEMPLATEPATH:
3006 case LyXRC::RC_TEX_ALLOWS_SPACES:
3007 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3008 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3009 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3012 case LyXRC::RC_TEXINPUTS_PREFIX:
3013 case LyXRC::RC_THESAURUSDIRPATH:
3014 case LyXRC::RC_UIFILE:
3015 case LyXRC::RC_USER_EMAIL:
3016 case LyXRC::RC_USER_NAME:
3017 case LyXRC::RC_USE_CONVERTER_CACHE:
3018 case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3019 case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3020 case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3021 case LyXRC::RC_USE_SYSTEM_COLORS:
3022 case LyXRC::RC_USE_TOOLTIP:
3023 case LyXRC::RC_USE_PIXMAP_CACHE:
3024 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3025 case LyXRC::RC_VIEWDVI_PAPEROPTION:
3026 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3027 case LyXRC::RC_SINGLE_INSTANCE:
3028 case LyXRC::RC_SORT_LAYOUTS:
3029 case LyXRC::RC_FULL_SCREEN_LIMIT:
3030 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3031 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3032 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3033 case LyXRC::RC_FULL_SCREEN_TABBAR:
3034 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3035 case LyXRC::RC_FULL_SCREEN_WIDTH:
3036 case LyXRC::RC_VISUAL_CURSOR:
3037 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3038 case LyXRC::RC_VIEWER:
3039 case LyXRC::RC_VIEWER_ALTERNATIVES:
3040 case LyXRC::RC_FORWARD_SEARCH_DVI:
3041 case LyXRC::RC_FORWARD_SEARCH_PDF:
3042 case LyXRC::RC_EXPORT_OVERWRITE:
3043 case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3044 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3045 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3046 case LyXRC::RC_CURSOR_WIDTH:
3052 set<string> LyXRC::getRCs()
3055 for (int i = 0; i != lyxrcCount; ++i)
3056 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3062 string const LyXRC::getDescription(LyXRCTags tag)
3067 case RC_ACCEPT_COMPOUND:
3068 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3072 str = _("Specify an alternate language. The default is to use the language of the document.");
3075 case RC_PLAINTEXT_LINELEN:
3076 str = _("The maximum line length of exported plain text/LaTeX/SGML files. If set to 0, paragraphs are output in a single line; if the line length is > 0, paragraphs are separated by a blank line.");
3079 case RC_AUTOREGIONDELETE:
3080 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3083 case RC_AUTORESET_OPTIONS:
3084 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3088 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3091 case RC_AUTO_NUMBER:
3094 case RC_BACKUPDIR_PATH:
3095 str = _("The path for storing backup files. If it is an empty string, LyX will store the backup file in the same directory as the original file.");
3098 case RC_BIBTEX_COMMAND:
3099 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3102 case RC_JBIBTEX_COMMAND:
3103 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3107 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3110 case RC_CHECKLASTFILES:
3111 str = _("Select to check whether the lastfiles still exist.");
3114 case RC_CHKTEX_COMMAND:
3115 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3121 case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3122 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3125 case RC_CONVERTER_NEEDAUTH:
3126 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3132 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3133 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.");
3136 case RC_CURSOR_WIDTH:
3137 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3140 case RC_SCROLL_BELOW_DOCUMENT:
3141 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");
3144 case RC_MAC_DONTSWAP_CTRL_META:
3145 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3148 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3149 str = _("Use the Mac OS X conventions for cursor movement");
3152 case RC_SHOW_MACRO_LABEL:
3153 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3156 case RC_DATE_INSERT_FORMAT:
3157 //xgettext:no-c-format
3158 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
3162 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3165 case RC_DEFAULT_OTF_VIEW_FORMAT:
3166 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3169 case RC_DEFAULT_VIEW_FORMAT:
3170 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3173 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3174 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3177 case RC_DISPLAY_GRAPHICS:
3178 str = _("Select how LyX will display any graphics.");
3181 case RC_DOCUMENTPATH:
3182 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3186 str = _("Specify additional chars that can be part of a word.");
3189 case RC_EXAMPLEPATH:
3190 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3196 case RC_INDEX_COMMAND:
3197 str = _("Define the options of makeindex (cf. man makeindex) or select an alternative compiler. E.g., using xindy/make-rules, the command string would be \"makeindex.sh -m $$lang\".");
3200 case RC_JINDEX_COMMAND:
3201 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3204 case RC_NOMENCL_COMMAND:
3205 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3208 case RC_PYGMENTIZE_COMMAND:
3209 str = _("The command to run the python pygments syntax highlighter.");
3216 case RC_KBMAP_PRIMARY:
3217 case RC_KBMAP_SECONDARY:
3218 str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard.");
3221 case RC_LANGUAGE_AUTO_BEGIN:
3222 str = _("Select if a language switching command is needed at the beginning of the document.");
3225 case RC_LANGUAGE_AUTO_END:
3226 str = _("Select if a language switching command is needed at the end of the document.");
3229 case RC_LANGUAGE_COMMAND_BEGIN:
3230 str = _("The LaTeX command for changing from the language of the document to another language. E.g. \\selectlanguage{$$lang} where $$lang is substituted by the name of the second language.");
3233 case RC_LANGUAGE_COMMAND_END:
3234 str = _("The LaTeX command for changing back to the language of the document.");
3237 case RC_LANGUAGE_COMMAND_LOCAL:
3238 str = _("The LaTeX command for local changing of the language.");
3241 case RC_LANGUAGE_GLOBAL_OPTIONS:
3242 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3245 case RC_LANGUAGE_CUSTOM_PACKAGE:
3246 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3249 case RC_LANGUAGE_PACKAGE_SELECTION:
3250 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3253 case RC_USELASTFILEPOS:
3254 str = _("De-select if you do not want LyX to scroll to saved position.");
3257 case RC_LOADSESSION:
3258 str = _("De-select to prevent loading files opened from the last LyX session.");
3261 case RC_MAKE_BACKUP:
3262 str = _("De-select if you don't want LyX to create backup files.");
3265 case RC_MARK_FOREIGN_LANGUAGE:
3266 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3269 case RC_MOUSE_WHEEL_SPEED:
3270 str = _("The scrolling speed of the mouse wheel.");
3273 case RC_COMPLETION_POPUP_DELAY:
3274 str = _("The completion popup delay.");
3277 case RC_COMPLETION_POPUP_MATH:
3278 str = _("Select to display the completion popup in math mode.");
3281 case RC_COMPLETION_POPUP_TEXT:
3282 str = _("Select to display the completion popup in text mode.");
3285 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3286 str = _("Show the completion popup without delay after non-unique completion attempt.");
3289 case RC_COMPLETION_POPUP_TEXT:
3290 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3293 case RC_COMPLETION_POPUP_DELAY:
3294 str = _("The inline completion delay.");
3297 case RC_COMPLETION_INLINE_MATH:
3298 str = _("Select to display the inline completion in math mode.");
3301 case RC_COMPLETION_INLINE_TEXT:
3302 str = _("Select to display the inline completion in text mode.");
3305 case RC_COMPLETION_INLINE_DOTS:
3306 str = _("Use \"...\" to shorten long completions.");
3309 case RC_AUTOCORRECTION_MATH:
3310 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3313 case RC_NUMLASTFILES:
3314 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3318 case RC_PATH_PREFIX:
3319 str = _("Specify those directories which should be "
3320 "prepended to the PATH environment variable.\n"
3321 "Use the OS native format.");
3325 str = _("Shows a typeset preview of things such as math");
3328 case RC_PREVIEW_HASHED_LABELS:
3329 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3332 case RC_PREVIEW_SCALE_FACTOR:
3333 str = _("Scale the preview size to suit.");
3336 case RC_PRINTLANDSCAPEFLAG:
3337 str = _("The option to print out in landscape.");
3340 case RC_PRINTPAPERDIMENSIONFLAG:
3341 str = _("Option to specify the dimensions of the print paper.");
3344 case RC_PRINTPAPERFLAG:
3345 str = _("The option to specify paper type.");
3348 case RC_VISUAL_CURSOR:
3349 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3352 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3353 str = _("Specify whether, closing the last view of an open document, LyX should close the document (yes), hide it (no), or ask the user (ask).");
3357 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3360 case RC_SCREEN_FONT_ROMAN:
3361 case RC_SCREEN_FONT_SANS:
3362 case RC_SCREEN_FONT_TYPEWRITER:
3363 str = _("The screen fonts used to display the text while editing.");
3366 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3367 case RC_SCREEN_FONT_SANS_FOUNDRY:
3368 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3371 case RC_SCREEN_FONT_SCALABLE:
3372 str = _("Allow bitmap fonts to be resized. If you are using a bitmap font, selecting this option may make some fonts look blocky in LyX. Deselecting this option makes LyX use the nearest bitmap font size available, instead of scaling.");
3375 case RC_SCREEN_FONT_SIZES:
3376 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3379 case RC_SCREEN_ZOOM:
3380 //xgettext:no-c-format
3381 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3384 case RC_GEOMETRY_SESSION:
3385 str = _("Allow session manager to save and restore windows geometry.");
3389 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3395 case RC_SHOW_BANNER:
3396 str = _("De-select if you don't want the startup banner.");
3399 case RC_TEMPDIRPATH:
3400 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3403 case RC_THESAURUSDIRPATH:
3404 str = _("This is the place where the files of the thesaurus library reside.");
3407 case RC_TEMPLATEPATH:
3408 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3411 case RC_TEX_ALLOWS_SPACES:
3414 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3417 case RC_TEXINPUTS_PREFIX:
3418 str = _("Specify those directories which should be "
3419 "prepended to the TEXINPUTS environment variable.\n"
3420 "A '.' represents the current document directory. "
3421 "Use the OS native format.");
3425 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3434 case RC_USE_USE_SYSTEM_COLORS:
3435 str = _("Enable use the system colors for some things like main window background and selection.");
3438 case RC_USE_TOOLTIP:
3439 str = _("Enable the automatic appearance of tool tips in the work area.");
3442 case RC_USE_PIXMAP_CACHE:
3443 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3446 case RC_VIEWDVI_PAPEROPTION:
3447 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3462 // The global instance
3465 // The global copy of the system lyxrc entries (everything except preferences)