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.
22 #include "Converter.h"
23 #include "FontEnums.h"
29 #include "SpellChecker.h"
32 #include "graphics/GraphicsTypes.h"
34 #include "support/convert.h"
35 #include "support/debug.h"
36 #include "support/environment.h"
37 #include "support/FileName.h"
38 #include "support/filetools.h"
39 #include "support/gettext.h"
40 #include "support/lstrings.h"
41 #include "support/os.h"
42 #include "support/Package.h"
43 #include "support/TempFile.h"
44 #include "support/userinfo.h"
51 using namespace lyx::support;
55 namespace os = support::os;
59 // The format should also be updated in configure.py, and conversion code
60 // should be added to prefs2prefs_prefs.py.
61 static unsigned int const LYXRC_FILEFORMAT = 17; // lasgouttes: remove \\rtl
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_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
101 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
102 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
103 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
104 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
105 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
106 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
107 { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
108 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
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_command", LyXRC::RC_JBIBTEX_COMMAND },
127 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
128 { "\\kbmap", LyXRC::RC_KBMAP },
129 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
130 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
131 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
132 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
133 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
134 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
135 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
136 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
137 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
138 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
139 { "\\load_session", LyXRC::RC_LOADSESSION },
140 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
141 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
142 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
143 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
144 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
145 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
146 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
147 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
148 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
149 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
150 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
151 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
152 { "\\preview", LyXRC::RC_PREVIEW },
153 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
154 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
155 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
156 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
157 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
158 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
159 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
160 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
161 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
162 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
163 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
164 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
165 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
166 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
167 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
168 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
169 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
170 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
171 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
172 { "\\printer", LyXRC::RC_PRINTER },
173 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
174 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
175 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
176 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
177 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
178 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
179 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
180 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
181 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
182 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
183 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
184 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
185 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
186 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
187 { "\\set_color", LyXRC::RC_SET_COLOR },
188 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
189 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
190 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
191 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
192 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
193 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
194 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
195 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
196 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
197 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
198 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
199 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
200 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
201 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
202 { "\\ui_file", LyXRC::RC_UIFILE },
203 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
204 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
205 { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
206 { "\\use_qimage", LyXRC::RC_USE_QIMAGE },
207 // compatibility with versions older than 1.4.0 only
208 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
209 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
210 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
211 { "\\user_email", LyXRC::RC_USER_EMAIL },
212 { "\\user_name", LyXRC::RC_USER_NAME },
213 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
214 // compatibility with versions older than 1.4.0 only
215 { "\\viewer", LyXRC::RC_VIEWER},
216 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
217 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
218 { "format", LyXRC::RC_LYXRCFORMAT }
221 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
232 void LyXRC::setDefaults()
235 use_system_theme_icons = false;
237 def_file = "default";
239 // The current document directory
240 texinputs_prefix = ".";
241 // Get printer from the environment. If fail, use default "",
242 // assuming that everything is set up correctly.
243 printer = getEnv("PRINTER");
244 print_adapt_output = false;
245 print_command = "dvips";
246 print_evenpage_flag = "-B";
247 print_oddpage_flag = "-A";
248 print_pagerange_flag = "-pp";
249 print_copies_flag = "-c";
250 print_collcopies_flag = "-C";
251 print_reverse_flag = "-r";
252 print_landscape_flag = "-t landscape";
253 print_to_printer = "-P";
254 print_to_file = "-o ";
255 print_file_extension = ".ps";
256 print_paper_flag = "-t";
257 print_paper_dimension_flag = "-T";
258 document_path.erase();
259 view_dvi_paper_option.erase();
260 default_view_format = "pdf2";
261 default_otf_view_format = "pdf4";
262 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
263 bibtex_command = "bibtex";
265 index_command = "makeindex -c -q";
266 nomencl_command = "makeindex -s nomencl.ist";
268 // Because a screen is typically wider than a piece of paper:
270 allow_geometry_session = true;
271 // Default LaTeX font size:
272 font_sizes[FONT_SIZE_TINY] = "5.0";
273 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
274 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
275 font_sizes[FONT_SIZE_SMALL] = "9.0";
276 font_sizes[FONT_SIZE_NORMAL] = "10.0";
277 font_sizes[FONT_SIZE_LARGE] = "12.0";
278 font_sizes[FONT_SIZE_LARGER] = "14.4";
279 font_sizes[FONT_SIZE_LARGEST] = "17.26";
280 font_sizes[FONT_SIZE_HUGE] = "20.74";
281 font_sizes[FONT_SIZE_HUGER] = "24.88";
282 use_scalable_fonts = true;
283 roman_font_name = "";
285 typewriter_font_name = "";
287 auto_region_delete = true;
288 auto_reset_options = false;
289 plaintext_linelen = 65;
290 mouse_wheel_speed = 1.0;
291 num_lastfiles = maxlastfiles;
292 check_lastfiles = true;
293 use_lastfilepos = true;
294 load_session = false;
296 save_compressed = false;
297 backupdir_path.erase();
298 display_graphics = true;
299 // Spellchecker settings:
300 // FIXME: this check should test the target platform (darwin)
301 #if defined(USE_MACOSX_PACKAGING)
302 spellchecker = "native";
303 #elif defined(USE_ASPELL)
304 spellchecker = "aspell";
305 #elif defined(USE_HUNSPELL)
306 spellchecker = "hunspell";
308 spellchecker = "aspell";
310 spellchecker_accept_compound = false;
311 spellcheck_continuously = false;
312 completion_minlength = 6;
313 spellcheck_notes = true;
315 visual_cursor = false;
317 mark_foreign_language = true;
318 language_auto_begin = true;
319 language_auto_end = true;
320 language_global_options = true;
321 language_package_selection = LP_AUTO;
322 language_custom_package = "\\usepackage{babel}";
323 language_command_begin = "\\selectlanguage{$$lang}";
324 language_command_local = "\\foreignlanguage{$$lang}{";
325 sort_layouts = false;
326 group_layouts = true;
327 gui_language = "auto";
329 windows_style_tex_paths = false;
330 tex_allows_spaces = false;
331 date_insert_format = "%x";
332 cursor_follows_scrollbar = false;
333 scroll_below_document = false;
334 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
335 paragraph_markers = false;
336 mac_dontswap_ctrl_meta = false;
337 mac_like_cursor_movement = false;
338 macro_edit_style = MACRO_EDIT_INLINE_BOX;
339 dialogs_iconify_with_main = false;
340 preview = PREVIEW_OFF;
341 preview_hashed_labels = false;
342 preview_scale_factor = 1.0;
343 use_converter_cache = true;
344 use_system_colors = false;
346 use_pixmap_cache = false;
348 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
349 user_name = to_utf8(support::user_name());
350 user_email = to_utf8(support::user_email());
351 open_buffers_in_tabs = true;
352 single_close_tab_button = false;
353 single_instance = true;
354 forward_search_dvi = string();
355 forward_search_pdf = string();
356 export_overwrite = NO_FILES;
358 // Fullscreen settings
359 full_screen_limit = false;
360 full_screen_toolbars = true;
361 full_screen_tabbar = true;
362 full_screen_menubar = true;
363 full_screen_scrollbar = true;
364 full_screen_width = 700;
366 completion_cursor_text = true;
367 completion_popup_math = true;
368 completion_popup_text = false;
369 completion_popup_delay = 2.0;
370 completion_popup_after_complete = true;
371 autocorrection_math = false;
372 completion_inline_math = true;
373 completion_inline_text = false;
374 completion_inline_dots = -1;
375 completion_inline_delay = 0.2;
376 default_decimal_point = ".";
377 default_length_unit = Length::CM;
379 close_buffer_with_last_view = "yes";
385 void oldFontFormat(string & family, string & foundry)
387 if (family.empty() || family[0] != '-')
389 foundry = token(family, '-', 1);
390 family = token(family, '-', 2);
398 bool LyXRC::read(FileName const & filename, bool check_format)
400 Lexer lexrc(lyxrcTags);
401 lexrc.setFile(filename);
402 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
403 ReturnValues retval = read(lexrc, check_format);
404 if (!check_format || retval != FormatMismatch)
405 return retval == ReadOK;
407 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
408 TempFile tmp("convert_lyxrc");
409 FileName const tempfile = tmp.name();
410 bool const success = prefs2prefs(filename, tempfile, false);
412 LYXERR0 ("Unable to convert " << filename.absFileName() <<
413 " to format " << LYXRC_FILEFORMAT);
416 // Keep this in the else branch, such that lexrc2 goes out
417 // of scope and releases the lock on tempfile before we
418 // attempt to remove it. This matters on Windows.
419 Lexer lexrc2(lyxrcTags);
420 lexrc2.setFile(tempfile);
421 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
422 retval = read(lexrc2, check_format);
424 return retval == ReadOK;
428 // don't need to worry about conversion, because this is always
429 // from an internal source
430 bool LyXRC::read(istream & is)
432 Lexer lexrc(lyxrcTags);
434 LYXERR(Debug::LYXRC, "Reading istream...");
435 return read(lexrc, false) == ReadOK;
439 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
441 if (lyxerr.debugging(Debug::PARSER))
442 lexrc.printTable(lyxerr);
447 // format prior to 2.0 and introduction of format tag
448 unsigned int format = 0;
450 while (lexrc.isOK()) {
451 // By using two switches we take advantage of the compiler
452 // telling us if we have missed a LyXRCTags element in
453 // the second switch.
454 // Note that this also shows a problem with Lexer since it
455 // helps us avoid taking advantage of the strictness of the
458 int le = lexrc.lex();
460 case Lexer::LEX_UNDEF:
461 lexrc.printError("Unknown tag `$$Token'");
463 case Lexer::LEX_FEOF:
468 switch (static_cast<LyXRCTags>(le)) {
471 format = lexrc.getInteger();
473 case RC_INPUT: // Include file
476 libFileSearch(string(),
478 if (read(tmp, check_format)) {
480 "Error reading included file: " + tmp.absFileName());
486 bind_file = os::internal_path(lexrc.getString());
491 def_file = os::internal_path(lexrc.getString());
496 ui_file = os::internal_path(lexrc.getString());
499 case RC_AUTORESET_OPTIONS:
500 lexrc >> auto_reset_options;
503 case RC_DISPLAY_GRAPHICS:
505 display_graphics = lexrc.getString() == "true";
508 case RC_TEX_EXPECTS_WINDOWS_PATHS:
509 lexrc >> windows_style_tex_paths;
512 case RC_TEX_ALLOWS_SPACES:
513 lexrc >> tex_allows_spaces;
516 case RC_TEXINPUTS_PREFIX:
517 lexrc >> texinputs_prefix;
524 case RC_KBMAP_PRIMARY:
526 string const kmap(os::internal_path(lexrc.getString()));
527 if (!libFileSearch("kbd", kmap, "kmap").empty()
529 primary_kbmap = kmap;
531 lexrc.printError("LyX: Keymap `$$Token' not found");
536 case RC_KBMAP_SECONDARY:
538 string const kmap(os::internal_path(lexrc.getString()));
539 if (!libFileSearch("kbd", kmap, "kmap").empty()
541 secondary_kbmap = kmap;
543 lexrc.printError("LyX: Keymap `$$Token' not found");
548 case RC_FONT_ENCODING:
556 case RC_PRINT_COMMAND:
557 if (lexrc.next(true)) {
558 print_command = lexrc.getString();
562 case RC_PRINTEVENPAGEFLAG:
563 lexrc >> print_evenpage_flag;
566 case RC_PRINTODDPAGEFLAG:
567 lexrc >> print_oddpage_flag;
570 case RC_PRINTPAGERANGEFLAG:
571 lexrc >> print_pagerange_flag;
574 case RC_PRINTCOPIESFLAG:
575 lexrc >> print_copies_flag;
578 case RC_PRINTCOLLCOPIESFLAG:
579 lexrc >> print_collcopies_flag;
582 case RC_PRINTREVERSEFLAG:
583 lexrc >> print_reverse_flag;
586 case RC_PRINTLANDSCAPEFLAG:
587 lexrc >> print_landscape_flag;
590 case RC_PRINTTOPRINTER:
591 lexrc >> print_to_printer;
594 case RC_PRINT_ADAPTOUTPUT:
595 lexrc >> print_adapt_output;
600 print_to_file = os::internal_path(lexrc.getString());
604 case RC_PRINTFILEEXTENSION:
605 lexrc >> print_file_extension;
608 case RC_PRINTEXSTRAOPTIONS:
609 lexrc >> print_extra_options;
612 case RC_PRINTSPOOL_COMMAND:
613 if (lexrc.next(true)) {
614 print_spool_command = lexrc.getString();
618 case RC_PRINTSPOOL_PRINTERPREFIX:
619 lexrc >> print_spool_printerprefix;
622 case RC_PRINTPAPERDIMENSIONFLAG:
623 lexrc >> print_paper_dimension_flag;
626 case RC_PRINTPAPERFLAG:
627 lexrc >> print_paper_flag;
630 case RC_VIEWDVI_PAPEROPTION:
632 view_dvi_paper_option = lexrc.getString();
634 view_dvi_paper_option.erase();
637 case RC_CHKTEX_COMMAND:
638 if (lexrc.next(true)) {
639 chktex_command = lexrc.getString();
643 case RC_BIBTEX_ALTERNATIVES:
644 if (lexrc.next(true)) {
645 bibtex_alternatives.insert(lexrc.getString());
649 case RC_BIBTEX_COMMAND:
650 if (lexrc.next(true)) {
651 bibtex_command = lexrc.getString();
655 case RC_JBIBTEX_COMMAND:
656 if (lexrc.next(true)) {
657 jbibtex_command = lexrc.getString();
661 case RC_INDEX_ALTERNATIVES:
662 if (lexrc.next(true)) {
663 index_alternatives.insert(lexrc.getString());
667 case RC_INDEX_COMMAND:
668 if (lexrc.next(true)) {
669 index_command = lexrc.getString();
673 case RC_JINDEX_COMMAND:
674 if (lexrc.next(true)) {
675 jindex_command = lexrc.getString();
679 case RC_SPLITINDEX_COMMAND:
680 if (lexrc.next(true)) {
681 splitindex_command = lexrc.getString();
685 case RC_NOMENCL_COMMAND:
686 if (lexrc.next(true)) {
687 nomencl_command = lexrc.getString();
699 case RC_GEOMETRY_SESSION:
700 lexrc >> allow_geometry_session;
703 case RC_SCREEN_FONT_SIZES:
704 lexrc >> font_sizes[FONT_SIZE_TINY];
705 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
706 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
707 lexrc >> font_sizes[FONT_SIZE_SMALL];
708 lexrc >> font_sizes[FONT_SIZE_NORMAL];
709 lexrc >> font_sizes[FONT_SIZE_LARGE];
710 lexrc >> font_sizes[FONT_SIZE_LARGER];
711 lexrc >> font_sizes[FONT_SIZE_LARGEST];
712 lexrc >> font_sizes[FONT_SIZE_HUGE];
713 lexrc >> font_sizes[FONT_SIZE_HUGER];
716 case RC_SCREEN_FONT_SCALABLE:
717 lexrc >> use_scalable_fonts;
724 case RC_DOCUMENTPATH:
726 document_path = os::internal_path(lexrc.getString());
727 document_path = expandPath(document_path);
733 example_path = os::internal_path(lexrc.getString());
734 example_path = expandPath(example_path);
738 case RC_TEMPLATEPATH:
740 template_path = os::internal_path(lexrc.getString());
741 template_path = expandPath(template_path);
747 tempdir_path = os::internal_path(lexrc.getString());
748 tempdir_path = expandPath(tempdir_path);
752 case RC_THESAURUSDIRPATH:
754 thesaurusdir_path = os::internal_path(lexrc.getString());
755 thesaurusdir_path = expandPath(thesaurusdir_path);
759 case RC_HUNSPELLDIR_PATH:
761 hunspelldir_path = os::internal_path(lexrc.getString());
762 hunspelldir_path = expandPath(hunspelldir_path);
766 case RC_USELASTFILEPOS:
767 lexrc >> use_lastfilepos;
771 lexrc >> load_session;
774 case RC_MOUSE_WHEEL_SPEED:
775 lexrc >> mouse_wheel_speed;
778 case RC_COMPLETION_INLINE_DELAY:
779 lexrc >> completion_inline_delay;
782 case RC_COMPLETION_INLINE_MATH:
783 lexrc >> completion_inline_math;
786 case RC_COMPLETION_INLINE_TEXT:
787 lexrc >> completion_inline_text;
790 case RC_COMPLETION_INLINE_DOTS:
791 lexrc >> completion_inline_dots;
794 case RC_AUTOCORRECTION_MATH:
795 lexrc >> autocorrection_math;
798 case RC_COMPLETION_POPUP_DELAY:
799 lexrc >> completion_popup_delay;
802 case RC_COMPLETION_POPUP_MATH:
803 lexrc >> completion_popup_math;
806 case RC_COMPLETION_POPUP_TEXT:
807 lexrc >> completion_popup_text;
810 case RC_COMPLETION_CURSOR_TEXT:
811 lexrc >> completion_cursor_text;
814 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
815 lexrc >> completion_popup_after_complete;
818 case RC_COMPLETION_MINLENGTH:
819 lexrc >> completion_minlength;
822 case RC_NUMLASTFILES:
823 lexrc >> num_lastfiles;
826 case RC_CHECKLASTFILES:
827 lexrc >> check_lastfiles;
834 case RC_USE_SYSTEM_THEME_ICONS:
835 lexrc >> use_system_theme_icons;
838 case RC_SCREEN_FONT_ROMAN:
840 roman_font_name = lexrc.getString();
841 oldFontFormat(roman_font_name,
846 case RC_SCREEN_FONT_SANS:
848 sans_font_name = lexrc.getString();
849 oldFontFormat(sans_font_name, sans_font_foundry);
853 case RC_SCREEN_FONT_TYPEWRITER:
855 typewriter_font_name = lexrc.getString();
856 oldFontFormat(typewriter_font_name,
857 typewriter_font_foundry);
861 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
862 lexrc >> roman_font_foundry;
865 case RC_SCREEN_FONT_SANS_FOUNDRY:
866 lexrc >> sans_font_foundry;
869 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
870 lexrc >> typewriter_font_foundry;
875 lexrc.printError("Missing color tag.");
878 string lyx_name = lexrc.getString();
881 lexrc.printError("Missing color name for color: `$$Token'");
884 string x11_name = lexrc.getString();
886 ColorCode const col =
887 lcolor.getFromLyXName(lyx_name);
888 if (col == Color_none ||
889 col == Color_inherit ||
893 if (!lcolor.setColor(col, x11_name))
894 LYXERR0("Bad lyxrc set_color for " << lyx_name);
898 case RC_AUTOREGIONDELETE:
899 // Auto region delete defaults to true
900 lexrc >> auto_region_delete;
905 lyxpipes = os::internal_path(lexrc.getString());
906 lyxpipes = expandPath(lyxpipes);
910 case RC_CURSOR_FOLLOWS_SCROLLBAR:
911 lexrc >> cursor_follows_scrollbar;
914 case RC_CURSOR_WIDTH:
915 lexrc >> cursor_width;
918 case RC_SCROLL_BELOW_DOCUMENT:
919 lexrc >> scroll_below_document;
922 case RC_PARAGRAPH_MARKERS:
923 lexrc >> paragraph_markers;
926 case RC_MAC_DONTSWAP_CTRL_META:
927 lexrc >> mac_dontswap_ctrl_meta;
930 case RC_MAC_LIKE_CURSOR_MOVEMENT:
931 lexrc >> mac_like_cursor_movement;
934 case RC_MACRO_EDIT_STYLE:
936 switch (lexrc.getInteger()) {
937 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
938 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
939 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
944 case RC_DIALOGS_ICONIFY_WITH_MAIN:
945 lexrc >> dialogs_iconify_with_main;
948 case RC_PLAINTEXT_LINELEN:
949 lexrc >> plaintext_linelen;
951 // Spellchecker settings:
952 case RC_ACCEPT_COMPOUND:
953 lexrc >> spellchecker_accept_compound;
955 case RC_USE_SYSTEM_COLORS:
956 lexrc >> use_system_colors;
959 lexrc >> use_tooltip;
961 case RC_USE_PIXMAP_CACHE:
962 lexrc >> use_pixmap_cache;
967 case RC_SPELLCHECKER:
968 lexrc >> spellchecker;
971 lexrc >> spellchecker_alt_lang;
974 lexrc >> spellchecker_esc_chars;
976 case RC_SPELLCHECK_CONTINUOUSLY:
977 lexrc >> spellcheck_continuously;
979 case RC_SPELLCHECK_NOTES:
980 lexrc >> spellcheck_notes;
983 lexrc >> make_backup;
985 case RC_SAVE_COMPRESSED:
986 lexrc >> save_compressed;
988 case RC_BACKUPDIR_PATH:
990 backupdir_path = os::internal_path(lexrc.getString());
991 backupdir_path = expandPath(backupdir_path);
994 case RC_DEFAULT_DECIMAL_POINT:
995 lexrc >> default_decimal_point;
997 case RC_DEFAULT_LENGTH_UNIT:
999 default_length_unit = (Length::UNIT) lexrc.getInteger();
1001 case RC_DATE_INSERT_FORMAT:
1002 lexrc >> date_insert_format;
1004 case RC_LANGUAGE_CUSTOM_PACKAGE:
1005 lexrc >> language_custom_package;
1007 case RC_LANGUAGE_AUTO_BEGIN:
1008 lexrc >> language_auto_begin;
1010 case RC_LANGUAGE_AUTO_END:
1011 lexrc >> language_auto_end;
1013 case RC_LANGUAGE_GLOBAL_OPTIONS:
1014 lexrc >> language_global_options;
1016 case RC_LANGUAGE_PACKAGE_SELECTION:
1018 switch (lexrc.getInteger()) {
1020 language_package_selection = LP_AUTO;
1023 language_package_selection = LP_BABEL;
1026 language_package_selection = LP_CUSTOM;
1029 language_package_selection = LP_NONE;
1034 case RC_LANGUAGE_COMMAND_BEGIN:
1035 lexrc >> language_command_begin;
1037 case RC_LANGUAGE_COMMAND_END:
1038 lexrc >> language_command_end;
1040 case RC_LANGUAGE_COMMAND_LOCAL:
1041 lexrc >> language_command_local;
1043 case RC_VISUAL_CURSOR:
1044 lexrc >> visual_cursor;
1046 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
1047 lexrc >> close_buffer_with_last_view;
1049 case RC_AUTO_NUMBER:
1050 lexrc >> auto_number;
1052 case RC_MARK_FOREIGN_LANGUAGE:
1053 lexrc >> mark_foreign_language;
1057 string fmt, command;
1059 fmt = lexrc.getString();
1060 if (lexrc.next(true))
1061 command = lexrc.getString();
1062 setMover(fmt, command);
1066 case RC_CONVERTER: {
1067 string from, to, command, flags;
1069 from = lexrc.getString();
1071 to = lexrc.getString();
1072 if (lexrc.next(true))
1073 command = lexrc.getString();
1075 flags = lexrc.getString();
1076 if (command.empty())
1077 theConverters().erase(from, to);
1079 theConverters().add(from, to, command, flags);
1082 // compatibility with versions older than 1.4.0 only
1084 string format, command;
1085 lexrc >> format >> command;
1086 formats.setViewer(format, command);
1089 case RC_FILEFORMAT: {
1091 string format, extensions, prettyname, shortcut;
1092 if (!(lexrc >> format >> extensions))
1094 if (ok && lexrc.next(true))
1095 prettyname = lexrc.getString();
1099 if(!(lexrc >> shortcut))
1101 string viewer, editor;
1102 if (ok && lexrc.next(true))
1103 viewer = lexrc.getString();
1106 if (ok && lexrc.next(true))
1107 editor = lexrc.getString();
1111 if (!(lexrc >> flags >> mime))
1113 int flgs = Format::none;
1114 while (!flags.empty()) {
1116 flags = split(flags, flag, ',');
1117 if (flag == "document")
1118 flgs |= Format::document;
1119 else if (flag == "vector")
1120 flgs |= Format::vector;
1121 else if (flag == "zipped=native")
1122 flgs |= Format::zipped_native;
1123 else if (flag == "menu=export")
1124 flgs |= Format::export_menu;
1126 LYXERR0("Ignoring unknown flag `"
1127 << flag << "' for format `"
1131 LYXERR0("Syntax error in format " << format);
1132 else if (prettyname.empty()) {
1133 if (theConverters().formatIsUsed(format))
1134 LYXERR0("Can't delete format " << format);
1136 formats.erase(format);
1138 formats.add(format, extensions, prettyname,
1139 shortcut, viewer, editor, mime, flgs);
1143 case RC_VIEWER_ALTERNATIVES: {
1144 string format, command;
1147 viewer_alternatives[format].insert(command);
1150 case RC_EDITOR_ALTERNATIVES: {
1151 string format, command;
1154 editor_alternatives[format].insert(command);
1158 case RC_DEFAULT_OTF_VIEW_FORMAT:
1159 lexrc >> default_otf_view_format;
1162 case RC_DEFAULT_VIEW_FORMAT:
1163 lexrc >> default_view_format;
1166 case RC_GUI_LANGUAGE:
1167 lexrc >> gui_language;
1170 case RC_SHOW_BANNER:
1171 lexrc >> show_banner;
1176 string const tmp = lexrc.getString();
1177 if (tmp == "true" || tmp == "on")
1178 preview = PREVIEW_ON;
1179 else if (tmp == "no_math")
1180 preview = PREVIEW_NO_MATH;
1182 preview = PREVIEW_OFF;
1183 if (tmp != "false" && tmp != "off")
1184 LYXERR0("Unrecognized preview status \""
1190 case RC_PREVIEW_HASHED_LABELS:
1191 lexrc >> preview_hashed_labels;
1194 case RC_PREVIEW_SCALE_FACTOR:
1195 lexrc >> preview_scale_factor;
1202 lexrc >> user_email;
1205 case RC_PATH_PREFIX:
1206 lexrc >> path_prefix;
1209 case RC_USE_CONVERTER_CACHE:
1210 lexrc >> use_converter_cache;
1212 case RC_CONVERTER_CACHE_MAXAGE:
1213 lexrc >> converter_cache_maxage;
1216 case RC_SORT_LAYOUTS:
1217 lexrc >> sort_layouts;
1219 case RC_GROUP_LAYOUTS:
1220 lexrc >> group_layouts;
1222 case RC_FULL_SCREEN_LIMIT:
1223 lexrc >> full_screen_limit;
1225 case RC_FULL_SCREEN_TOOLBARS:
1226 lexrc >> full_screen_toolbars;
1228 case RC_FULL_SCREEN_SCROLLBAR:
1229 lexrc >> full_screen_scrollbar;
1231 case RC_FULL_SCREEN_STATUSBAR:
1232 lexrc >> full_screen_statusbar;
1234 case RC_FULL_SCREEN_TABBAR:
1235 lexrc >> full_screen_tabbar;
1237 case RC_FULL_SCREEN_MENUBAR:
1238 lexrc >> full_screen_menubar;
1240 case RC_FULL_SCREEN_WIDTH:
1241 lexrc >> full_screen_width;
1243 case RC_OPEN_BUFFERS_IN_TABS:
1244 lexrc >> open_buffers_in_tabs;
1246 case RC_SINGLE_CLOSE_TAB_BUTTON:
1247 lexrc >> single_close_tab_button;
1249 case RC_SINGLE_INSTANCE:
1250 lexrc >> single_instance;
1251 if (run_mode == PREFERRED)
1252 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1254 case RC_FORWARD_SEARCH_DVI:
1255 if (lexrc.next(true))
1256 forward_search_dvi = lexrc.getString();
1258 case RC_FORWARD_SEARCH_PDF:
1259 if (lexrc.next(true))
1260 forward_search_pdf = lexrc.getString();
1262 case RC_EXPORT_OVERWRITE:
1264 string const tmp = lexrc.getString();
1265 if (tmp == "all" || tmp == "true")
1266 export_overwrite = ALL_FILES;
1267 else if (tmp == "main")
1268 export_overwrite = MAIN_FILE;
1270 export_overwrite = NO_FILES;
1271 if (tmp != "ask" && tmp != "false")
1272 LYXERR0("Unrecognized export_overwrite status \""
1277 case RC_SCROLL_WHEEL_ZOOM:
1279 string const tmp = lexrc.getString();
1281 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1282 else if (tmp == "shift")
1283 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1284 else if (tmp == "alt")
1285 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1287 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1288 if (tmp != "off" && tmp != "false")
1289 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1296 break; // this is just a dummy
1299 // This is triggered the first time through the loop unless
1300 // we hit a format tag.
1301 if (check_format && format != LYXRC_FILEFORMAT)
1302 return FormatMismatch;
1305 /// Update converters data-structures
1306 theConverters().update(formats);
1307 theConverters().buildGraph();
1313 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1315 ofstream ofs(filename.toFilesystemEncoding().c_str());
1317 write(ofs, ignore_system_lyxrc);
1321 void LyXRC::print() const
1323 if (lyxerr.debugging())
1324 write(lyxerr, false);
1332 typedef pair<string, SpecialisedMover> Data;
1334 SameMover(Data const & comparison)
1335 : comparison_(comparison) {}
1337 bool operator()(Data const & data) const
1339 return data.first == comparison_.first &&
1340 data.second.command() == comparison_.second.command();
1350 // Escape \ and " so that LyXLex can read the string later
1351 string escapeCommand(string const & str) {
1352 return subst(subst(str , "\\", "\\\\"),
1359 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1361 LyXRCTags tag = RC_LAST;
1363 if (!name.empty()) {
1364 for (int i = 0; i != lyxrcCount; ++i)
1365 if ("\\" + name == lyxrcTags[i].tag)
1366 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1370 os << "# LyX " << lyx_version
1371 << " generated this file. If you want to make your own\n"
1372 << "# modifications you should do them from inside LyX and save.\n\n"
1373 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1375 // Why the switch you might ask. It is a trick to ensure that all
1376 // the elements in the LyXRCTags enum are handled. As you can see
1377 // there are no breaks at all. So it is just a huge fall-through.
1378 // The nice thing is that we will get a warning from the compiler
1379 // if we forget an element.
1383 // input/include files are not done here
1384 case RC_LYXRCFORMAT:
1386 if (ignore_system_lyxrc ||
1387 bind_file != system_lyxrc.bind_file) {
1388 string const path = os::external_path(bind_file);
1389 os << "\\bind_file \"" << path << "\"\n";
1395 if (ignore_system_lyxrc ||
1396 def_file != system_lyxrc.def_file) {
1397 string const path = os::external_path(def_file);
1398 os << "\\def_file \"" << path << "\"\n";
1407 << "# MISC SECTION ######################################\n"
1409 // bind files are not done here.
1411 case RC_PATH_PREFIX:
1412 if (ignore_system_lyxrc ||
1413 path_prefix != system_lyxrc.path_prefix) {
1414 os << "\\path_prefix \"" << path_prefix << "\"\n";
1419 if (ignore_system_lyxrc ||
1420 ui_file != system_lyxrc.ui_file) {
1421 string const path = os::external_path(ui_file);
1422 os << "\\ui_file \"" << path << "\"\n";
1426 case RC_AUTOREGIONDELETE:
1427 if (ignore_system_lyxrc ||
1428 auto_region_delete != system_lyxrc.auto_region_delete) {
1429 os << "# Set to false to inhibit automatic replacement of\n"
1430 << "# the current selection.\n"
1431 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1436 case RC_AUTORESET_OPTIONS:
1437 if (ignore_system_lyxrc ||
1438 auto_reset_options != system_lyxrc.auto_reset_options) {
1439 os << "# Set to false to inhibit automatic reset of\n"
1440 << "# the class options to defaults on class change.\n"
1441 << "\\auto_reset_options "
1442 << convert<string>(auto_reset_options)
1448 if (ignore_system_lyxrc ||
1449 autosave != system_lyxrc.autosave) {
1450 os << "# The time interval between auto-saves in seconds.\n"
1451 << "\\autosave " << autosave << '\n';
1455 case RC_DISPLAY_GRAPHICS:
1456 if (ignore_system_lyxrc ||
1457 display_graphics != system_lyxrc.display_graphics) {
1458 os << "# Display graphics within LyX\n"
1460 << "\\display_graphics "
1461 << (display_graphics ? "true" : "false")
1466 case RC_SORT_LAYOUTS:
1467 if (ignore_system_lyxrc ||
1468 sort_layouts != system_lyxrc.sort_layouts) {
1469 os << "# Sort layouts alphabetically.\n"
1470 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1474 case RC_GROUP_LAYOUTS:
1475 if (ignore_system_lyxrc ||
1476 group_layouts != system_lyxrc.group_layouts) {
1477 os << "# Group layouts by their category.\n"
1478 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1482 case RC_VIEWDVI_PAPEROPTION:
1483 if (ignore_system_lyxrc ||
1484 view_dvi_paper_option
1485 != system_lyxrc.view_dvi_paper_option) {
1486 os << "# Options used to specify paper size to the\n"
1487 << "# view_dvi_command (e.g. -paper)\n"
1488 << "\\view_dvi_paper_option \""
1489 << view_dvi_paper_option << "\"\n";
1493 case RC_CHKTEX_COMMAND:
1494 if (ignore_system_lyxrc ||
1495 chktex_command != system_lyxrc.chktex_command) {
1496 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1500 case RC_BIBTEX_ALTERNATIVES: {
1501 CommandSet::const_iterator it = bibtex_alternatives.begin();
1502 CommandSet::const_iterator end = bibtex_alternatives.end();
1503 for ( ; it != end; ++it) {
1504 if (ignore_system_lyxrc
1505 || !system_lyxrc.bibtex_alternatives.count(*it))
1506 os << "\\bibtex_alternatives \""
1512 case RC_BIBTEX_COMMAND:
1513 if (ignore_system_lyxrc ||
1514 bibtex_command != system_lyxrc.bibtex_command) {
1515 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1519 case RC_JBIBTEX_COMMAND:
1520 if (ignore_system_lyxrc ||
1521 jbibtex_command != system_lyxrc.jbibtex_command) {
1522 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1526 case RC_INDEX_ALTERNATIVES: {
1527 CommandSet::const_iterator it = index_alternatives.begin();
1528 CommandSet::const_iterator end = index_alternatives.end();
1529 for ( ; it != end; ++it) {
1530 if (ignore_system_lyxrc
1531 || !system_lyxrc.index_alternatives.count(*it))
1532 os << "\\index_alternatives \""
1538 case RC_INDEX_COMMAND:
1539 if (ignore_system_lyxrc ||
1540 index_command != system_lyxrc.index_command) {
1541 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1545 case RC_JINDEX_COMMAND:
1546 if (ignore_system_lyxrc ||
1547 jindex_command != system_lyxrc.jindex_command) {
1548 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1552 case RC_SPLITINDEX_COMMAND:
1553 if (ignore_system_lyxrc ||
1554 splitindex_command != system_lyxrc.splitindex_command) {
1555 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1559 case RC_NOMENCL_COMMAND:
1560 if (ignore_system_lyxrc ||
1561 nomencl_command != system_lyxrc.nomencl_command) {
1562 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1566 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1567 // Don't write this setting to the preferences file,
1568 // but allow temporary changes (bug 7557).
1569 if (ignore_system_lyxrc) {
1570 os << "\\tex_expects_windows_paths "
1571 << convert<string>(windows_style_tex_paths) << '\n';
1575 case RC_TEX_ALLOWS_SPACES:
1576 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1577 os << "\\tex_allows_spaces "
1578 << convert<string>(tex_allows_spaces) << '\n';
1583 if (ignore_system_lyxrc ||
1584 use_kbmap != system_lyxrc.use_kbmap) {
1585 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1589 case RC_KBMAP_PRIMARY:
1590 if (ignore_system_lyxrc ||
1591 primary_kbmap != system_lyxrc.primary_kbmap) {
1592 string const path = os::external_path(primary_kbmap);
1593 os << "\\kbmap_primary \"" << path << "\"\n";
1597 case RC_KBMAP_SECONDARY:
1598 if (ignore_system_lyxrc ||
1599 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1600 string const path = os::external_path(secondary_kbmap);
1601 os << "\\kbmap_secondary \"" << path << "\"\n";
1606 if (ignore_system_lyxrc ||
1607 lyxpipes != system_lyxrc.lyxpipes) {
1608 string const path = os::external_path(lyxpipes);
1609 os << "\\serverpipe \"" << path << "\"\n";
1613 case RC_DATE_INSERT_FORMAT:
1614 if (ignore_system_lyxrc ||
1615 date_insert_format != system_lyxrc.date_insert_format) {
1616 os << "\\date_insert_format \"" << date_insert_format
1623 os << "\\user_name \"" << user_name << "\"\n";
1628 os << "\\user_email \"" << user_email << "\"\n";
1632 case RC_SHOW_BANNER:
1633 if (ignore_system_lyxrc ||
1634 show_banner != system_lyxrc.show_banner) {
1635 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1641 if (ignore_system_lyxrc ||
1642 preview != system_lyxrc.preview) {
1648 case PREVIEW_NO_MATH:
1655 os << "\\preview " << status << '\n';
1660 case RC_PREVIEW_HASHED_LABELS:
1661 if (ignore_system_lyxrc ||
1662 preview_hashed_labels !=
1663 system_lyxrc.preview_hashed_labels) {
1664 os << "\\preview_hashed_labels "
1665 << convert<string>(preview_hashed_labels) << '\n';
1670 case RC_PREVIEW_SCALE_FACTOR:
1671 if (ignore_system_lyxrc ||
1672 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1673 os << "\\preview_scale_factor "
1674 << preview_scale_factor << '\n';
1679 case RC_USE_CONVERTER_CACHE:
1680 if (ignore_system_lyxrc ||
1681 use_converter_cache != system_lyxrc.use_converter_cache) {
1682 os << "\\use_converter_cache "
1683 << convert<string>(use_converter_cache) << '\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';
1727 case RC_SCREEN_ZOOM:
1728 if (ignore_system_lyxrc ||
1729 zoom != system_lyxrc.zoom) {
1730 os << "\\screen_zoom " << zoom << '\n';
1734 case RC_GEOMETRY_SESSION:
1735 if (ignore_system_lyxrc ||
1736 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1737 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1742 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1743 if (ignore_system_lyxrc ||
1744 cursor_follows_scrollbar
1745 != system_lyxrc.cursor_follows_scrollbar) {
1746 os << "\\cursor_follows_scrollbar "
1747 << convert<string>(cursor_follows_scrollbar) << '\n';
1751 case RC_CURSOR_WIDTH:
1752 if (ignore_system_lyxrc ||
1754 != system_lyxrc.cursor_width) {
1755 os << "\\cursor_width "
1756 << cursor_width << '\n';
1760 case RC_SCROLL_BELOW_DOCUMENT:
1761 if (ignore_system_lyxrc ||
1762 scroll_below_document
1763 != system_lyxrc.scroll_below_document) {
1764 os << "\\scroll_below_document "
1765 << convert<string>(scroll_below_document) << '\n';
1769 case RC_PARAGRAPH_MARKERS:
1770 if (ignore_system_lyxrc ||
1772 != system_lyxrc.paragraph_markers) {
1773 os << "\\paragraph_markers "
1774 << convert<string>(paragraph_markers) << '\n';
1778 case RC_MAC_DONTSWAP_CTRL_META:
1779 if (ignore_system_lyxrc ||
1780 mac_dontswap_ctrl_meta
1781 != system_lyxrc.mac_dontswap_ctrl_meta) {
1782 os << "\\mac_dontswap_ctrl_meta "
1783 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1787 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1788 if (ignore_system_lyxrc ||
1789 mac_like_cursor_movement
1790 != system_lyxrc.mac_like_cursor_movement) {
1791 os << "\\mac_like_cursor_movement "
1792 << convert<string>(mac_like_cursor_movement) << '\n';
1796 case RC_MACRO_EDIT_STYLE:
1797 if (ignore_system_lyxrc ||
1799 != system_lyxrc.macro_edit_style) {
1800 os << "\\macro_edit_style ";
1801 switch (macro_edit_style) {
1802 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1803 case MACRO_EDIT_INLINE: os << "1\n"; break;
1804 case MACRO_EDIT_LIST: os << "2\n"; break;
1809 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1810 if (ignore_system_lyxrc ||
1811 dialogs_iconify_with_main
1812 != system_lyxrc.dialogs_iconify_with_main) {
1813 os << "\\dialogs_iconify_with_main "
1814 << convert<string>(dialogs_iconify_with_main) << '\n';
1818 case RC_SCREEN_FONT_ROMAN:
1819 if (ignore_system_lyxrc ||
1820 roman_font_name != system_lyxrc.roman_font_name) {
1821 os << "\\screen_font_roman \"" << roman_font_name
1826 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1827 if (ignore_system_lyxrc ||
1828 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1829 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1834 case RC_SCREEN_FONT_SANS:
1835 if (ignore_system_lyxrc ||
1836 sans_font_name != system_lyxrc.sans_font_name) {
1837 os << "\\screen_font_sans \"" << sans_font_name
1842 case RC_SCREEN_FONT_SANS_FOUNDRY:
1843 if (ignore_system_lyxrc ||
1844 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1845 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1850 case RC_SCREEN_FONT_TYPEWRITER:
1851 if (ignore_system_lyxrc ||
1852 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1853 os << "\\screen_font_typewriter \""
1854 << typewriter_font_name << "\"\n";
1858 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1859 if (ignore_system_lyxrc ||
1860 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1861 os << "\\screen_font_typewriter_foundry \""
1862 << typewriter_font_foundry << "\"\n";
1867 case RC_SCREEN_FONT_SCALABLE:
1868 if (ignore_system_lyxrc ||
1869 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1870 os << "\\screen_font_scalable "
1871 << convert<string>(use_scalable_fonts)
1876 case RC_SCREEN_FONT_SIZES:
1877 if (ignore_system_lyxrc ||
1878 font_sizes[FONT_SIZE_TINY]
1879 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1880 font_sizes[FONT_SIZE_SCRIPT]
1881 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1882 font_sizes[FONT_SIZE_FOOTNOTE]
1883 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1884 font_sizes[FONT_SIZE_SMALL]
1885 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1886 font_sizes[FONT_SIZE_NORMAL]
1887 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1888 font_sizes[FONT_SIZE_LARGE]
1889 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1890 font_sizes[FONT_SIZE_LARGER]
1891 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1892 font_sizes[FONT_SIZE_LARGEST]
1893 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1894 font_sizes[FONT_SIZE_HUGE]
1895 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1896 font_sizes[FONT_SIZE_HUGER]
1897 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1898 os.setf(ios::fixed);
1900 os << "\\screen_font_sizes"
1901 << ' ' << font_sizes[FONT_SIZE_TINY]
1902 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1903 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1904 << ' ' << font_sizes[FONT_SIZE_SMALL]
1905 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1906 << ' ' << font_sizes[FONT_SIZE_LARGE]
1907 << ' ' << font_sizes[FONT_SIZE_LARGER]
1908 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1909 << ' ' << font_sizes[FONT_SIZE_HUGE]
1910 << ' ' << font_sizes[FONT_SIZE_HUGER]
1915 case RC_FULL_SCREEN_LIMIT:
1916 if (ignore_system_lyxrc ||
1917 full_screen_limit != system_lyxrc.full_screen_limit) {
1918 os << "\\fullscreen_limit "
1919 << convert<string>(full_screen_limit)
1924 case RC_FULL_SCREEN_TOOLBARS:
1925 if (ignore_system_lyxrc ||
1926 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1927 os << "\\fullscreen_toolbars "
1928 << convert<string>(full_screen_toolbars)
1933 case RC_FULL_SCREEN_SCROLLBAR:
1934 if (ignore_system_lyxrc ||
1935 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1936 os << "\\fullscreen_scrollbar "
1937 << convert<string>(full_screen_scrollbar)
1942 case RC_FULL_SCREEN_STATUSBAR:
1943 if (ignore_system_lyxrc ||
1944 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1945 os << "\\fullscreen_statusbar "
1946 << convert<string>(full_screen_statusbar)
1951 case RC_FULL_SCREEN_TABBAR:
1952 if (ignore_system_lyxrc ||
1953 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1954 os << "\\fullscreen_tabbar "
1955 << convert<string>(full_screen_tabbar)
1960 case RC_FULL_SCREEN_MENUBAR:
1961 if (ignore_system_lyxrc ||
1962 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1963 os << "\\fullscreen_menubar "
1964 << convert<string>(full_screen_menubar)
1969 case RC_FULL_SCREEN_WIDTH:
1970 if (ignore_system_lyxrc ||
1971 full_screen_width != system_lyxrc.full_screen_width) {
1972 os << "\\fullscreen_width "
1973 << convert<string>(full_screen_width)
1978 case RC_OPEN_BUFFERS_IN_TABS:
1979 if (ignore_system_lyxrc ||
1980 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1981 os << "\\open_buffers_in_tabs "
1982 << convert<string>(open_buffers_in_tabs)
1987 case RC_SINGLE_CLOSE_TAB_BUTTON:
1988 if (ignore_system_lyxrc ||
1989 single_close_tab_button != system_lyxrc.single_close_tab_button) {
1990 os << "\\single_close_tab_button "
1991 << convert<string>(single_close_tab_button)
1996 case RC_SINGLE_INSTANCE:
1997 if (ignore_system_lyxrc ||
1998 single_instance != system_lyxrc.single_instance) {
1999 os << "\\single_instance "
2000 << convert<string>(single_instance)
2005 case RC_FORWARD_SEARCH_DVI:
2006 if (ignore_system_lyxrc ||
2007 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2008 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2012 case RC_FORWARD_SEARCH_PDF:
2013 if (ignore_system_lyxrc ||
2014 forward_search_pdf != system_lyxrc.forward_search_pdf) {
2015 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2021 << "# COLOR SECTION ###################################\n"
2025 for (int i = 0; i < Color_ignore; ++i) {
2026 ColorCode lc = static_cast<ColorCode>(i);
2027 string const col = lcolor.getX11Name(lc);
2028 if (ignore_system_lyxrc
2029 || col != system_lcolor.getX11Name(lc)) {
2030 os << "\\set_color \""
2031 << lcolor.getLyXName(lc) << "\" \""
2039 << "# PRINTER SECTION ###################################\n"
2043 if (ignore_system_lyxrc ||
2044 printer != system_lyxrc.printer) {
2045 os << "\\printer \"" << printer << "\"\n";
2049 case RC_PRINT_ADAPTOUTPUT:
2050 if (ignore_system_lyxrc ||
2051 print_adapt_output != system_lyxrc.print_adapt_output) {
2052 os << "\\print_adapt_output "
2053 << convert<string>(print_adapt_output)
2058 case RC_PRINT_COMMAND:
2059 if (ignore_system_lyxrc ||
2060 print_command != system_lyxrc.print_command) {
2061 os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
2065 case RC_PRINTEXSTRAOPTIONS:
2066 if (ignore_system_lyxrc ||
2067 print_extra_options != system_lyxrc.print_extra_options) {
2068 os << "\\print_extra_options \"" << print_extra_options
2073 case RC_PRINTSPOOL_COMMAND:
2074 if (ignore_system_lyxrc ||
2075 print_spool_command != system_lyxrc.print_spool_command) {
2076 os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
2081 case RC_PRINTSPOOL_PRINTERPREFIX:
2082 if (ignore_system_lyxrc ||
2083 print_spool_printerprefix
2084 != system_lyxrc.print_spool_printerprefix) {
2085 os << "\\print_spool_printerprefix \""
2086 << print_spool_printerprefix << "\"\n";
2090 case RC_PRINTEVENPAGEFLAG:
2091 if (ignore_system_lyxrc ||
2092 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
2093 os << "\\print_evenpage_flag \"" << print_evenpage_flag
2098 case RC_PRINTODDPAGEFLAG:
2099 if (ignore_system_lyxrc ||
2100 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
2101 os << "\\print_oddpage_flag \"" << print_oddpage_flag
2106 case RC_PRINTREVERSEFLAG:
2107 if (ignore_system_lyxrc ||
2108 print_reverse_flag != system_lyxrc.print_reverse_flag) {
2109 os << "\\print_reverse_flag \"" << print_reverse_flag
2114 case RC_PRINTLANDSCAPEFLAG:
2115 if (ignore_system_lyxrc ||
2116 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2117 os << "\\print_landscape_flag \"" << print_landscape_flag
2122 case RC_PRINTPAGERANGEFLAG:
2123 if (ignore_system_lyxrc ||
2124 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
2125 os << "\\print_pagerange_flag \"" << print_pagerange_flag
2130 case RC_PRINTCOPIESFLAG:
2131 if (ignore_system_lyxrc ||
2132 print_copies_flag != system_lyxrc.print_copies_flag) {
2133 os << "\\print_copies_flag \"" << print_copies_flag
2138 case RC_PRINTCOLLCOPIESFLAG:
2139 if (ignore_system_lyxrc ||
2140 print_collcopies_flag
2141 != system_lyxrc.print_collcopies_flag) {
2142 os << "\\print_collcopies_flag \""
2143 << print_collcopies_flag
2148 case RC_PRINTPAPERFLAG:
2149 if (ignore_system_lyxrc ||
2150 print_paper_flag != system_lyxrc.print_paper_flag) {
2151 os << "\\print_paper_flag \"" << print_paper_flag
2156 case RC_PRINTPAPERDIMENSIONFLAG:
2157 if (ignore_system_lyxrc ||
2158 print_paper_dimension_flag
2159 != system_lyxrc.print_paper_dimension_flag) {
2160 os << "\\print_paper_dimension_flag \""
2161 << print_paper_dimension_flag << "\"\n";
2165 case RC_PRINTTOPRINTER:
2166 if (ignore_system_lyxrc ||
2167 print_to_printer != system_lyxrc.print_to_printer) {
2168 os << "\\print_to_printer \"" << print_to_printer
2173 case RC_PRINTTOFILE:
2174 if (ignore_system_lyxrc ||
2175 print_to_file != system_lyxrc.print_to_file) {
2176 string const path = os::external_path(print_to_file);
2177 os << "\\print_to_file \"" << path << "\"\n";
2181 case RC_PRINTFILEEXTENSION:
2182 if (ignore_system_lyxrc ||
2183 print_file_extension != system_lyxrc.print_file_extension) {
2184 os << "\\print_file_extension \""
2185 << print_file_extension
2192 << "# TEX SECTION #######################################\n"
2195 case RC_TEXINPUTS_PREFIX:
2196 if (ignore_system_lyxrc ||
2197 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2198 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2203 case RC_FONT_ENCODING:
2204 if (ignore_system_lyxrc ||
2205 fontenc != system_lyxrc.fontenc) {
2206 os << "\\font_encoding \"" << fontenc << "\"\n";
2212 << "# FILE SECTION ######################################\n"
2215 case RC_DOCUMENTPATH:
2216 if (ignore_system_lyxrc ||
2217 document_path != system_lyxrc.document_path) {
2218 string const path = os::external_path(document_path);
2219 os << "\\document_path \"" << path << "\"\n";
2223 case RC_USELASTFILEPOS:
2224 if (ignore_system_lyxrc ||
2225 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2226 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2231 case RC_LOADSESSION:
2232 if (ignore_system_lyxrc ||
2233 load_session != system_lyxrc.load_session) {
2234 os << "\\load_session " << convert<string>(load_session)
2239 case RC_MOUSE_WHEEL_SPEED:
2240 if (ignore_system_lyxrc ||
2241 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2242 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2246 case RC_COMPLETION_INLINE_DELAY:
2247 if (ignore_system_lyxrc ||
2248 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2249 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2253 case RC_COMPLETION_INLINE_MATH:
2254 if (ignore_system_lyxrc ||
2255 completion_inline_math != system_lyxrc.completion_inline_math) {
2256 os << "\\completion_inline_math "
2257 << convert<string>(completion_inline_math) << '\n';
2261 case RC_COMPLETION_INLINE_TEXT:
2262 if (ignore_system_lyxrc ||
2263 completion_inline_text != system_lyxrc.completion_inline_text) {
2264 os << "\\completion_inline_text "
2265 << convert<string>(completion_inline_text) << '\n';
2269 case RC_COMPLETION_INLINE_DOTS:
2270 if (ignore_system_lyxrc ||
2271 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2272 os << "\\completion_inline_dots "
2273 << convert<string>(completion_inline_dots) << '\n';
2277 case RC_AUTOCORRECTION_MATH:
2278 if (ignore_system_lyxrc ||
2279 autocorrection_math != system_lyxrc.autocorrection_math) {
2280 os << "\\autocorrection_math "
2281 << convert<string>(autocorrection_math) << '\n';
2285 case RC_COMPLETION_POPUP_DELAY:
2286 if (ignore_system_lyxrc ||
2287 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2288 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2292 case RC_COMPLETION_POPUP_MATH:
2293 if (ignore_system_lyxrc ||
2294 completion_popup_math != system_lyxrc.completion_popup_math) {
2295 os << "\\completion_popup_math "
2296 << convert<string>(completion_popup_math) << '\n';
2300 case RC_COMPLETION_POPUP_TEXT:
2301 if (ignore_system_lyxrc ||
2302 completion_popup_text != system_lyxrc.completion_popup_text) {
2303 os << "\\completion_popup_text "
2304 << convert<string>(completion_popup_text) << '\n';
2308 case RC_COMPLETION_CURSOR_TEXT:
2309 if (ignore_system_lyxrc ||
2310 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2311 os << "\\completion_cursor_text "
2312 << convert<string>(completion_cursor_text) << '\n';
2316 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2317 if (ignore_system_lyxrc ||
2318 completion_popup_after_complete
2319 != system_lyxrc.completion_popup_after_complete) {
2320 os << "\\completion_popup_after_complete "
2321 << convert<string>(completion_popup_after_complete) << '\n';
2325 case RC_COMPLETION_MINLENGTH:
2326 if (ignore_system_lyxrc ||
2327 completion_minlength != system_lyxrc.completion_minlength) {
2328 os << "\\completion_minlength " << convert<string>(completion_minlength)
2334 case RC_NUMLASTFILES:
2335 if (ignore_system_lyxrc ||
2336 num_lastfiles != system_lyxrc.num_lastfiles) {
2337 os << "\\num_lastfiles " << num_lastfiles << '\n';
2341 case RC_CHECKLASTFILES:
2342 if (ignore_system_lyxrc ||
2343 check_lastfiles != system_lyxrc.check_lastfiles) {
2344 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2349 case RC_EXAMPLEPATH:
2350 if (ignore_system_lyxrc ||
2351 example_path != system_lyxrc.example_path) {
2352 string const path = os::external_path(example_path);
2353 os << "\\example_path \"" << path << "\"\n";
2357 case RC_TEMPLATEPATH:
2358 if (ignore_system_lyxrc ||
2359 template_path != system_lyxrc.template_path) {
2360 string const path = os::external_path(template_path);
2361 os << "\\template_path \"" << path << "\"\n";
2365 case RC_TEMPDIRPATH:
2366 if (ignore_system_lyxrc ||
2367 tempdir_path != system_lyxrc.tempdir_path) {
2368 string const path = os::external_path(tempdir_path);
2369 os << "\\tempdir_path \"" << path << "\"\n";
2373 case RC_THESAURUSDIRPATH:
2374 if (ignore_system_lyxrc ||
2375 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2376 string const path = os::external_path(thesaurusdir_path);
2377 os << "\\thesaurusdir_path \"" << path << "\"\n";
2381 case RC_HUNSPELLDIR_PATH:
2382 if (ignore_system_lyxrc ||
2383 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2384 string const path = os::external_path(hunspelldir_path);
2385 os << "\\hunspelldir_path \"" << path << "\"\n";
2389 case RC_PLAINTEXT_LINELEN:
2390 if (ignore_system_lyxrc ||
2391 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2392 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2396 case RC_MAKE_BACKUP:
2397 if (ignore_system_lyxrc ||
2398 make_backup != system_lyxrc.make_backup) {
2399 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2403 case RC_SAVE_COMPRESSED:
2404 if (ignore_system_lyxrc ||
2405 save_compressed != system_lyxrc.save_compressed) {
2406 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2410 case RC_BACKUPDIR_PATH:
2411 if (ignore_system_lyxrc ||
2412 backupdir_path != system_lyxrc.backupdir_path) {
2413 string const path = os::external_path(backupdir_path);
2414 os << "\\backupdir_path \"" << path << "\"\n";
2420 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2424 << "# SPELLCHECKER SECTION ##############################\n"
2427 case RC_ACCEPT_COMPOUND:
2428 if (ignore_system_lyxrc ||
2429 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2430 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2436 if (ignore_system_lyxrc ||
2437 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2438 os << "\\alternate_language \"" << spellchecker_alt_lang
2444 if (ignore_system_lyxrc ||
2445 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2446 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2450 case RC_USE_SYSTEM_COLORS:
2451 if (ignore_system_lyxrc ||
2452 use_system_colors != system_lyxrc.use_system_colors) {
2453 os << "\\use_system_colors "
2454 << convert<string>(use_system_colors)
2459 case RC_USE_TOOLTIP:
2460 if (ignore_system_lyxrc ||
2461 use_tooltip != system_lyxrc.use_tooltip) {
2462 os << "\\use_tooltip "
2463 << convert<string>(use_tooltip)
2468 case RC_USE_PIXMAP_CACHE:
2469 if (ignore_system_lyxrc ||
2470 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2471 os << "\\use_pixmap_cache "
2472 << convert<string>(use_pixmap_cache)
2478 if (ignore_system_lyxrc ||
2479 use_qimage != system_lyxrc.use_qimage) {
2480 os << "\\use_qimage "
2481 << convert<string>(use_qimage)
2488 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2493 case RC_DEFAULT_DECIMAL_POINT:
2494 if (ignore_system_lyxrc ||
2495 default_decimal_point != system_lyxrc.default_decimal_point) {
2496 os << "\\default_decimal_point " << default_decimal_point << '\n';
2501 case RC_DEFAULT_LENGTH_UNIT:
2502 if (ignore_system_lyxrc ||
2503 default_length_unit != system_lyxrc.default_length_unit) {
2504 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2509 case RC_SPELLCHECKER:
2510 if (ignore_system_lyxrc ||
2511 spellchecker != system_lyxrc.spellchecker) {
2512 os << "\\spellchecker " << spellchecker << '\n';
2517 case RC_SPELLCHECK_CONTINUOUSLY:
2518 if (ignore_system_lyxrc ||
2519 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2520 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2526 case RC_SPELLCHECK_NOTES:
2527 if (ignore_system_lyxrc ||
2528 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2529 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2535 case RC_VISUAL_CURSOR:
2536 if (ignore_system_lyxrc ||
2537 visual_cursor != system_lyxrc.visual_cursor) {
2538 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2542 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2543 if (ignore_system_lyxrc ||
2544 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2545 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2546 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2550 case RC_LANGUAGE_CUSTOM_PACKAGE:
2551 if (ignore_system_lyxrc ||
2552 language_custom_package != system_lyxrc.language_custom_package) {
2553 os << "\\language_custom_package \"" << language_custom_package
2558 case RC_LANGUAGE_GLOBAL_OPTIONS:
2559 if (ignore_system_lyxrc ||
2560 language_global_options
2561 != system_lyxrc.language_global_options) {
2562 os << "\\language_global_options \""
2563 << convert<string>(language_global_options)
2568 case RC_LANGUAGE_PACKAGE_SELECTION:
2569 if (ignore_system_lyxrc ||
2570 language_package_selection != system_lyxrc.language_package_selection) {
2571 os << "\\language_package_selection ";
2572 switch (language_package_selection) {
2589 case RC_LANGUAGE_COMMAND_BEGIN:
2590 if (ignore_system_lyxrc ||
2591 language_command_begin
2592 != system_lyxrc.language_command_begin) {
2593 os << "\\language_command_begin \""
2594 << language_command_begin
2599 case RC_LANGUAGE_COMMAND_END:
2600 if (ignore_system_lyxrc ||
2601 language_command_end
2602 != system_lyxrc.language_command_end) {
2603 os << "\\language_command_end \"" << language_command_end
2608 case RC_LANGUAGE_COMMAND_LOCAL:
2609 if (ignore_system_lyxrc ||
2610 language_command_local
2611 != system_lyxrc.language_command_local) {
2612 os << "\\language_command_local \""
2613 << language_command_local
2618 case RC_LANGUAGE_AUTO_BEGIN:
2619 if (ignore_system_lyxrc ||
2620 language_auto_begin != system_lyxrc.language_auto_begin) {
2621 os << "\\language_auto_begin "
2622 << convert<string>(language_auto_begin) << '\n';
2626 case RC_LANGUAGE_AUTO_END:
2627 if (ignore_system_lyxrc ||
2628 language_auto_end != system_lyxrc.language_auto_end) {
2629 os << "\\language_auto_end "
2630 << convert<string>(language_auto_end) << '\n';
2634 case RC_MARK_FOREIGN_LANGUAGE:
2635 if (ignore_system_lyxrc ||
2636 mark_foreign_language
2637 != system_lyxrc.mark_foreign_language) {
2638 os << "\\mark_foreign_language " <<
2639 convert<string>(mark_foreign_language) << '\n';
2645 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2648 case RC_AUTO_NUMBER:
2649 if (ignore_system_lyxrc ||
2650 auto_number != system_lyxrc.auto_number) {
2651 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2655 case RC_GUI_LANGUAGE:
2656 if (ignore_system_lyxrc ||
2657 gui_language != system_lyxrc.gui_language) {
2658 os << "\\gui_language " << gui_language << '\n';
2662 case RC_EXPORT_OVERWRITE:
2663 if (ignore_system_lyxrc ||
2664 export_overwrite != system_lyxrc.export_overwrite) {
2666 switch (export_overwrite) {
2677 os << "\\export_overwrite " << status << '\n';
2682 case RC_SCROLL_WHEEL_ZOOM:
2683 if (ignore_system_lyxrc ||
2684 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2686 switch (scroll_wheel_zoom) {
2687 case SCROLL_WHEEL_ZOOM_OFF:
2690 case SCROLL_WHEEL_ZOOM_CTRL:
2693 case SCROLL_WHEEL_ZOOM_SHIFT:
2696 case SCROLL_WHEEL_ZOOM_ALT:
2700 os << "\\scroll_wheel_zoom " << status << '\n';
2706 << "# FORMATS SECTION ##########################\n"
2710 // New/modified formats
2711 for (Formats::const_iterator cit = formats.begin();
2712 cit != formats.end(); ++cit) {
2713 Format const * format =
2714 system_formats.getFormat(cit->name());
2716 format->extensions() != cit->extensions() ||
2717 format->prettyname() != cit->prettyname() ||
2718 format->shortcut() != cit->shortcut() ||
2719 format->viewer() != cit->viewer() ||
2720 format->editor() != cit->editor() ||
2721 format->documentFormat() != cit->documentFormat() ||
2722 format->vectorFormat() != cit->vectorFormat() ||
2723 format->inExportMenu() != cit->inExportMenu() ||
2724 format->mime() != cit->mime()) {
2725 os << "\\format \"" << cit->name() << "\" \""
2726 << cit->extensions() << "\" \""
2727 << cit->prettyname() << "\" \""
2728 << cit->shortcut() << "\" \""
2729 << escapeCommand(cit->viewer()) << "\" \""
2730 << escapeCommand(cit->editor()) << "\" \"";
2731 vector<string> flags;
2732 if (cit->documentFormat())
2733 flags.push_back("document");
2734 if (cit->vectorFormat())
2735 flags.push_back("vector");
2736 if (cit->zippedNative())
2737 flags.push_back("zipped=native");
2738 if (cit->inExportMenu())
2739 flags.push_back("menu=export");
2741 os << getStringFromVector(flags);
2742 os << "\" \"" << cit->mime() << "\"\n";
2746 // Look for deleted formats
2747 for (Formats::const_iterator cit = system_formats.begin();
2748 cit != system_formats.end(); ++cit)
2749 if (!formats.getFormat(cit->name()))
2750 os << "\\format \"" << cit->name()
2751 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2754 case RC_VIEWER_ALTERNATIVES: {
2755 Alternatives::const_iterator it = viewer_alternatives.begin();
2756 Alternatives::const_iterator const en = viewer_alternatives.end();
2757 Alternatives::const_iterator const sysend =
2758 system_lyxrc.viewer_alternatives.end();
2759 for (; it != en; ++it) {
2760 string const & fmt = it->first;
2761 CommandSet const & cmd = it->second;
2762 CommandSet::const_iterator sit = cmd.begin();
2763 CommandSet::const_iterator const sen = cmd.end();
2764 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2765 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2766 system_lyxrc.viewer_alternatives.find(fmt);
2767 for (; sit != sen; ++sit) {
2768 string const & cmd = *sit;
2769 if (ignore_system_lyxrc
2770 || sysfmt == sysend // format not found
2771 || sysfmt->second.count(cmd) == 0 // this command not found
2773 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2779 case RC_EDITOR_ALTERNATIVES: {
2780 Alternatives::const_iterator it = editor_alternatives.begin();
2781 Alternatives::const_iterator const en = editor_alternatives.end();
2782 Alternatives::const_iterator const sysend =
2783 system_lyxrc.editor_alternatives.end();
2784 for (; it != en; ++it) {
2785 string const & fmt = it->first;
2786 CommandSet const & cmd = it->second;
2787 CommandSet::const_iterator sit = cmd.begin();
2788 CommandSet::const_iterator const sen = cmd.end();
2789 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2790 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2791 system_lyxrc.editor_alternatives.find(fmt);
2792 for (; sit != sen; ++sit) {
2793 string const & cmd = *sit;
2794 if (ignore_system_lyxrc
2795 || sysfmt == sysend // format not found
2796 || sysfmt->second.count(cmd) == 0 // this command not found
2798 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2804 case RC_DEFAULT_OTF_VIEW_FORMAT:
2805 if ((ignore_system_lyxrc ||
2806 default_otf_view_format != system_lyxrc.default_otf_view_format)
2807 && !default_otf_view_format.empty()) {
2808 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2812 case RC_DEFAULT_VIEW_FORMAT:
2813 if (ignore_system_lyxrc ||
2814 default_view_format != system_lyxrc.default_view_format) {
2815 os << "\\default_view_format " << default_view_format << '\n';
2825 << "# CONVERTERS SECTION ##########################\n"
2829 // Look for new converters
2830 for (Converters::const_iterator cit = theConverters().begin();
2831 cit != theConverters().end(); ++cit) {
2832 Converter const * converter =
2833 theSystemConverters().getConverter(cit->from,
2836 converter->command != cit->command ||
2837 converter->flags != cit->flags)
2838 os << "\\converter \"" << cit->from << "\" \""
2839 << cit->to << "\" \""
2840 << escapeCommand(cit->command) << "\" \""
2841 << cit->flags << "\"\n";
2844 // New/modifed converters
2845 for (Converters::const_iterator cit = theSystemConverters().begin();
2846 cit != theSystemConverters().end(); ++cit)
2847 if (!theConverters().getConverter(cit->from, cit->to))
2848 os << "\\converter \"" << cit->from
2849 << "\" \"" << cit->to << "\" \"\" \"\"\n";
2856 << "# COPIERS SECTION ##########################\n"
2859 // Look for new movers
2860 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2861 Movers::const_iterator const sysend = theSystemMovers().end();
2862 Movers::const_iterator it = theMovers().begin();
2863 Movers::const_iterator end = theMovers().end();
2865 for (; it != end; ++it) {
2866 Movers::const_iterator const sysit =
2867 find_if(sysbegin, sysend, SameMover(*it));
2868 if (sysit == sysend) {
2869 string const & fmt = it->first;
2870 string const & command =
2871 it->second.command();
2873 os << "\\copier " << fmt
2874 << " \"" << escapeCommand(command) << "\"\n";
2880 // We don't actually delete SpecialisedMover(s) from the
2881 // map, just clear their 'command', so there's no need
2882 // to test for anything else.
2889 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2891 // Why the switch you might ask. It is a trick to ensure that all
2892 // the elements in the LyXRCTags enum is handled. As you can see
2893 // there are no breaks at all. So it is just a huge fall-through.
2894 // The nice thing is that we will get a warning from the compiler
2895 // if we forget an element.
2896 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2898 case LyXRC::RC_LAST:
2899 case LyXRC::RC_ACCEPT_COMPOUND:
2900 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2901 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2902 case LyXRC::RC_ALT_LANG:
2903 case LyXRC::RC_PLAINTEXT_LINELEN:
2904 case LyXRC::RC_AUTOCORRECTION_MATH:
2905 case LyXRC::RC_AUTOREGIONDELETE:
2906 case LyXRC::RC_AUTORESET_OPTIONS:
2907 case LyXRC::RC_AUTOSAVE:
2908 case LyXRC::RC_AUTO_NUMBER:
2909 case LyXRC::RC_BACKUPDIR_PATH:
2910 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2911 case LyXRC::RC_BIBTEX_COMMAND:
2912 case LyXRC::RC_BINDFILE:
2913 case LyXRC::RC_CHECKLASTFILES:
2914 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2915 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2916 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2917 case LyXRC::RC_COMPLETION_INLINE_MATH:
2918 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2919 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2920 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2921 case LyXRC::RC_COMPLETION_POPUP_MATH:
2922 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2923 case LyXRC::RC_COMPLETION_MINLENGTH:
2924 case LyXRC::RC_USELASTFILEPOS:
2925 case LyXRC::RC_LOADSESSION:
2926 case LyXRC::RC_CHKTEX_COMMAND:
2927 case LyXRC::RC_CONVERTER:
2928 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2929 case LyXRC::RC_COPIER:
2930 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2931 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2932 case LyXRC::RC_DATE_INSERT_FORMAT:
2933 case LyXRC::RC_GUI_LANGUAGE:
2934 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2935 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2936 case LyXRC::RC_DEFFILE:
2937 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2938 case LyXRC::RC_DISPLAY_GRAPHICS:
2939 case LyXRC::RC_DOCUMENTPATH:
2940 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2941 FileName path(lyxrc_new.document_path);
2942 if (path.exists() && path.isDirectory())
2943 package().document_dir() = FileName(lyxrc.document_path);
2945 case LyXRC::RC_EDITOR_ALTERNATIVES:
2946 case LyXRC::RC_ESC_CHARS:
2947 case LyXRC::RC_EXAMPLEPATH:
2948 case LyXRC::RC_FONT_ENCODING:
2949 case LyXRC::RC_FILEFORMAT:
2950 case LyXRC::RC_GROUP_LAYOUTS:
2951 case LyXRC::RC_HUNSPELLDIR_PATH:
2952 case LyXRC::RC_ICON_SET:
2953 case LyXRC::RC_INDEX_ALTERNATIVES:
2954 case LyXRC::RC_INDEX_COMMAND:
2955 case LyXRC::RC_JBIBTEX_COMMAND:
2956 case LyXRC::RC_JINDEX_COMMAND:
2957 case LyXRC::RC_NOMENCL_COMMAND:
2958 case LyXRC::RC_INPUT:
2959 case LyXRC::RC_KBMAP:
2960 case LyXRC::RC_KBMAP_PRIMARY:
2961 case LyXRC::RC_KBMAP_SECONDARY:
2962 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2963 case LyXRC::RC_LANGUAGE_AUTO_END:
2964 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2965 case LyXRC::RC_LANGUAGE_COMMAND_END:
2966 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2967 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2968 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2969 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2970 case LyXRC::RC_LYXRCFORMAT:
2971 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2972 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2973 case LyXRC::RC_MACRO_EDIT_STYLE:
2974 case LyXRC::RC_MAKE_BACKUP:
2975 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2976 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2977 case LyXRC::RC_NUMLASTFILES:
2978 case LyXRC::RC_PARAGRAPH_MARKERS:
2979 case LyXRC::RC_PATH_PREFIX:
2980 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2981 prependEnvPath("PATH", lyxrc_new.path_prefix);
2982 // Resets python path
2983 support::os::python(true);
2985 case LyXRC::RC_PREVIEW:
2986 case LyXRC::RC_PREVIEW_HASHED_LABELS:
2987 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2988 case LyXRC::RC_PRINTCOLLCOPIESFLAG:
2989 case LyXRC::RC_PRINTCOPIESFLAG:
2990 case LyXRC::RC_PRINTER:
2991 case LyXRC::RC_PRINTEVENPAGEFLAG:
2992 case LyXRC::RC_PRINTEXSTRAOPTIONS:
2993 case LyXRC::RC_PRINTFILEEXTENSION:
2994 case LyXRC::RC_PRINTLANDSCAPEFLAG:
2995 case LyXRC::RC_PRINTODDPAGEFLAG:
2996 case LyXRC::RC_PRINTPAGERANGEFLAG:
2997 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2998 case LyXRC::RC_PRINTPAPERFLAG:
2999 case LyXRC::RC_PRINTREVERSEFLAG:
3000 case LyXRC::RC_PRINTSPOOL_COMMAND:
3001 case LyXRC::RC_PRINTSPOOL_PRINTERPREFIX:
3002 case LyXRC::RC_PRINTTOFILE:
3003 case LyXRC::RC_PRINTTOPRINTER:
3004 case LyXRC::RC_PRINT_ADAPTOUTPUT:
3005 case LyXRC::RC_PRINT_COMMAND:
3006 case LyXRC::RC_SAVE_COMPRESSED:
3007 case LyXRC::RC_SCREEN_DPI:
3008 case LyXRC::RC_SCREEN_FONT_ROMAN:
3009 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3010 case LyXRC::RC_SCREEN_FONT_SANS:
3011 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3012 case LyXRC::RC_SCREEN_FONT_SCALABLE:
3013 case LyXRC::RC_SCREEN_FONT_SIZES:
3014 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3015 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3016 case LyXRC::RC_GEOMETRY_SESSION:
3017 case LyXRC::RC_SCREEN_ZOOM:
3018 case LyXRC::RC_SERVERPIPE:
3019 case LyXRC::RC_SET_COLOR:
3020 case LyXRC::RC_SHOW_BANNER:
3021 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3022 case LyXRC::RC_SPELLCHECKER:
3023 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3025 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3026 case LyXRC::RC_SPELLCHECK_NOTES:
3027 case LyXRC::RC_SPLITINDEX_COMMAND:
3028 case LyXRC::RC_TEMPDIRPATH:
3029 case LyXRC::RC_TEMPLATEPATH:
3030 case LyXRC::RC_TEX_ALLOWS_SPACES:
3031 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3032 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3033 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3035 case LyXRC::RC_TEXINPUTS_PREFIX:
3036 case LyXRC::RC_THESAURUSDIRPATH:
3037 case LyXRC::RC_UIFILE:
3038 case LyXRC::RC_USER_EMAIL:
3039 case LyXRC::RC_USER_NAME:
3040 case LyXRC::RC_USE_CONVERTER_CACHE:
3041 case LyXRC::RC_USE_SYSTEM_COLORS:
3042 case LyXRC::RC_USE_TOOLTIP:
3043 case LyXRC::RC_USE_PIXMAP_CACHE:
3044 case LyXRC::RC_USE_QIMAGE:
3045 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3046 case LyXRC::RC_VIEWDVI_PAPEROPTION:
3047 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3048 case LyXRC::RC_SINGLE_INSTANCE:
3049 case LyXRC::RC_SORT_LAYOUTS:
3050 case LyXRC::RC_FULL_SCREEN_LIMIT:
3051 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3052 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3053 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3054 case LyXRC::RC_FULL_SCREEN_TABBAR:
3055 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3056 case LyXRC::RC_FULL_SCREEN_WIDTH:
3057 case LyXRC::RC_VISUAL_CURSOR:
3058 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3059 case LyXRC::RC_VIEWER:
3060 case LyXRC::RC_VIEWER_ALTERNATIVES:
3061 case LyXRC::RC_FORWARD_SEARCH_DVI:
3062 case LyXRC::RC_FORWARD_SEARCH_PDF:
3063 case LyXRC::RC_EXPORT_OVERWRITE:
3064 case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3065 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3066 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3067 case LyXRC::RC_CURSOR_WIDTH:
3074 string const LyXRC::getDescription(LyXRCTags tag)
3079 case RC_ACCEPT_COMPOUND:
3080 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3084 str = _("Specify an alternate language. The default is to use the language of the document.");
3087 case RC_PLAINTEXT_LINELEN:
3088 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.");
3091 case RC_AUTOREGIONDELETE:
3092 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3095 case RC_AUTORESET_OPTIONS:
3096 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3100 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3103 case RC_AUTO_NUMBER:
3106 case RC_BACKUPDIR_PATH:
3107 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.");
3110 case RC_BIBTEX_COMMAND:
3111 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3114 case RC_JBIBTEX_COMMAND:
3115 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3119 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3122 case RC_CHECKLASTFILES:
3123 str = _("Select to check whether the lastfiles still exist.");
3126 case RC_CHKTEX_COMMAND:
3127 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3136 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3137 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.");
3140 case RC_CURSOR_WIDTH:
3141 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3144 case RC_SCROLL_BELOW_DOCUMENT:
3145 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");
3148 case RC_MAC_DONTSWAP_CTRL_META:
3149 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3152 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3153 str = _("Use the Mac OS X conventions for cursor movement");
3156 case RC_SHOW_MACRO_LABEL:
3157 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3160 case RC_DATE_INSERT_FORMAT:
3161 //xgettext:no-c-format
3162 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
3166 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3169 case RC_DEFAULT_OTF_VIEW_FORMAT:
3170 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3173 case RC_DEFAULT_VIEW_FORMAT:
3174 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3177 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3178 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3181 case RC_DISPLAY_GRAPHICS:
3182 str = _("Select how LyX will display any graphics.");
3185 case RC_DOCUMENTPATH:
3186 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3190 str = _("Specify additional chars that can be part of a word.");
3193 case RC_EXAMPLEPATH:
3194 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3197 case RC_FONT_ENCODING:
3198 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
3204 case RC_INDEX_COMMAND:
3205 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\".");
3208 case RC_JINDEX_COMMAND:
3209 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3212 case RC_NOMENCL_COMMAND:
3213 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3220 case RC_KBMAP_PRIMARY:
3221 case RC_KBMAP_SECONDARY:
3222 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.");
3225 case RC_LANGUAGE_AUTO_BEGIN:
3226 str = _("Select if a language switching command is needed at the beginning of the document.");
3229 case RC_LANGUAGE_AUTO_END:
3230 str = _("Select if a language switching command is needed at the end of the document.");
3233 case RC_LANGUAGE_COMMAND_BEGIN:
3234 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.");
3237 case RC_LANGUAGE_COMMAND_END:
3238 str = _("The LaTeX command for changing back to the language of the document.");
3241 case RC_LANGUAGE_COMMAND_LOCAL:
3242 str = _("The LaTeX command for local changing of the language.");
3245 case RC_LANGUAGE_GLOBAL_OPTIONS:
3246 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3249 case RC_LANGUAGE_CUSTOM_PACKAGE:
3250 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3253 case RC_LANGUAGE_PACKAGE_SELECTION:
3254 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3257 case RC_USELASTFILEPOS:
3258 str = _("De-select if you do not want LyX to scroll to saved position.");
3261 case RC_LOADSESSION:
3262 str = _("De-select to prevent loading files opened from the last LyX session.");
3265 case RC_MAKE_BACKUP:
3266 str = _("De-select if you don't want LyX to create backup files.");
3269 case RC_MARK_FOREIGN_LANGUAGE:
3270 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3273 case RC_MOUSE_WHEEL_SPEED:
3274 str = bformat(_("The scrolling speed of the mouse wheel."),
3278 case RC_COMPLETION_POPUP_DELAY:
3279 str = _("The completion popup delay.");
3282 case RC_COMPLETION_POPUP_MATH:
3283 str = _("Select to display the completion popup in math mode.");
3286 case RC_COMPLETION_POPUP_TEXT:
3287 str = _("Select to display the completion popup in text mode.");
3290 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3291 str = _("Show the completion popup without delay after non-unique completion attempt.");
3294 case RC_COMPLETION_POPUP_TEXT:
3295 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3298 case RC_COMPLETION_POPUP_DELAY:
3299 str = _("The inline completion delay.");
3302 case RC_COMPLETION_INLINE_MATH:
3303 str = _("Select to display the inline completion in math mode.");
3306 case RC_COMPLETION_INLINE_TEXT:
3307 str = _("Select to display the inline completion in text mode.");
3310 case RC_COMPLETION_INLINE_DOTS:
3311 str = _("Use \"...\" to shorten long completions.");
3314 case RC_AUTOCORRECTION_MATH:
3315 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
3318 case RC_NUMLASTFILES:
3319 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3323 case RC_PATH_PREFIX:
3324 str = _("Specify those directories which should be "
3325 "prepended to the PATH environment variable.\n"
3326 "Use the OS native format.");
3330 str = _("Shows a typeset preview of things such as math");
3333 case RC_PREVIEW_HASHED_LABELS:
3334 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3337 case RC_PREVIEW_SCALE_FACTOR:
3338 str = _("Scale the preview size to suit.");
3341 case RC_PRINTCOLLCOPIESFLAG:
3342 str = _("The option for specifying whether the copies should be collated.");
3345 case RC_PRINTCOPIESFLAG:
3346 str = _("The option for specifying the number of copies to print.");
3350 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
3353 case RC_PRINTEVENPAGEFLAG:
3354 str = _("The option to print only even pages.");
3357 case RC_PRINTEXSTRAOPTIONS:
3358 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
3361 case RC_PRINTFILEEXTENSION:
3362 str = _("Extension of printer program output file. Usually \".ps\".");
3365 case RC_PRINTLANDSCAPEFLAG:
3366 str = _("The option to print out in landscape.");
3369 case RC_PRINTODDPAGEFLAG:
3370 str = _("The option to print only odd pages.");
3373 case RC_PRINTPAGERANGEFLAG:
3374 str = _("The option for specifying a comma-separated list of pages to print.");
3377 case RC_PRINTPAPERDIMENSIONFLAG:
3378 str = _("Option to specify the dimensions of the print paper.");
3381 case RC_PRINTPAPERFLAG:
3382 str = _("The option to specify paper type.");
3385 case RC_PRINTREVERSEFLAG:
3386 str = _("The option to reverse the order of the pages printed.");
3389 case RC_PRINTSPOOL_COMMAND:
3390 str = _("When set, this printer option automatically prints to a file and then calls a separate print spooling program on that file with the given name and arguments.");
3393 case RC_PRINTSPOOL_PRINTERPREFIX:
3394 str = _("If you specify a printer name in the print dialog, the following argument is prepended along with the printer name after the spool command.");
3397 case RC_PRINTTOFILE:
3398 str = _("Option to pass to the print program to print to a file.");
3401 case RC_PRINTTOPRINTER:
3402 str = _("Option to pass to the print program to print on a specific printer.");
3405 case RC_PRINT_ADAPTOUTPUT:
3406 str = _("Select for LyX to pass the name of the destination printer to your print command.");
3409 case RC_PRINT_COMMAND:
3410 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
3413 case RC_VISUAL_CURSOR:
3414 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3417 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3418 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).");
3422 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3425 case RC_SCREEN_FONT_ROMAN:
3426 case RC_SCREEN_FONT_SANS:
3427 case RC_SCREEN_FONT_TYPEWRITER:
3428 str = _("The screen fonts used to display the text while editing.");
3431 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3432 case RC_SCREEN_FONT_SANS_FOUNDRY:
3433 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3436 case RC_SCREEN_FONT_SCALABLE:
3437 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.");
3440 case RC_SCREEN_FONT_SIZES:
3441 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3444 case RC_SCREEN_ZOOM:
3445 //xgettext:no-c-format
3446 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3449 case RC_GEOMETRY_SESSION:
3450 str = _("Allow session manager to save and restore windows geometry.");
3454 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3460 case RC_SHOW_BANNER:
3461 str = _("De-select if you don't want the startup banner.");
3464 case RC_TEMPDIRPATH:
3465 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3468 case RC_THESAURUSDIRPATH:
3469 str = _("This is the place where the files of the thesaurus library reside.");
3472 case RC_TEMPLATEPATH:
3473 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3476 case RC_TEX_ALLOWS_SPACES:
3479 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3482 case RC_TEXINPUTS_PREFIX:
3483 str = _("Specify those directories which should be "
3484 "prepended to the TEXINPUTS environment variable.\n"
3485 "A '.' represents the current document directory. "
3486 "Use the OS native format.");
3490 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3499 case RC_USE_USE_SYSTEM_COLORS:
3500 str = _("Enable use the system colors for some things like main window background and selection.");
3503 case RC_USE_TOOLTIP:
3504 str = _("Enable the automatic appearance of tool tips in the work area.");
3507 case RC_USE_PIXMAP_CACHE:
3508 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3511 case RC_VIEWDVI_PAPEROPTION:
3512 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3527 // The global instance
3530 // The global copy of the system lyxrc entries (everything except preferences)