* qt_helpers.cpp:
[lyx.git] / src / LyXRC.cpp
blob00ac2179637007f2863ed88370c9ea4a30fea1a6
1 /**
2 * \file LyXRC.cpp
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
9 * \author John Levon
10 * \author André Pönitz
11 * \author Allan Rae
12 * \author Dekel Tsur
14 * Full author contact details are available in file CREDITS.
17 #include <config.h>
19 #include "LyXRC.h"
21 #include "ColorSet.h"
22 #include "Converter.h"
23 #include "FontEnums.h"
24 #include "Format.h"
25 #include "Lexer.h"
26 #include "Mover.h"
27 #include "Session.h"
28 #include "version.h"
30 #include "graphics/GraphicsTypes.h"
32 #include "support/convert.h"
33 #include "support/debug.h"
34 #include "support/environment.h"
35 #include "support/filetools.h"
36 #include "support/gettext.h"
37 #include "support/lstrings.h"
38 #include "support/os.h"
39 #include "support/userinfo.h"
41 #include <fstream>
42 #include <iostream>
44 using namespace std;
45 using namespace lyx::support;
47 namespace lyx {
49 namespace os = support::os;
51 namespace {
53 // when adding something to this array keep it sorted!
54 LexerKeyword lyxrcTags[] = {
55 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
56 { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
57 { "\\alternate_language", LyXRC::RC_ALT_LANG },
58 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
59 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
60 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
61 { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
62 { "\\autosave", LyXRC::RC_AUTOSAVE },
63 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
64 { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
65 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
66 { "\\bind_file", LyXRC::RC_BINDFILE },
67 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
68 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
69 { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
70 { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
71 { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
72 { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
73 { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
74 { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
75 { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
76 { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
77 { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
78 { "\\converter", LyXRC::RC_CONVERTER },
79 { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
80 { "\\copier", LyXRC::RC_COPIER },
81 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
82 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
83 { "\\def_file", LyXRC::RC_DEFFILE },
84 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
85 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
86 { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
87 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
88 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
89 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
90 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
91 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
92 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
93 { "\\format", LyXRC::RC_FORMAT },
94 { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
95 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
96 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
97 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
98 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
99 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
100 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
101 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
102 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
103 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
104 { "\\input", LyXRC::RC_INPUT },
105 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
106 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
107 { "\\kbmap", LyXRC::RC_KBMAP },
108 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
109 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
110 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
111 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
112 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
113 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
114 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
115 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
116 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
117 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
118 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
119 { "\\load_session", LyXRC::RC_LOADSESSION },
120 { "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT },
121 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
122 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
123 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
124 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
125 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
126 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
127 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
128 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
129 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
130 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
131 { "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
132 { "\\preview", LyXRC::RC_PREVIEW },
133 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
134 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
135 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
136 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
137 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
138 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
139 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
140 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
141 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
142 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
143 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
144 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
145 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
146 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
147 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
148 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
149 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
150 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
151 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
152 { "\\printer", LyXRC::RC_PRINTER },
153 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
154 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
155 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
156 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
157 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
158 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
159 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
160 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
161 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
162 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
163 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
164 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
165 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
166 { "\\set_color", LyXRC::RC_SET_COLOR },
167 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
168 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
169 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
170 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
171 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
172 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
173 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
174 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
175 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
176 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
177 { "\\ui_file", LyXRC::RC_UIFILE },
178 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
179 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
180 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
181 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
182 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
183 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
184 { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
185 // compatibility with versions older than 1.4.0 only
186 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
187 // compatibility with versions older than 1.4.0 only
188 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
189 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
190 { "\\user_email", LyXRC::RC_USER_EMAIL },
191 { "\\user_name", LyXRC::RC_USER_NAME },
192 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
193 // compatibility with versions older than 1.4.0 only
194 { "\\viewer", LyXRC::RC_VIEWER},
195 { "\\visual_cursor" ,LyXRC::RC_VISUAL_CURSOR}
198 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
200 } // namespace anon
203 LyXRC::LyXRC()
205 setDefaults();
209 void LyXRC::setDefaults()
211 bind_file = "cua";
212 def_file = "default";
213 ui_file = "default";
214 // Get printer from the environment. If fail, use default "",
215 // assuming that everything is set up correctly.
216 printer = getEnv("PRINTER");
217 print_adapt_output = false;
218 print_command = "dvips";
219 print_evenpage_flag = "-B";
220 print_oddpage_flag = "-A";
221 print_pagerange_flag = "-pp";
222 print_copies_flag = "-c";
223 print_collcopies_flag = "-C";
224 print_reverse_flag = "-r";
225 print_landscape_flag = "-t landscape";
226 print_to_printer = "-P";
227 print_to_file = "-o ";
228 print_file_extension = ".ps";
229 print_paper_flag = "-t";
230 print_paper_dimension_flag = "-T";
231 document_path.erase();
232 view_dvi_paper_option.erase();
233 default_papersize = PAPER_DEFAULT;
234 default_view_format = "pdf2";
235 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
236 bibtex_command = "bibtex";
237 fontenc = "default";
238 index_command = "makeindex -c -q";
239 nomencl_command = "makeindex -s nomencl.ist";
240 dpi = 75;
241 // Because a screen typically is wider than a piece of paper:
242 zoom = 150;
243 allow_geometry_session = true;
244 // Default LaTeX font size:
245 font_sizes[FONT_SIZE_TINY] = "5.0";
246 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
247 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
248 font_sizes[FONT_SIZE_SMALL] = "9.0";
249 font_sizes[FONT_SIZE_NORMAL] = "10.0";
250 font_sizes[FONT_SIZE_LARGE] = "12.0";
251 font_sizes[FONT_SIZE_LARGER] = "14.4";
252 font_sizes[FONT_SIZE_LARGEST] = "17.26";
253 font_sizes[FONT_SIZE_HUGE] = "20.74";
254 font_sizes[FONT_SIZE_HUGER] = "24.88";
255 use_scalable_fonts = true;
256 roman_font_name = "";
257 sans_font_name = "";
258 typewriter_font_name = "";
259 autosave = 300;
260 auto_region_delete = true;
261 auto_reset_options = false;
262 plaintext_linelen = 65;
263 mouse_wheel_speed = 1.0;
264 num_lastfiles = maxlastfiles;
265 check_lastfiles = true;
266 use_lastfilepos = true;
267 load_session = false;
268 make_backup = true;
269 backupdir_path.erase();
270 display_graphics = true;
271 // Spellchecker settings:
272 spellchecker_accept_compound = false;
273 spellcheck_continuously = false;
274 use_kbmap = false;
275 rtl_support = true;
276 visual_cursor = false;
277 auto_number = true;
278 mark_foreign_language = true;
279 language_auto_begin = true;
280 language_auto_end = true;
281 language_global_options = true;
282 language_use_babel = true;
283 language_package = "\\usepackage{babel}";
284 language_command_begin = "\\selectlanguage{$$lang}";
285 language_command_local = "\\foreignlanguage{$$lang}{";
286 sort_layouts = false;
287 group_layouts = true;
288 default_language = "english";
289 gui_language = "auto";
290 show_banner = true;
291 windows_style_tex_paths = false;
292 tex_allows_spaces = false;
293 date_insert_format = "%x";
294 cursor_follows_scrollbar = false;
295 scroll_below_document = false;
296 mac_like_word_movement = false;
297 macro_edit_style = MACRO_EDIT_INLINE_BOX;
298 dialogs_iconify_with_main = false;
299 label_init_length = 3;
300 preview = PREVIEW_OFF;
301 preview_hashed_labels = false;
302 preview_scale_factor = "0.9";
303 use_converter_cache = true;
304 use_tooltip = true;
305 use_pixmap_cache = false;
306 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
307 user_name = to_utf8(support::user_name());
308 user_email = to_utf8(support::user_email());
309 open_buffers_in_tabs = true;
311 // Fullscreen settings
312 full_screen_limit = false;
313 full_screen_toolbars = true;
314 full_screen_tabbar = true;
315 full_screen_menubar = true;
316 full_screen_scrollbar = true;
317 full_screen_width = 700;
319 completion_cursor_text = true;
320 completion_popup_math = true;
321 completion_popup_text = false;
322 completion_popup_delay = 2.0;
323 completion_popup_after_complete = true;
324 autocorrection_math = false;
325 completion_inline_math = true;
326 completion_inline_text = false;
327 completion_inline_dots = -1;
328 completion_inline_delay = 0.2;
332 namespace {
334 void oldFontFormat(string & family, string & foundry)
336 if (family.empty() || family[0] != '-')
337 return;
338 foundry = token(family, '-', 1);
339 family = token(family, '-', 2);
340 if (foundry == "*")
341 foundry.erase();
344 } // namespace anon
347 int LyXRC::read(FileName const & filename)
349 Lexer lexrc(lyxrcTags);
350 if (lyxerr.debugging(Debug::PARSER))
351 lexrc.printTable(lyxerr);
353 lexrc.setFile(filename);
354 if (!lexrc.isOK())
355 return -2;
357 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
359 return read(lexrc);
363 int LyXRC::read(istream & is)
365 Lexer lexrc(lyxrcTags);
366 if (lyxerr.debugging(Debug::PARSER))
367 lexrc.printTable(lyxerr);
369 lexrc.setStream(is);
370 if (!lexrc.isOK())
371 return -2;
373 LYXERR(Debug::LYXRC, "Reading istream...");
375 return read(lexrc);
379 int LyXRC::read(Lexer & lexrc)
381 if (!lexrc.isOK())
382 return -2;
384 while (lexrc.isOK()) {
385 // By using two switches we take advantage of the compiler
386 // telling us if we have missed a LyXRCTags element in
387 // the second switch.
388 // Note that this also shows a problem with Lexer since it
389 // helps us avoid taking advantage of the strictness of the
390 // compiler.
392 int le = lexrc.lex();
393 switch (le) {
394 case Lexer::LEX_UNDEF:
395 lexrc.printError("Unknown tag `$$Token'");
396 continue;
397 case Lexer::LEX_FEOF:
398 continue;
399 default:
400 break;
402 switch (static_cast<LyXRCTags>(le)) {
403 case RC_INPUT: // Include file
404 if (lexrc.next()) {
405 FileName const tmp =
406 libFileSearch(string(),
407 lexrc.getString());
408 if (read(tmp)) {
409 lexrc.printError("Error reading "
410 "included file: " + tmp.absFilename());
413 break;
414 case RC_BINDFILE:
415 if (lexrc.next())
416 bind_file = os::internal_path(lexrc.getString());
417 break;
419 case RC_DEFFILE:
420 if (lexrc.next())
421 def_file = os::internal_path(lexrc.getString());
422 break;
424 case RC_UIFILE:
425 if (lexrc.next())
426 ui_file = os::internal_path(lexrc.getString());
427 break;
429 case RC_AUTORESET_OPTIONS:
430 lexrc >> auto_reset_options;
431 break;
433 case RC_DISPLAY_GRAPHICS:
434 if (lexrc.next())
435 display_graphics = lexrc.getString() == "true";
436 break;
438 case RC_TEX_EXPECTS_WINDOWS_PATHS:
439 lexrc >> windows_style_tex_paths;
440 break;
442 case RC_TEX_ALLOWS_SPACES:
443 lexrc >> tex_allows_spaces;
444 break;
446 case RC_KBMAP:
447 lexrc >> use_kbmap;
448 break;
450 case RC_KBMAP_PRIMARY:
451 if (lexrc.next()) {
452 string const kmap(os::internal_path(lexrc.getString()));
453 if (!libFileSearch("kbd", kmap, "kmap").empty()
454 || kmap.empty()) {
455 primary_kbmap = kmap;
456 } else {
457 lexrc.printError("LyX: Keymap `$$Token' not found");
460 break;
462 case RC_KBMAP_SECONDARY:
463 if (lexrc.next()) {
464 string const kmap(os::internal_path(lexrc.getString()));
465 if (!libFileSearch("kbd", kmap, "kmap").empty()
466 || kmap.empty()) {
467 secondary_kbmap = kmap;
468 } else {
469 lexrc.printError("LyX: Keymap `$$Token' not found");
472 break;
474 case RC_FONT_ENCODING:
475 lexrc >> fontenc;
476 break;
478 case RC_PRINTER:
479 lexrc >> printer;
480 break;
482 case RC_PRINT_COMMAND:
483 if (lexrc.next(true)) {
484 print_command = lexrc.getString();
486 break;
488 case RC_PRINTEVENPAGEFLAG:
489 lexrc >> print_evenpage_flag;
490 break;
492 case RC_PRINTODDPAGEFLAG:
493 lexrc >> print_oddpage_flag;
494 break;
496 case RC_PRINTPAGERANGEFLAG:
497 lexrc >> print_pagerange_flag;
498 break;
500 case RC_PRINTCOPIESFLAG:
501 lexrc >> print_copies_flag;
502 break;
504 case RC_PRINTCOLLCOPIESFLAG:
505 lexrc >> print_collcopies_flag;
506 break;
508 case RC_PRINTREVERSEFLAG:
509 lexrc >> print_reverse_flag;
510 break;
512 case RC_PRINTLANDSCAPEFLAG:
513 lexrc >> print_landscape_flag;
514 break;
516 case RC_PRINTTOPRINTER:
517 lexrc >> print_to_printer;
518 break;
520 case RC_PRINT_ADAPTOUTPUT:
521 lexrc >> print_adapt_output;
522 break;
524 case RC_PRINTTOFILE:
525 if (lexrc.next()) {
526 print_to_file = os::internal_path(lexrc.getString());
528 break;
530 case RC_PRINTFILEEXTENSION:
531 lexrc >> print_file_extension;
532 break;
534 case RC_PRINTEXSTRAOPTIONS:
535 lexrc >> print_extra_options;
536 break;
538 case RC_PRINTSPOOL_COMMAND:
539 if (lexrc.next(true)) {
540 print_spool_command = lexrc.getString();
542 break;
544 case RC_PRINTSPOOL_PRINTERPREFIX:
545 lexrc >> print_spool_printerprefix;
546 break;
548 case RC_PRINTPAPERDIMENSIONFLAG:
549 lexrc >> print_paper_dimension_flag;
550 break;
552 case RC_PRINTPAPERFLAG:
553 lexrc >> print_paper_flag;
554 break;
556 case RC_DEFAULT_PAPERSIZE:
557 if (lexrc.next()) {
558 string const size = ascii_lowercase(lexrc.getString());
559 if (size == "usletter")
560 default_papersize = PAPER_USLETTER;
561 else if (size == "legal")
562 default_papersize = PAPER_USLEGAL;
563 else if (size == "executive")
564 default_papersize = PAPER_USEXECUTIVE;
565 else if (size == "a3")
566 default_papersize = PAPER_A3;
567 else if (size == "a4")
568 default_papersize = PAPER_A4;
569 else if (size == "a5")
570 default_papersize = PAPER_A5;
571 else if (size == "b5")
572 default_papersize = PAPER_B5;
573 else if (size == "default")
574 default_papersize = PAPER_DEFAULT;
576 break;
578 case RC_VIEWDVI_PAPEROPTION:
579 if (lexrc.next())
580 view_dvi_paper_option = lexrc.getString();
581 else
582 view_dvi_paper_option.erase();
583 break;
585 case RC_CHKTEX_COMMAND:
586 if (lexrc.next(true)) {
587 chktex_command = lexrc.getString();
589 break;
591 case RC_BIBTEX_ALTERNATIVES:
592 if (lexrc.next(true)) {
593 bibtex_alternatives.insert(lexrc.getString());
595 break;
597 case RC_BIBTEX_COMMAND:
598 if (lexrc.next(true)) {
599 bibtex_command = lexrc.getString();
601 break;
603 case RC_JBIBTEX_COMMAND:
604 if (lexrc.next(true)) {
605 jbibtex_command = lexrc.getString();
607 break;
609 case RC_INDEX_ALTERNATIVES:
610 if (lexrc.next(true)) {
611 index_alternatives.insert(lexrc.getString());
613 break;
615 case RC_INDEX_COMMAND:
616 if (lexrc.next(true)) {
617 index_command = lexrc.getString();
619 break;
621 case RC_JINDEX_COMMAND:
622 if (lexrc.next(true)) {
623 jindex_command = lexrc.getString();
625 break;
627 case RC_SPLITINDEX_COMMAND:
628 if (lexrc.next(true)) {
629 splitindex_command = lexrc.getString();
631 break;
633 case RC_NOMENCL_COMMAND:
634 if (lexrc.next(true)) {
635 nomencl_command = lexrc.getString();
637 break;
639 case RC_SCREEN_DPI:
640 lexrc >> dpi;
641 break;
643 case RC_SCREEN_ZOOM:
644 lexrc >> zoom;
645 break;
647 case RC_GEOMETRY_SESSION:
648 lexrc >> allow_geometry_session;
649 break;
651 case RC_SCREEN_FONT_SIZES:
652 lexrc >> font_sizes[FONT_SIZE_TINY];
653 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
654 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
655 lexrc >> font_sizes[FONT_SIZE_SMALL];
656 lexrc >> font_sizes[FONT_SIZE_NORMAL];
657 lexrc >> font_sizes[FONT_SIZE_LARGE];
658 lexrc >> font_sizes[FONT_SIZE_LARGER];
659 lexrc >> font_sizes[FONT_SIZE_LARGEST];
660 lexrc >> font_sizes[FONT_SIZE_HUGE];
661 lexrc >> font_sizes[FONT_SIZE_HUGER];
662 break;
664 case RC_SCREEN_FONT_SCALABLE:
665 lexrc >> use_scalable_fonts;
666 break;
668 case RC_AUTOSAVE:
669 lexrc >> autosave;
670 break;
672 case RC_DOCUMENTPATH:
673 if (lexrc.next()) {
674 document_path = os::internal_path(lexrc.getString());
675 document_path = expandPath(document_path);
677 break;
679 case RC_EXAMPLEPATH:
680 if (lexrc.next()) {
681 example_path = os::internal_path(lexrc.getString());
682 example_path = expandPath(example_path);
684 break;
686 case RC_TEMPLATEPATH:
687 if (lexrc.next()) {
688 template_path = os::internal_path(lexrc.getString());
689 template_path = expandPath(template_path);
691 break;
693 case RC_TEMPDIRPATH:
694 if (lexrc.next()) {
695 tempdir_path = os::internal_path(lexrc.getString());
696 tempdir_path = expandPath(tempdir_path);
698 break;
700 case RC_THESAURUSDIRPATH:
701 if (lexrc.next()) {
702 thesaurusdir_path = os::internal_path(lexrc.getString());
703 thesaurusdir_path = expandPath(thesaurusdir_path);
705 break;
707 case RC_USELASTFILEPOS:
708 lexrc >> use_lastfilepos;
709 break;
711 case RC_LOADSESSION:
712 lexrc >> load_session;
713 break;
715 case RC_MOUSE_WHEEL_SPEED:
716 lexrc >> mouse_wheel_speed;
717 break;
719 case RC_COMPLETION_INLINE_DELAY:
720 lexrc >> completion_inline_delay;
721 break;
723 case RC_COMPLETION_INLINE_MATH:
724 lexrc >> completion_inline_math;
725 break;
727 case RC_COMPLETION_INLINE_TEXT:
728 lexrc >> completion_inline_text;
729 break;
731 case RC_COMPLETION_INLINE_DOTS:
732 lexrc >> completion_inline_dots;
733 break;
735 case RC_AUTOCORRECTION_MATH:
736 lexrc >> autocorrection_math;
737 break;
739 case RC_COMPLETION_POPUP_DELAY:
740 lexrc >> completion_popup_delay;
741 break;
743 case RC_COMPLETION_POPUP_MATH:
744 lexrc >> completion_popup_math;
745 break;
747 case RC_COMPLETION_POPUP_TEXT:
748 lexrc >> completion_popup_text;
749 break;
751 case RC_COMPLETION_CURSOR_TEXT:
752 lexrc >> completion_cursor_text;
753 break;
755 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
756 lexrc >> completion_popup_after_complete;
757 break;
759 case RC_NUMLASTFILES:
760 lexrc >> num_lastfiles;
761 break;
763 case RC_CHECKLASTFILES:
764 lexrc >> check_lastfiles;
765 break;
767 case RC_SCREEN_FONT_ROMAN:
768 if (lexrc.next()) {
769 roman_font_name = lexrc.getString();
770 oldFontFormat(roman_font_name,
771 roman_font_foundry);
773 break;
775 case RC_SCREEN_FONT_SANS:
776 if (lexrc.next()) {
777 sans_font_name = lexrc.getString();
778 oldFontFormat(sans_font_name, sans_font_foundry);
780 break;
782 case RC_SCREEN_FONT_TYPEWRITER:
783 if (lexrc.next()) {
784 typewriter_font_name = lexrc.getString();
785 oldFontFormat(typewriter_font_name,
786 typewriter_font_foundry);
788 break;
790 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
791 lexrc >> roman_font_foundry;
792 break;
794 case RC_SCREEN_FONT_SANS_FOUNDRY:
795 lexrc >> sans_font_foundry;
796 break;
798 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
799 lexrc >> typewriter_font_foundry;
800 break;
802 case RC_SET_COLOR: {
803 if (!lexrc.next()) {
804 lexrc.printError("Missing color tag.");
805 break;
807 string lyx_name = lexrc.getString();
809 if (!lexrc.next()) {
810 lexrc.printError("Missing color name for color: `$$Token'");
811 break;
813 string x11_name = lexrc.getString();
815 ColorCode const col =
816 lcolor.getFromLyXName(lyx_name);
817 if (col == Color_none ||
818 col == Color_inherit ||
819 col == Color_ignore)
820 break;
822 if (!lcolor.setColor(col, x11_name))
823 LYXERR0("Bad lyxrc set_color for " << lyx_name);
824 break;
827 case RC_AUTOREGIONDELETE:
828 // Auto region delete defaults to true
829 lexrc >> auto_region_delete;
830 break;
832 case RC_SERVERPIPE:
833 if (lexrc.next()) {
834 lyxpipes = os::internal_path(lexrc.getString());
835 lyxpipes = expandPath(lyxpipes);
837 break;
839 case RC_CURSOR_FOLLOWS_SCROLLBAR:
840 lexrc >> cursor_follows_scrollbar;
841 break;
843 case RC_SCROLL_BELOW_DOCUMENT:
844 lexrc >> scroll_below_document;
845 break;
847 case RC_MAC_LIKE_WORD_MOVEMENT:
848 lexrc >> mac_like_word_movement;
849 break;
851 case RC_MACRO_EDIT_STYLE:
852 if (lexrc.next()) {
853 switch (lexrc.getInteger()) {
854 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
855 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
856 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
859 break;
861 case RC_DIALOGS_ICONIFY_WITH_MAIN:
862 lexrc >> dialogs_iconify_with_main;
863 break;
865 case RC_PLAINTEXT_LINELEN:
866 lexrc >> plaintext_linelen;
867 break;
868 // Spellchecker settings:
869 case RC_ACCEPT_COMPOUND:
870 lexrc >> spellchecker_accept_compound;
871 break;
872 case RC_USE_TOOLTIP:
873 lexrc >> use_tooltip;
874 break;
875 case RC_USE_PIXMAP_CACHE:
876 lexrc >> use_pixmap_cache;
877 break;
878 case RC_ALT_LANG:
879 lexrc >> spellchecker_alt_lang;
880 break;
881 case RC_ESC_CHARS:
882 lexrc >> spellchecker_esc_chars;
883 break;
884 case RC_SPELLCHECK_CONTINUOUSLY:
885 lexrc >> spellcheck_continuously;
886 break;
887 case RC_MAKE_BACKUP:
888 lexrc >> make_backup;
889 break;
890 case RC_BACKUPDIR_PATH:
891 if (lexrc.next()) {
892 backupdir_path = os::internal_path(lexrc.getString());
893 backupdir_path = expandPath(backupdir_path);
895 break;
896 case RC_DATE_INSERT_FORMAT:
897 lexrc >> date_insert_format;
898 break;
899 case RC_LANGUAGE_PACKAGE:
900 lexrc >> language_package;
901 break;
902 case RC_LANGUAGE_AUTO_BEGIN:
903 lexrc >> language_auto_begin;
904 break;
905 case RC_LANGUAGE_AUTO_END:
906 lexrc >> language_auto_end;
907 break;
908 case RC_LANGUAGE_GLOBAL_OPTIONS:
909 lexrc >> language_global_options;
910 break;
911 case RC_LANGUAGE_USE_BABEL:
912 lexrc >> language_use_babel;
913 break;
914 case RC_LANGUAGE_COMMAND_BEGIN:
915 lexrc >> language_command_begin;
916 break;
917 case RC_LANGUAGE_COMMAND_END:
918 lexrc >> language_command_end;
919 break;
920 case RC_LANGUAGE_COMMAND_LOCAL:
921 lexrc >> language_command_local;
922 break;
923 case RC_RTL_SUPPORT:
924 lexrc >> rtl_support;
925 break;
926 case RC_VISUAL_CURSOR:
927 lexrc >> visual_cursor;
928 break;
929 case RC_AUTO_NUMBER:
930 lexrc >> auto_number;
931 break;
932 case RC_MARK_FOREIGN_LANGUAGE:
933 lexrc >> mark_foreign_language;
934 break;
936 case RC_COPIER: {
937 string fmt, command;
938 if (lexrc.next())
939 fmt = lexrc.getString();
940 if (lexrc.next(true))
941 command = lexrc.getString();
942 setMover(fmt, command);
943 break;
946 case RC_CONVERTER: {
947 string from, to, command, flags;
948 if (lexrc.next())
949 from = lexrc.getString();
950 if (lexrc.next())
951 to = lexrc.getString();
952 if (lexrc.next(true))
953 command = lexrc.getString();
954 if (lexrc.next())
955 flags = lexrc.getString();
956 if (command.empty())
957 theConverters().erase(from, to);
958 else
959 theConverters().add(from, to, command, flags);
960 break;
962 // compatibility with versions older than 1.4.0 only
963 case RC_VIEWER: {
964 string format, command;
965 lexrc >> format >> command;
966 formats.setViewer(format, command);
967 break;
969 case RC_FORMAT: {
970 string format, extension, prettyname, shortcut;
971 lexrc >> format >> extension >> prettyname >> shortcut;
972 string viewer, editor;
973 if (lexrc.next(true))
974 viewer = lexrc.getString();
975 if (lexrc.next(true))
976 editor = lexrc.getString();
977 string flags;
978 // Hack to ensure compatibility with versions older
979 // than 1.5.0
980 int le = lexrc.lex();
981 if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
982 flags = lexrc.getString();
983 if (le != Lexer::LEX_DATA) {
984 // We have got a known token.
985 // Therefore this is an old style
986 // format definition without
987 // flags.
988 lexrc.pushToken(flags);
989 flags.erase();
992 int flgs = Format::none;
993 while (!flags.empty()) {
994 string flag;
995 flags = split(flags, flag, ',');
996 if (flag == "document")
997 flgs |= Format::document;
998 else if (flag == "vector")
999 flgs |= Format::vector;
1000 else
1001 LYXERR0("Ignoring unknown flag `"
1002 << flag << "' for format `"
1003 << format << "'.");
1005 if (prettyname.empty()) {
1006 if (theConverters().formatIsUsed(format))
1007 LYXERR0("Can't delete format " << format);
1008 else
1009 formats.erase(format);
1010 } else {
1011 formats.add(format, extension, prettyname,
1012 shortcut, viewer, editor, flgs);
1014 break;
1016 case RC_DEFAULT_VIEW_FORMAT:
1017 lexrc >> default_view_format;
1018 break;
1020 case RC_DEFAULT_LANGUAGE:
1021 lexrc >> default_language;
1022 break;
1024 case RC_GUI_LANGUAGE:
1025 lexrc >> gui_language;
1026 break;
1028 case RC_LABEL_INIT_LENGTH:
1029 lexrc >> label_init_length;
1030 break;
1032 case RC_SHOW_BANNER:
1033 lexrc >> show_banner;
1034 break;
1036 case RC_PREVIEW:
1037 if (lexrc.next()) {
1038 string const tmp = lexrc.getString();
1039 if (tmp == "true" || tmp == "on")
1040 preview = PREVIEW_ON;
1041 else if (tmp == "no_math")
1042 preview = PREVIEW_NO_MATH;
1043 else {
1044 preview = PREVIEW_OFF;
1045 if (tmp != "false" && tmp != "off")
1046 LYXERR0("Unrecognized preview status \""
1047 << tmp << '\n');
1050 break;
1052 case RC_PREVIEW_HASHED_LABELS:
1053 lexrc >> preview_hashed_labels;
1054 break;
1056 case RC_PREVIEW_SCALE_FACTOR:
1057 lexrc >> preview_scale_factor;
1058 break;
1060 case RC_USER_NAME:
1061 lexrc >> user_name;
1062 break;
1063 case RC_USER_EMAIL:
1064 lexrc >> user_email;
1065 break;
1067 case RC_PATH_PREFIX:
1068 lexrc >> path_prefix;
1069 break;
1071 case RC_USE_CONVERTER_CACHE:
1072 lexrc >> use_converter_cache;
1073 break;
1074 case RC_CONVERTER_CACHE_MAXAGE:
1075 lexrc >> converter_cache_maxage;
1076 break;
1078 case RC_SORT_LAYOUTS:
1079 lexrc >> sort_layouts;
1080 break;
1081 case RC_GROUP_LAYOUTS:
1082 lexrc >> group_layouts;
1083 break;
1084 case RC_FULL_SCREEN_LIMIT:
1085 lexrc >> full_screen_limit;
1086 break;
1087 case RC_FULL_SCREEN_TOOLBARS:
1088 lexrc >> full_screen_toolbars;
1089 break;
1090 case RC_FULL_SCREEN_SCROLLBAR:
1091 lexrc >> full_screen_scrollbar;
1092 break;
1093 case RC_FULL_SCREEN_TABBAR:
1094 lexrc >> full_screen_tabbar;
1095 break;
1096 case RC_FULL_SCREEN_MENUBAR:
1097 lexrc >> full_screen_menubar;
1098 break;
1099 case RC_FULL_SCREEN_WIDTH:
1100 lexrc >> full_screen_width;
1101 break;
1102 case RC_OPEN_BUFFERS_IN_TABS:
1103 lexrc >> open_buffers_in_tabs;
1104 break;
1106 // Obsoteted in 1.4.0
1107 case RC_USETEMPDIR:
1108 // Obsoleted in 2.0
1109 case RC_SPELL_COMMAND:
1110 case RC_PERS_DICT:
1111 case RC_PLAINTEXT_ROFF_COMMAND:
1112 case RC_USE_ALT_LANG:
1113 case RC_USE_ESC_CHARS:
1114 case RC_USE_INP_ENC:
1115 case RC_USE_PERS_DICT:
1116 case RC_USE_SPELL_LIB:
1117 LYXERR(Debug::LYXRC, "Skipping obsolete tag `"
1118 << lexrc.getString() << "'.");
1119 lexrc.next(true);
1120 break;
1122 case RC_LAST:
1123 break; // this is just a dummy
1127 /// Update converters data-structures
1128 theConverters().update(formats);
1129 theConverters().buildGraph();
1131 return 0;
1135 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1137 ofstream ofs(filename.toFilesystemEncoding().c_str());
1138 if (ofs)
1139 write(ofs, ignore_system_lyxrc);
1143 void LyXRC::print() const
1145 if (lyxerr.debugging())
1146 write(lyxerr, false);
1147 else
1148 write(cout, false);
1152 class SameMover {
1153 public:
1154 typedef pair<string, SpecialisedMover> Data;
1156 SameMover(Data const & comparison)
1157 : comparison_(comparison) {}
1159 bool operator()(Data const & data) const
1161 return data.first == comparison_.first &&
1162 data.second.command() == comparison_.second.command();
1165 private:
1166 Data comparison_;
1170 namespace {
1172 // Escape \ and " so that LyXLex can read the string later
1173 string escapeCommand(string const & str) {
1174 return subst(subst(str , "\\", "\\\\"),
1175 "\"", "\\\"");
1181 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1183 LyXRCTags tag = RC_LAST;
1185 if (!name.empty()) {
1186 for (int i = 0; i != lyxrcCount; ++i)
1187 if ("\\" + name == lyxrcTags[i].tag)
1188 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1191 if (tag == RC_LAST)
1192 os << "# LyX " << lyx_version
1193 << " generated this file. If you want to make your own\n"
1194 << "# modifications you should do them from inside LyX and save.\n"
1195 << "\n";
1197 // Why the switch you might ask. It is a trick to ensure that all
1198 // the elements in the LyXRCTags enum are handled. As you can see
1199 // there are no breaks at all. So it is just a huge fall-through.
1200 // The nice thing is that we will get a warning from the compiler
1201 // if we forget an element.
1202 switch (tag) {
1203 case RC_LAST:
1204 case RC_INPUT:
1205 // input/include files are not done here
1206 case RC_BINDFILE:
1207 if (ignore_system_lyxrc ||
1208 bind_file != system_lyxrc.bind_file) {
1209 string const path = os::external_path(bind_file);
1210 os << "\\bind_file \"" << path << "\"\n";
1212 if (tag != RC_LAST)
1213 break;
1215 case RC_DEFFILE:
1216 if (ignore_system_lyxrc ||
1217 def_file != system_lyxrc.def_file) {
1218 string const path = os::external_path(def_file);
1219 os << "\\def_file \"" << path << "\"\n";
1221 if (tag != RC_LAST)
1222 break;
1225 // Misc Section
1227 os << "\n#\n"
1228 << "# MISC SECTION ######################################\n"
1229 << "#\n\n";
1230 // bind files are not done here.
1232 case RC_PATH_PREFIX:
1233 if (ignore_system_lyxrc ||
1234 path_prefix != system_lyxrc.path_prefix) {
1235 os << "\\path_prefix \"" << path_prefix << "\"\n";
1237 if (tag != RC_LAST)
1238 break;
1239 case RC_UIFILE:
1240 if (ignore_system_lyxrc ||
1241 ui_file != system_lyxrc.ui_file) {
1242 string const path = os::external_path(ui_file);
1243 os << "\\ui_file \"" << path << "\"\n";
1245 if (tag != RC_LAST)
1246 break;
1247 case RC_AUTOREGIONDELETE:
1248 if (ignore_system_lyxrc ||
1249 auto_region_delete != system_lyxrc.auto_region_delete) {
1250 os << "# Set to false to inhibit automatic replacement of\n"
1251 << "# the current selection.\n"
1252 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1253 << '\n';
1255 if (tag != RC_LAST)
1256 break;
1257 case RC_AUTORESET_OPTIONS:
1258 if (ignore_system_lyxrc ||
1259 auto_reset_options != system_lyxrc.auto_reset_options) {
1260 os << "# Set to false to inhibit automatic reset of\n"
1261 << "# the class options to defaults on class change.\n"
1262 << "\\auto_reset_options "
1263 << convert<string>(auto_reset_options)
1264 << '\n';
1266 if (tag != RC_LAST)
1267 break;
1268 case RC_AUTOSAVE:
1269 if (ignore_system_lyxrc ||
1270 autosave != system_lyxrc.autosave) {
1271 os << "# The time interval between auto-saves in seconds.\n"
1272 << "\\autosave " << autosave << '\n';
1274 if (tag != RC_LAST)
1275 break;
1276 case RC_DISPLAY_GRAPHICS:
1277 if (ignore_system_lyxrc ||
1278 display_graphics != system_lyxrc.display_graphics) {
1279 os << "# Display graphics within LyX\n"
1280 << "# true|false\n"
1281 << "\\display_graphics "
1282 << (display_graphics ? "true" : "false")
1283 << '\n';
1285 if (tag != RC_LAST)
1286 break;
1287 case RC_SORT_LAYOUTS:
1288 if (ignore_system_lyxrc ||
1289 sort_layouts != system_lyxrc.sort_layouts) {
1290 os << "# Sort layouts alphabetically.\n"
1291 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1293 if (tag != RC_LAST)
1294 break;
1295 case RC_GROUP_LAYOUTS:
1296 if (ignore_system_lyxrc ||
1297 group_layouts != system_lyxrc.group_layouts) {
1298 os << "# Group layouts by their category.\n"
1299 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1301 if (tag != RC_LAST)
1302 break;
1303 case RC_VIEWDVI_PAPEROPTION:
1304 if (ignore_system_lyxrc ||
1305 view_dvi_paper_option
1306 != system_lyxrc.view_dvi_paper_option) {
1307 os << "# Options used to specify paper size to the\n"
1308 << "# view_dvi_command (e.g. -paper)\n"
1309 << "\\view_dvi_paper_option \""
1310 << view_dvi_paper_option << "\"\n";
1312 if (tag != RC_LAST)
1313 break;
1314 case RC_DEFAULT_PAPERSIZE:
1315 if (ignore_system_lyxrc ||
1316 default_papersize != system_lyxrc.default_papersize) {
1317 os << "# The default papersize to use.\n"
1318 << "\\default_papersize \"";
1319 switch (default_papersize) {
1320 case PAPER_DEFAULT:
1321 os << "default"; break;
1322 case PAPER_USLETTER:
1323 os << "usletter"; break;
1324 case PAPER_USLEGAL:
1325 os << "legal"; break;
1326 case PAPER_USEXECUTIVE:
1327 os << "executive"; break;
1328 case PAPER_A3:
1329 os << "a3"; break;
1330 case PAPER_A4:
1331 os << "a4"; break;
1332 case PAPER_A5:
1333 os << "a5"; break;
1334 case PAPER_B5:
1335 os << "b5"; break;
1336 case PAPER_CUSTOM:
1337 case PAPER_B3:
1338 case PAPER_B4: break;
1340 os << "\"\n";
1342 if (tag != RC_LAST)
1343 break;
1344 case RC_CHKTEX_COMMAND:
1345 if (ignore_system_lyxrc ||
1346 chktex_command != system_lyxrc.chktex_command) {
1347 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1349 if (tag != RC_LAST)
1350 break;
1351 case RC_BIBTEX_ALTERNATIVES: {
1352 set<string>::const_iterator it = bibtex_alternatives.begin();
1353 set<string>::const_iterator end = bibtex_alternatives.end();
1354 for ( ; it != end; ++it) {
1355 if (ignore_system_lyxrc
1356 || !system_lyxrc.bibtex_alternatives.count(*it))
1357 os << "\\bibtex_alternatives \""
1358 << *it << "\"\n";
1360 if (tag != RC_LAST)
1361 break;
1363 case RC_BIBTEX_COMMAND:
1364 if (ignore_system_lyxrc ||
1365 bibtex_command != system_lyxrc.bibtex_command) {
1366 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1368 if (tag != RC_LAST)
1369 break;
1370 case RC_JBIBTEX_COMMAND:
1371 if (ignore_system_lyxrc ||
1372 jbibtex_command != system_lyxrc.jbibtex_command) {
1373 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1375 if (tag != RC_LAST)
1376 break;
1377 case RC_INDEX_ALTERNATIVES: {
1378 set<string>::const_iterator it = index_alternatives.begin();
1379 set<string>::const_iterator end = index_alternatives.end();
1380 for ( ; it != end; ++it) {
1381 if (ignore_system_lyxrc
1382 || !system_lyxrc.index_alternatives.count(*it))
1383 os << "\\index_alternatives \""
1384 << *it << "\"\n";
1386 if (tag != RC_LAST)
1387 break;
1389 case RC_INDEX_COMMAND:
1390 if (ignore_system_lyxrc ||
1391 index_command != system_lyxrc.index_command) {
1392 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1394 if (tag != RC_LAST)
1395 break;
1396 case RC_JINDEX_COMMAND:
1397 if (ignore_system_lyxrc ||
1398 jindex_command != system_lyxrc.jindex_command) {
1399 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1401 if (tag != RC_LAST)
1402 break;
1403 case RC_SPLITINDEX_COMMAND:
1404 if (ignore_system_lyxrc ||
1405 splitindex_command != system_lyxrc.splitindex_command) {
1406 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1408 if (tag != RC_LAST)
1409 break;
1410 case RC_NOMENCL_COMMAND:
1411 if (ignore_system_lyxrc ||
1412 nomencl_command != system_lyxrc.nomencl_command) {
1413 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1415 if (tag != RC_LAST)
1416 break;
1417 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1418 if (ignore_system_lyxrc ||
1419 windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1420 os << "\\tex_expects_windows_paths "
1421 << convert<string>(windows_style_tex_paths) << '\n';
1423 if (tag != RC_LAST)
1424 break;
1425 case RC_TEX_ALLOWS_SPACES:
1426 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1427 os << "\\tex_allows_spaces "
1428 << convert<string>(tex_allows_spaces) << '\n';
1430 if (tag != RC_LAST)
1431 break;
1432 case RC_KBMAP:
1433 if (ignore_system_lyxrc ||
1434 use_kbmap != system_lyxrc.use_kbmap) {
1435 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1437 if (tag != RC_LAST)
1438 break;
1439 case RC_KBMAP_PRIMARY:
1440 if (ignore_system_lyxrc ||
1441 primary_kbmap != system_lyxrc.primary_kbmap) {
1442 string const path = os::external_path(primary_kbmap);
1443 os << "\\kbmap_primary \"" << path << "\"\n";
1445 if (tag != RC_LAST)
1446 break;
1447 case RC_KBMAP_SECONDARY:
1448 if (ignore_system_lyxrc ||
1449 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1450 string const path = os::external_path(secondary_kbmap);
1451 os << "\\kbmap_secondary \"" << path << "\"\n";
1453 if (tag != RC_LAST)
1454 break;
1455 case RC_SERVERPIPE:
1456 if (ignore_system_lyxrc ||
1457 lyxpipes != system_lyxrc.lyxpipes) {
1458 string const path = os::external_path(lyxpipes);
1459 os << "\\serverpipe \"" << path << "\"\n";
1461 if (tag != RC_LAST)
1462 break;
1463 case RC_DATE_INSERT_FORMAT:
1464 if (ignore_system_lyxrc ||
1465 date_insert_format != system_lyxrc.date_insert_format) {
1466 os << "\\date_insert_format \"" << date_insert_format
1467 << "\"\n";
1469 if (tag != RC_LAST)
1470 break;
1471 case RC_LABEL_INIT_LENGTH:
1472 if (ignore_system_lyxrc ||
1473 label_init_length != system_lyxrc.label_init_length) {
1474 os << "\\label_init_length " << label_init_length
1475 << '\n';
1477 if (tag != RC_LAST)
1478 break;
1480 case RC_USER_NAME:
1481 os << "\\user_name \"" << user_name << "\"\n";
1482 if (tag != RC_LAST)
1483 break;
1485 case RC_USER_EMAIL:
1486 os << "\\user_email \"" << user_email << "\"\n";
1487 if (tag != RC_LAST)
1488 break;
1490 case RC_SHOW_BANNER:
1491 if (ignore_system_lyxrc ||
1492 show_banner != system_lyxrc.show_banner) {
1493 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1495 if (tag != RC_LAST)
1496 break;
1498 case RC_PREVIEW:
1499 if (ignore_system_lyxrc ||
1500 preview != system_lyxrc.preview) {
1501 string status;
1502 switch (preview) {
1503 case PREVIEW_ON:
1504 status = "on";
1505 break;
1506 case PREVIEW_NO_MATH:
1507 status = "no_math";
1508 break;
1509 case PREVIEW_OFF:
1510 status = "off";
1511 break;
1513 os << "\\preview " << status << '\n';
1515 if (tag != RC_LAST)
1516 break;
1518 case RC_PREVIEW_HASHED_LABELS:
1519 if (ignore_system_lyxrc ||
1520 preview_hashed_labels !=
1521 system_lyxrc.preview_hashed_labels) {
1522 os << "\\preview_hashed_labels "
1523 << convert<string>(preview_hashed_labels) << '\n';
1525 if (tag != RC_LAST)
1526 break;
1528 case RC_PREVIEW_SCALE_FACTOR:
1529 if (ignore_system_lyxrc ||
1530 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1531 os << "\\preview_scale_factor "
1532 << preview_scale_factor << '\n';
1534 if (tag != RC_LAST)
1535 break;
1537 case RC_USE_CONVERTER_CACHE:
1538 if (ignore_system_lyxrc ||
1539 use_converter_cache != system_lyxrc.use_converter_cache) {
1540 os << "\\use_converter_cache "
1541 << convert<string>(use_converter_cache) << '\n';
1543 if (tag != RC_LAST)
1544 break;
1546 case RC_CONVERTER_CACHE_MAXAGE:
1547 if (ignore_system_lyxrc ||
1548 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1549 os << "\\converter_cache_maxage "
1550 << converter_cache_maxage << '\n';
1552 if (tag != RC_LAST)
1553 break;
1555 os << "\n#\n"
1556 << "# SCREEN & FONTS SECTION ############################\n"
1557 << "#\n\n";
1559 case RC_SCREEN_DPI:
1560 if (ignore_system_lyxrc ||
1561 dpi != system_lyxrc.dpi) {
1562 os << "\\screen_dpi " << dpi << '\n';
1564 if (tag != RC_LAST)
1565 break;
1566 case RC_SCREEN_ZOOM:
1567 if (ignore_system_lyxrc ||
1568 zoom != system_lyxrc.zoom) {
1569 os << "\\screen_zoom " << zoom << '\n';
1571 if (tag != RC_LAST)
1572 break;
1573 case RC_GEOMETRY_SESSION:
1574 if (ignore_system_lyxrc ||
1575 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1576 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1577 << '\n';
1579 if (tag != RC_LAST)
1580 break;
1581 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1582 if (ignore_system_lyxrc ||
1583 cursor_follows_scrollbar
1584 != system_lyxrc.cursor_follows_scrollbar) {
1585 os << "\\cursor_follows_scrollbar "
1586 << convert<string>(cursor_follows_scrollbar) << '\n';
1588 if (tag != RC_LAST)
1589 break;
1590 case RC_SCROLL_BELOW_DOCUMENT:
1591 if (ignore_system_lyxrc ||
1592 scroll_below_document
1593 != system_lyxrc.scroll_below_document) {
1594 os << "\\scroll_below_document "
1595 << convert<string>(scroll_below_document) << '\n';
1597 if (tag != RC_LAST)
1598 break;
1599 case RC_MAC_LIKE_WORD_MOVEMENT:
1600 if (ignore_system_lyxrc ||
1601 mac_like_word_movement
1602 != system_lyxrc.mac_like_word_movement) {
1603 os << "\\mac_like_word_movement "
1604 << convert<string>(mac_like_word_movement) << '\n';
1606 if (tag != RC_LAST)
1607 break;
1608 case RC_MACRO_EDIT_STYLE:
1609 if (ignore_system_lyxrc ||
1610 macro_edit_style
1611 != system_lyxrc.macro_edit_style) {
1612 os << "\\macro_edit_style ";
1613 switch (macro_edit_style) {
1614 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1615 case MACRO_EDIT_INLINE: os << "1\n"; break;
1616 case MACRO_EDIT_LIST: os << "2\n"; break;
1619 if (tag != RC_LAST)
1620 break;
1621 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1622 if (ignore_system_lyxrc ||
1623 dialogs_iconify_with_main
1624 != system_lyxrc.dialogs_iconify_with_main) {
1625 os << "\\dialogs_iconify_with_main "
1626 << convert<string>(dialogs_iconify_with_main) << '\n';
1628 if (tag != RC_LAST)
1629 break;
1630 case RC_SCREEN_FONT_ROMAN:
1631 if (ignore_system_lyxrc ||
1632 roman_font_name != system_lyxrc.roman_font_name) {
1633 os << "\\screen_font_roman \"" << roman_font_name
1634 << "\"\n";
1636 if (tag != RC_LAST)
1637 break;
1638 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1639 if (ignore_system_lyxrc ||
1640 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1641 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1642 << "\"\n";
1644 if (tag != RC_LAST)
1645 break;
1646 case RC_SCREEN_FONT_SANS:
1647 if (ignore_system_lyxrc ||
1648 sans_font_name != system_lyxrc.sans_font_name) {
1649 os << "\\screen_font_sans \"" << sans_font_name
1650 << "\"\n";
1652 if (tag != RC_LAST)
1653 break;
1654 case RC_SCREEN_FONT_SANS_FOUNDRY:
1655 if (ignore_system_lyxrc ||
1656 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1657 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1658 << "\"\n";
1660 if (tag != RC_LAST)
1661 break;
1662 case RC_SCREEN_FONT_TYPEWRITER:
1663 if (ignore_system_lyxrc ||
1664 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1665 os << "\\screen_font_typewriter \""
1666 << typewriter_font_name << "\"\n";
1668 if (tag != RC_LAST)
1669 break;
1670 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1671 if (ignore_system_lyxrc ||
1672 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1673 os << "\\screen_font_typewriter_foundry \""
1674 << typewriter_font_foundry << "\"\n";
1676 if (tag != RC_LAST)
1677 break;
1679 case RC_SCREEN_FONT_SCALABLE:
1680 if (ignore_system_lyxrc ||
1681 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1682 os << "\\screen_font_scalable "
1683 << convert<string>(use_scalable_fonts)
1684 << '\n';
1686 if (tag != RC_LAST)
1687 break;
1688 case RC_SCREEN_FONT_SIZES:
1689 if (ignore_system_lyxrc ||
1690 font_sizes[FONT_SIZE_TINY]
1691 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1692 font_sizes[FONT_SIZE_SCRIPT]
1693 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1694 font_sizes[FONT_SIZE_FOOTNOTE]
1695 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1696 font_sizes[FONT_SIZE_SMALL]
1697 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1698 font_sizes[FONT_SIZE_NORMAL]
1699 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1700 font_sizes[FONT_SIZE_LARGE]
1701 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1702 font_sizes[FONT_SIZE_LARGER]
1703 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1704 font_sizes[FONT_SIZE_LARGEST]
1705 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1706 font_sizes[FONT_SIZE_HUGE]
1707 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1708 font_sizes[FONT_SIZE_HUGER]
1709 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1710 os.setf(ios::fixed);
1711 os.precision(2);
1712 os << "\\screen_font_sizes"
1713 << ' ' << font_sizes[FONT_SIZE_TINY]
1714 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1715 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1716 << ' ' << font_sizes[FONT_SIZE_SMALL]
1717 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1718 << ' ' << font_sizes[FONT_SIZE_LARGE]
1719 << ' ' << font_sizes[FONT_SIZE_LARGER]
1720 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1721 << ' ' << font_sizes[FONT_SIZE_HUGE]
1722 << ' ' << font_sizes[FONT_SIZE_HUGER]
1723 << '\n';
1725 if (tag != RC_LAST)
1726 break;
1727 case RC_FULL_SCREEN_LIMIT:
1728 if (ignore_system_lyxrc ||
1729 full_screen_limit != system_lyxrc.full_screen_limit) {
1730 os << "\\fullscreen_limit "
1731 << convert<string>(full_screen_limit)
1732 << '\n';
1734 if (tag != RC_LAST)
1735 break;
1736 case RC_FULL_SCREEN_TOOLBARS:
1737 if (ignore_system_lyxrc ||
1738 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1739 os << "\\fullscreen_toolbars "
1740 << convert<string>(full_screen_toolbars)
1741 << '\n';
1743 if (tag != RC_LAST)
1744 break;
1745 case RC_FULL_SCREEN_SCROLLBAR:
1746 if (ignore_system_lyxrc ||
1747 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1748 os << "\\fullscreen_scrollbar "
1749 << convert<string>(full_screen_scrollbar)
1750 << '\n';
1752 if (tag != RC_LAST)
1753 break;
1754 case RC_FULL_SCREEN_TABBAR:
1755 if (ignore_system_lyxrc ||
1756 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1757 os << "\\fullscreen_tabbar "
1758 << convert<string>(full_screen_tabbar)
1759 << '\n';
1761 if (tag != RC_LAST)
1762 break;
1763 case RC_FULL_SCREEN_MENUBAR:
1764 if (ignore_system_lyxrc ||
1765 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1766 os << "\\fullscreen_menubar "
1767 << convert<string>(full_screen_menubar)
1768 << '\n';
1770 if (tag != RC_LAST)
1771 break;
1772 case RC_FULL_SCREEN_WIDTH:
1773 if (ignore_system_lyxrc ||
1774 full_screen_width != system_lyxrc.full_screen_width) {
1775 os << "\\fullscreen_width "
1776 << convert<string>(full_screen_width)
1777 << '\n';
1779 if (tag != RC_LAST)
1780 break;
1781 case RC_OPEN_BUFFERS_IN_TABS:
1782 if (ignore_system_lyxrc ||
1783 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1784 os << "\\open_buffers_in_tabs "
1785 << convert<string>(open_buffers_in_tabs)
1786 << '\n';
1788 if (tag != RC_LAST)
1789 break;
1791 os << "\n#\n"
1792 << "# COLOR SECTION ###################################\n"
1793 << "#\n\n";
1795 case RC_SET_COLOR:
1796 for (int i = 0; i < Color_ignore; ++i) {
1797 ColorCode lc = static_cast<ColorCode>(i);
1798 string const col = lcolor.getX11Name(lc);
1799 if (ignore_system_lyxrc
1800 || col != system_lcolor.getX11Name(lc)) {
1801 os << "\\set_color \""
1802 << lcolor.getLyXName(lc) << "\" \""
1803 << col << "\"\n";
1806 if (tag != RC_LAST)
1807 break;
1809 os << "\n#\n"
1810 << "# PRINTER SECTION ###################################\n"
1811 << "#\n\n";
1813 case RC_PRINTER:
1814 if (ignore_system_lyxrc ||
1815 printer != system_lyxrc.printer) {
1816 os << "\\printer \"" << printer << "\"\n";
1818 if (tag != RC_LAST)
1819 break;
1820 case RC_PRINT_ADAPTOUTPUT:
1821 if (ignore_system_lyxrc ||
1822 print_adapt_output != system_lyxrc.print_adapt_output) {
1823 os << "\\print_adapt_output "
1824 << convert<string>(print_adapt_output)
1825 << '\n';
1827 if (tag != RC_LAST)
1828 break;
1829 case RC_PRINT_COMMAND:
1830 if (ignore_system_lyxrc ||
1831 print_command != system_lyxrc.print_command) {
1832 os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
1834 if (tag != RC_LAST)
1835 break;
1836 case RC_PRINTEXSTRAOPTIONS:
1837 if (ignore_system_lyxrc ||
1838 print_extra_options != system_lyxrc.print_extra_options) {
1839 os << "\\print_extra_options \"" << print_extra_options
1840 << "\"\n";
1842 if (tag != RC_LAST)
1843 break;
1844 case RC_PRINTSPOOL_COMMAND:
1845 if (ignore_system_lyxrc ||
1846 print_spool_command != system_lyxrc.print_spool_command) {
1847 os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
1848 << "\"\n";
1850 if (tag != RC_LAST)
1851 break;
1852 case RC_PRINTSPOOL_PRINTERPREFIX:
1853 if (ignore_system_lyxrc ||
1854 print_spool_printerprefix
1855 != system_lyxrc.print_spool_printerprefix) {
1856 os << "\\print_spool_printerprefix \""
1857 << print_spool_printerprefix << "\"\n";
1859 if (tag != RC_LAST)
1860 break;
1861 case RC_PRINTEVENPAGEFLAG:
1862 if (ignore_system_lyxrc ||
1863 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1864 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1865 << "\"\n";
1867 if (tag != RC_LAST)
1868 break;
1869 case RC_PRINTODDPAGEFLAG:
1870 if (ignore_system_lyxrc ||
1871 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1872 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1873 << "\"\n";
1875 if (tag != RC_LAST)
1876 break;
1877 case RC_PRINTREVERSEFLAG:
1878 if (ignore_system_lyxrc ||
1879 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1880 os << "\\print_reverse_flag \"" << print_reverse_flag
1881 << "\"\n";
1883 if (tag != RC_LAST)
1884 break;
1885 case RC_PRINTLANDSCAPEFLAG:
1886 if (ignore_system_lyxrc ||
1887 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1888 os << "\\print_landscape_flag \"" << print_landscape_flag
1889 << "\"\n";
1891 if (tag != RC_LAST)
1892 break;
1893 case RC_PRINTPAGERANGEFLAG:
1894 if (ignore_system_lyxrc ||
1895 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1896 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1897 << "\"\n";
1899 if (tag != RC_LAST)
1900 break;
1901 case RC_PRINTCOPIESFLAG:
1902 if (ignore_system_lyxrc ||
1903 print_copies_flag != system_lyxrc.print_copies_flag) {
1904 os << "\\print_copies_flag \"" << print_copies_flag
1905 << "\"\n";
1907 if (tag != RC_LAST)
1908 break;
1909 case RC_PRINTCOLLCOPIESFLAG:
1910 if (ignore_system_lyxrc ||
1911 print_collcopies_flag
1912 != system_lyxrc.print_collcopies_flag) {
1913 os << "\\print_collcopies_flag \""
1914 << print_collcopies_flag
1915 << "\"\n";
1917 if (tag != RC_LAST)
1918 break;
1919 case RC_PRINTPAPERFLAG:
1920 if (ignore_system_lyxrc ||
1921 print_paper_flag != system_lyxrc.print_paper_flag) {
1922 os << "\\print_paper_flag \"" << print_paper_flag
1923 << "\"\n";
1925 if (tag != RC_LAST)
1926 break;
1927 case RC_PRINTPAPERDIMENSIONFLAG:
1928 if (ignore_system_lyxrc ||
1929 print_paper_dimension_flag
1930 != system_lyxrc.print_paper_dimension_flag) {
1931 os << "\\print_paper_dimension_flag \""
1932 << print_paper_dimension_flag << "\"\n";
1934 if (tag != RC_LAST)
1935 break;
1936 case RC_PRINTTOPRINTER:
1937 if (ignore_system_lyxrc ||
1938 print_to_printer != system_lyxrc.print_to_printer) {
1939 os << "\\print_to_printer \"" << print_to_printer
1940 << "\"\n";
1942 if (tag != RC_LAST)
1943 break;
1944 case RC_PRINTTOFILE:
1945 if (ignore_system_lyxrc ||
1946 print_to_file != system_lyxrc.print_to_file) {
1947 string const path = os::external_path(print_to_file);
1948 os << "\\print_to_file \"" << path << "\"\n";
1950 if (tag != RC_LAST)
1951 break;
1952 case RC_PRINTFILEEXTENSION:
1953 if (ignore_system_lyxrc ||
1954 print_file_extension != system_lyxrc.print_file_extension) {
1955 os << "\\print_file_extension \""
1956 << print_file_extension
1957 << "\"\n";
1959 if (tag != RC_LAST)
1960 break;
1962 os << "\n#\n"
1963 << "# TEX SECTION #######################################\n"
1964 << "#\n\n";
1966 case RC_FONT_ENCODING:
1967 if (ignore_system_lyxrc ||
1968 fontenc != system_lyxrc.fontenc) {
1969 os << "\\font_encoding \"" << fontenc << "\"\n";
1971 if (tag != RC_LAST)
1972 break;
1974 os << "\n#\n"
1975 << "# FILE SECTION ######################################\n"
1976 << "#\n\n";
1978 case RC_DOCUMENTPATH:
1979 if (ignore_system_lyxrc ||
1980 document_path != system_lyxrc.document_path) {
1981 string const path = os::external_path(document_path);
1982 os << "\\document_path \"" << path << "\"\n";
1984 if (tag != RC_LAST)
1985 break;
1986 case RC_USELASTFILEPOS:
1987 if (ignore_system_lyxrc ||
1988 use_lastfilepos != system_lyxrc.use_lastfilepos) {
1989 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
1990 << '\n';
1992 if (tag != RC_LAST)
1993 break;
1994 case RC_LOADSESSION:
1995 if (ignore_system_lyxrc ||
1996 load_session != system_lyxrc.load_session) {
1997 os << "\\load_session " << convert<string>(load_session)
1998 << "\n";
2000 if (tag != RC_LAST)
2001 break;
2002 case RC_MOUSE_WHEEL_SPEED:
2003 if (ignore_system_lyxrc ||
2004 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2005 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2007 if (tag != RC_LAST)
2008 break;
2009 case RC_COMPLETION_INLINE_DELAY:
2010 if (ignore_system_lyxrc ||
2011 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2012 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2014 if (tag != RC_LAST)
2015 break;
2016 case RC_COMPLETION_INLINE_MATH:
2017 if (ignore_system_lyxrc ||
2018 completion_inline_math != system_lyxrc.completion_inline_math) {
2019 os << "\\completion_inline_math "
2020 << convert<string>(completion_inline_math) << '\n';
2022 if (tag != RC_LAST)
2023 break;
2024 case RC_COMPLETION_INLINE_TEXT:
2025 if (ignore_system_lyxrc ||
2026 completion_inline_text != system_lyxrc.completion_inline_text) {
2027 os << "\\completion_inline_text "
2028 << convert<string>(completion_inline_text) << '\n';
2030 if (tag != RC_LAST)
2031 break;
2032 case RC_COMPLETION_INLINE_DOTS:
2033 if (ignore_system_lyxrc ||
2034 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2035 os << "\\completion_inline_dots "
2036 << convert<string>(completion_inline_dots) << '\n';
2038 if (tag != RC_LAST)
2039 break;
2040 case RC_AUTOCORRECTION_MATH:
2041 if (ignore_system_lyxrc ||
2042 autocorrection_math != system_lyxrc.autocorrection_math) {
2043 os << "\\autocorrection_math "
2044 << convert<string>(autocorrection_math) << '\n';
2046 if (tag != RC_LAST)
2047 break;
2048 case RC_COMPLETION_POPUP_DELAY:
2049 if (ignore_system_lyxrc ||
2050 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2051 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2053 if (tag != RC_LAST)
2054 break;
2055 case RC_COMPLETION_POPUP_MATH:
2056 if (ignore_system_lyxrc ||
2057 completion_popup_math != system_lyxrc.completion_popup_math) {
2058 os << "\\completion_popup_math "
2059 << convert<string>(completion_popup_math) << '\n';
2061 if (tag != RC_LAST)
2062 break;
2063 case RC_COMPLETION_POPUP_TEXT:
2064 if (ignore_system_lyxrc ||
2065 completion_popup_text != system_lyxrc.completion_popup_text) {
2066 os << "\\completion_popup_text "
2067 << convert<string>(completion_popup_text) << '\n';
2069 if (tag != RC_LAST)
2070 break;
2071 case RC_COMPLETION_CURSOR_TEXT:
2072 if (ignore_system_lyxrc ||
2073 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2074 os << "\\completion_cursor_text "
2075 << convert<string>(completion_cursor_text) << '\n';
2077 if (tag != RC_LAST)
2078 break;
2079 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2080 if (ignore_system_lyxrc ||
2081 completion_popup_after_complete
2082 != system_lyxrc.completion_popup_after_complete) {
2083 os << "\\completion_popup_after_complete "
2084 << convert<string>(completion_popup_after_complete) << '\n';
2086 if (tag != RC_LAST)
2087 break;
2088 case RC_NUMLASTFILES:
2089 if (ignore_system_lyxrc ||
2090 num_lastfiles != system_lyxrc.num_lastfiles) {
2091 os << "\\num_lastfiles " << num_lastfiles << '\n';
2093 if (tag != RC_LAST)
2094 break;
2095 case RC_CHECKLASTFILES:
2096 if (ignore_system_lyxrc ||
2097 check_lastfiles != system_lyxrc.check_lastfiles) {
2098 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2099 << '\n';
2101 if (tag != RC_LAST)
2102 break;
2103 case RC_EXAMPLEPATH:
2104 if (ignore_system_lyxrc ||
2105 example_path != system_lyxrc.example_path) {
2106 string const path = os::external_path(example_path);
2107 os << "\\example_path \"" << path << "\"\n";
2109 if (tag != RC_LAST)
2110 break;
2111 case RC_TEMPLATEPATH:
2112 if (ignore_system_lyxrc ||
2113 template_path != system_lyxrc.template_path) {
2114 string const path = os::external_path(template_path);
2115 os << "\\template_path \"" << path << "\"\n";
2117 if (tag != RC_LAST)
2118 break;
2119 case RC_TEMPDIRPATH:
2120 if (ignore_system_lyxrc ||
2121 tempdir_path != system_lyxrc.tempdir_path) {
2122 string const path = os::external_path(tempdir_path);
2123 os << "\\tempdir_path \"" << path << "\"\n";
2125 if (tag != RC_LAST)
2126 break;
2127 case RC_THESAURUSDIRPATH:
2128 if (ignore_system_lyxrc ||
2129 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2130 string const path = os::external_path(thesaurusdir_path);
2131 os << "\\thesaurusdir_path \"" << path << "\"\n";
2133 if (tag != RC_LAST)
2134 break;
2135 case RC_USETEMPDIR:
2136 if (tag != RC_LAST)
2137 break;
2138 // Ignore it
2139 case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 2.0
2140 if (tag != RC_LAST)
2141 break;
2142 case RC_PLAINTEXT_LINELEN:
2143 if (ignore_system_lyxrc ||
2144 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2145 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2147 if (tag != RC_LAST)
2148 break;
2149 case RC_MAKE_BACKUP:
2150 if (ignore_system_lyxrc ||
2151 make_backup != system_lyxrc.make_backup) {
2152 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2154 if (tag != RC_LAST)
2155 break;
2156 case RC_BACKUPDIR_PATH:
2157 if (ignore_system_lyxrc ||
2158 backupdir_path != system_lyxrc.backupdir_path) {
2159 string const path = os::external_path(backupdir_path);
2160 os << "\\backupdir_path \"" << path << "\"\n";
2162 if (tag != RC_LAST)
2163 break;
2165 os << "\n#\n"
2166 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2167 << "#\n\n";
2169 os << "\n#\n"
2170 << "# SPELLCHECKER SECTION ##############################\n"
2171 << "#\n\n";
2173 case RC_SPELL_COMMAND:
2174 case RC_USE_SPELL_LIB:
2175 // Obsoleted in 2.0
2176 if (tag != RC_LAST)
2177 break;
2178 case RC_ACCEPT_COMPOUND:
2179 if (ignore_system_lyxrc ||
2180 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2181 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2182 << '\n';
2184 if (tag != RC_LAST)
2185 break;
2186 case RC_USE_ALT_LANG:
2187 // Obsoleted in 2.0
2188 if (tag != RC_LAST)
2189 break;
2190 case RC_ALT_LANG:
2191 if (ignore_system_lyxrc ||
2192 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2193 os << "\\alternate_language \"" << spellchecker_alt_lang
2194 << "\"\n";
2196 if (tag != RC_LAST)
2197 break;
2198 case RC_USE_ESC_CHARS:
2199 if (tag != RC_LAST)
2200 break;
2201 case RC_ESC_CHARS:
2202 if (ignore_system_lyxrc ||
2203 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2204 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2206 if (tag != RC_LAST)
2207 break;
2208 case RC_USE_PERS_DICT:
2209 // obsoleted in 2.0
2210 if (tag != RC_LAST)
2211 break;
2212 case RC_USE_TOOLTIP:
2213 if (ignore_system_lyxrc ||
2214 use_tooltip != system_lyxrc.use_tooltip) {
2215 os << "\\use_tooltip "
2216 << convert<string>(use_tooltip)
2217 << '\n';
2219 if (tag != RC_LAST)
2220 break;
2221 case RC_USE_PIXMAP_CACHE:
2222 if (ignore_system_lyxrc ||
2223 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2224 os << "\\use_pixmap_cache "
2225 << convert<string>(use_pixmap_cache)
2226 << '\n';
2228 if (tag != RC_LAST)
2229 break;
2230 case RC_PERS_DICT:
2231 // obsoleted in 2.0
2232 if (tag != RC_LAST)
2233 break;
2234 case RC_USE_INP_ENC:
2235 // obsoleted in 2.0
2236 if (tag != RC_LAST)
2237 break;
2239 os << "\n#\n"
2240 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2241 << "#\n\n";
2242 if (tag != RC_LAST)
2243 break;
2245 case RC_SPELLCHECK_CONTINUOUSLY:
2246 if (ignore_system_lyxrc ||
2247 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2248 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2249 << '\n';
2251 if (tag != RC_LAST)
2252 break;
2254 case RC_RTL_SUPPORT:
2255 if (ignore_system_lyxrc ||
2256 rtl_support != system_lyxrc.rtl_support) {
2257 os << "\\rtl " << convert<string>(rtl_support) << '\n';
2259 if (tag != RC_LAST)
2260 break;
2261 case RC_VISUAL_CURSOR:
2262 if (ignore_system_lyxrc ||
2263 visual_cursor != system_lyxrc.visual_cursor) {
2264 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2266 if (tag != RC_LAST)
2267 break;
2268 case RC_LANGUAGE_PACKAGE:
2269 if (ignore_system_lyxrc ||
2270 language_package != system_lyxrc.language_package) {
2271 os << "\\language_package \"" << language_package
2272 << "\"\n";
2274 if (tag != RC_LAST)
2275 break;
2276 case RC_LANGUAGE_GLOBAL_OPTIONS:
2277 if (ignore_system_lyxrc ||
2278 language_global_options
2279 != system_lyxrc.language_global_options) {
2280 os << "\\language_global_options \""
2281 << convert<string>(language_global_options)
2282 << "\"\n";
2284 if (tag != RC_LAST)
2285 break;
2286 case RC_LANGUAGE_USE_BABEL:
2287 if (ignore_system_lyxrc ||
2288 language_use_babel != system_lyxrc.language_use_babel) {
2289 os << "\\language_use_babel \""
2290 << convert<string>(language_use_babel)
2291 << "\"\n";
2293 if (tag != RC_LAST)
2294 break;
2295 case RC_LANGUAGE_COMMAND_BEGIN:
2296 if (ignore_system_lyxrc ||
2297 language_command_begin
2298 != system_lyxrc.language_command_begin) {
2299 os << "\\language_command_begin \""
2300 << language_command_begin
2301 << "\"\n";
2303 if (tag != RC_LAST)
2304 break;
2305 case RC_LANGUAGE_COMMAND_END:
2306 if (ignore_system_lyxrc ||
2307 language_command_end
2308 != system_lyxrc.language_command_end) {
2309 os << "\\language_command_end \"" << language_command_end
2310 << "\"\n";
2312 if (tag != RC_LAST)
2313 break;
2314 case RC_LANGUAGE_COMMAND_LOCAL:
2315 if (ignore_system_lyxrc ||
2316 language_command_local
2317 != system_lyxrc.language_command_local) {
2318 os << "\\language_command_local \""
2319 << language_command_local
2320 << "\"\n";
2322 if (tag != RC_LAST)
2323 break;
2324 case RC_LANGUAGE_AUTO_BEGIN:
2325 if (ignore_system_lyxrc ||
2326 language_auto_begin != system_lyxrc.language_auto_begin) {
2327 os << "\\language_auto_begin "
2328 << convert<string>(language_auto_begin) << '\n';
2330 if (tag != RC_LAST)
2331 break;
2332 case RC_LANGUAGE_AUTO_END:
2333 if (ignore_system_lyxrc ||
2334 language_auto_end != system_lyxrc.language_auto_end) {
2335 os << "\\language_auto_end "
2336 << convert<string>(language_auto_end) << '\n';
2338 if (tag != RC_LAST)
2339 break;
2340 case RC_MARK_FOREIGN_LANGUAGE:
2341 if (ignore_system_lyxrc ||
2342 mark_foreign_language
2343 != system_lyxrc.mark_foreign_language) {
2344 os << "\\mark_foreign_language " <<
2345 convert<string>(mark_foreign_language) << '\n';
2347 if (tag != RC_LAST)
2348 break;
2350 os << "\n#\n"
2351 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2352 << "#\n\n";
2354 case RC_AUTO_NUMBER:
2355 if (ignore_system_lyxrc ||
2356 auto_number != system_lyxrc.auto_number) {
2357 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2359 if (tag != RC_LAST)
2360 break;
2361 case RC_DEFAULT_LANGUAGE:
2362 if (ignore_system_lyxrc ||
2363 default_language != system_lyxrc.default_language) {
2364 os << "\\default_language " << default_language << '\n';
2366 if (tag != RC_LAST)
2367 break;
2368 case RC_GUI_LANGUAGE:
2369 if (ignore_system_lyxrc ||
2370 gui_language != system_lyxrc.gui_language) {
2371 os << "\\gui_language " << gui_language << '\n';
2373 if (tag != RC_LAST)
2374 break;
2376 os << "\n#\n"
2377 << "# FORMATS SECTION ##########################\n"
2378 << "#\n\n";
2380 case RC_FORMAT:
2381 // New/modified formats
2382 for (Formats::const_iterator cit = formats.begin();
2383 cit != formats.end(); ++cit) {
2384 Format const * format =
2385 system_formats.getFormat(cit->name());
2386 if (!format ||
2387 format->extension() != cit->extension() ||
2388 format->prettyname() != cit->prettyname() ||
2389 format->shortcut() != cit->shortcut() ||
2390 format->viewer() != cit->viewer() ||
2391 format->editor() != cit->editor() ||
2392 format->documentFormat() != cit->documentFormat() ||
2393 format->vectorFormat() != cit->vectorFormat()) {
2394 os << "\\format \"" << cit->name() << "\" \""
2395 << cit->extension() << "\" \""
2396 << cit->prettyname() << "\" \""
2397 << cit->shortcut() << "\" \""
2398 << escapeCommand(cit->viewer()) << "\" \""
2399 << escapeCommand(cit->editor()) << "\" \"";
2400 vector<string> flags;
2401 if (cit->documentFormat())
2402 flags.push_back("document");
2403 if (cit->vectorFormat())
2404 flags.push_back("vector");
2405 os << getStringFromVector(flags);
2406 os << "\"\n";
2410 // Look for deleted formats
2411 for (Formats::const_iterator cit = system_formats.begin();
2412 cit != system_formats.end(); ++cit)
2413 if (!formats.getFormat(cit->name()))
2414 os << "\\format \"" << cit->name()
2415 << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2416 if (tag != RC_LAST)
2417 break;
2418 case RC_DEFAULT_VIEW_FORMAT:
2419 if (ignore_system_lyxrc ||
2420 default_view_format != system_lyxrc.default_view_format) {
2421 os << "\\default_view_format " << default_view_format << '\n';
2423 if (tag != RC_LAST)
2424 break;
2425 case RC_VIEWER:
2426 // Ignore it
2427 if (tag != RC_LAST)
2428 break;
2430 os << "\n#\n"
2431 << "# CONVERTERS SECTION ##########################\n"
2432 << "#\n\n";
2434 case RC_CONVERTER:
2435 // Look for new converters
2436 for (Converters::const_iterator cit = theConverters().begin();
2437 cit != theConverters().end(); ++cit) {
2438 Converter const * converter =
2439 theSystemConverters().getConverter(cit->from,
2440 cit->to);
2441 if (!converter ||
2442 converter->command != cit->command ||
2443 converter->flags != cit->flags)
2444 os << "\\converter \"" << cit->from << "\" \""
2445 << cit->to << "\" \""
2446 << escapeCommand(cit->command) << "\" \""
2447 << cit->flags << "\"\n";
2450 // New/modifed converters
2451 for (Converters::const_iterator cit = theSystemConverters().begin();
2452 cit != theSystemConverters().end(); ++cit)
2453 if (!theConverters().getConverter(cit->from, cit->to))
2454 os << "\\converter \"" << cit->from
2455 << "\" \"" << cit->to << "\" \"\" \"\"\n";
2456 if (tag != RC_LAST)
2457 break;
2459 case RC_COPIER:
2460 if (tag == RC_LAST)
2461 os << "\n#\n"
2462 << "# COPIERS SECTION ##########################\n"
2463 << "#\n\n";
2465 // Look for new movers
2466 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2467 Movers::const_iterator const sysend = theSystemMovers().end();
2468 Movers::const_iterator it = theMovers().begin();
2469 Movers::const_iterator end = theMovers().end();
2471 for (; it != end; ++it) {
2472 Movers::const_iterator const sysit =
2473 find_if(sysbegin, sysend, SameMover(*it));
2474 if (sysit == sysend) {
2475 string const & fmt = it->first;
2476 string const & command =
2477 it->second.command();
2479 os << "\\copier " << fmt
2480 << " \"" << escapeCommand(command) << "\"\n";
2483 if (tag != RC_LAST)
2484 break;
2486 // We don't actually delete SpecialisedMover(s) from the
2487 // map, just clear their 'command', so there's no need
2488 // to test for anything else.
2491 os.flush();
2495 #if 0
2496 string const LyXRC::getDescription(LyXRCTags tag)
2498 docstring str;
2500 switch (tag) {
2501 case RC_ACCEPT_COMPOUND:
2502 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2503 break;
2505 case RC_ALT_LANG:
2506 case RC_USE_ALT_LANG:
2507 str = _("Specify an alternate language. The default is to use the language of the document.");
2508 break;
2510 case RC_PLAINTEXT_ROFF_COMMAND:
2511 str = _("Use to define an external program to render tables in plain text output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"\" is specified, an internal routine is used.");
2512 break;
2514 case RC_PLAINTEXT_LINELEN:
2515 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.");
2516 break;
2518 case RC_AUTOREGIONDELETE:
2519 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2520 break;
2522 case RC_AUTORESET_OPTIONS:
2523 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2524 break;
2526 case RC_AUTOSAVE:
2527 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2528 break;
2530 case RC_AUTO_NUMBER:
2531 break;
2533 case RC_BACKUPDIR_PATH:
2534 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.");
2535 break;
2537 case RC_BIBTEX_COMMAND:
2538 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2539 break;
2541 case RC_JBIBTEX_COMMAND:
2542 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
2543 break;
2545 case RC_BINDFILE:
2546 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2547 break;
2549 case RC_CHECKLASTFILES:
2550 str = _("Select to check whether the lastfiles still exist.");
2551 break;
2553 case RC_CHKTEX_COMMAND:
2554 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2555 break;
2557 case RC_CONVERTER:
2558 break;
2560 case RC_COPIER:
2561 break;
2563 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2564 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.");
2565 break;
2567 case RC_SCROLL_BELOW_DOCUMENT:
2568 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");
2569 break;
2571 case RC_MAC_LIKE_WORD_MOVEMENT:
2572 str = _("Use the Mac OS X conventions for the word-level cursor movement");
2573 break;
2575 case RC_SHOW_MACRO_LABEL:
2576 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
2577 break;
2579 case RC_DATE_INSERT_FORMAT:
2580 //xgettext:no-c-format
2581 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2582 break;
2584 case RC_DEFFILE:
2585 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
2586 break;
2588 case RC_DEFAULT_VIEW_FORMAT:
2589 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
2590 break;
2592 case RC_DEFAULT_LANGUAGE:
2593 str = _("New documents will be assigned this language.");
2594 break;
2596 case RC_DEFAULT_PAPERSIZE:
2597 str = _("Specify the default paper size.");
2598 break;
2600 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2601 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2602 break;
2604 case RC_DISPLAY_GRAPHICS:
2605 str = _("Select how LyX will display any graphics.");
2606 break;
2608 case RC_DOCUMENTPATH:
2609 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2610 break;
2612 case RC_ESC_CHARS:
2613 case RC_USE_ESC_CHARS:
2614 str = _("Specify additional chars that can be part of a word.");
2615 break;
2617 case RC_EXAMPLEPATH:
2618 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
2619 break;
2621 case RC_FONT_ENCODING:
2622 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2623 break;
2625 case RC_FORMAT:
2626 break;
2628 case RC_INDEX_COMMAND:
2629 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\".");
2630 break;
2632 case RC_JINDEX_COMMAND:
2633 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
2634 break;
2636 case RC_NOMENCL_COMMAND:
2637 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
2638 break;
2640 case RC_INPUT:
2641 break;
2643 case RC_KBMAP:
2644 case RC_KBMAP_PRIMARY:
2645 case RC_KBMAP_SECONDARY:
2646 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.");
2647 break;
2649 case RC_LABEL_INIT_LENGTH:
2650 str = _("Maximum number of words in the initialization string for a new label");
2651 break;
2653 case RC_LANGUAGE_AUTO_BEGIN:
2654 str = _("Select if a language switching command is needed at the beginning of the document.");
2655 break;
2657 case RC_LANGUAGE_AUTO_END:
2658 str = _("Select if a language switching command is needed at the end of the document.");
2659 break;
2661 case RC_LANGUAGE_COMMAND_BEGIN:
2662 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.");
2663 break;
2665 case RC_LANGUAGE_COMMAND_END:
2666 str = _("The LaTeX command for changing back to the language of the document.");
2667 break;
2669 case RC_LANGUAGE_COMMAND_LOCAL:
2670 str = _("The LaTeX command for local changing of the language.");
2671 break;
2673 case RC_LANGUAGE_GLOBAL_OPTIONS:
2674 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2675 break;
2677 case RC_LANGUAGE_PACKAGE:
2678 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2679 break;
2681 case RC_LANGUAGE_USE_BABEL:
2682 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2683 break;
2685 case RC_USELASTFILEPOS:
2686 str = _("De-select if you do not want LyX to scroll to saved position.");
2687 break;
2689 case RC_LOADSESSION:
2690 str = _("De-select to prevent loading files opened from the last LyX session.");
2691 break;
2693 case RC_MAKE_BACKUP:
2694 str = _("De-select if you don't want LyX to create backup files.");
2695 break;
2697 case RC_MARK_FOREIGN_LANGUAGE:
2698 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2699 break;
2701 case RC_MOUSE_WHEEL_SPEED:
2702 str = bformat(_("The scrolling speed of the mouse wheel."),
2703 maxlastfiles);
2704 break;
2706 case RC_COMPLETION_POPUP_DELAY:
2707 str = _("The completion popup delay.");
2708 break;
2710 case RC_COMPLETION_POPUP_MATH:
2711 str = _("Select to display the completion popup in math mode.");
2712 break;
2714 case RC_COMPLETION_POPUP_TEXT:
2715 str = _("Select to display the completion popup in text mode.");
2716 break;
2718 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2719 str = _("Show the completion popup without delay after non-unique completion attempt.");
2720 break;
2722 case RC_COMPLETION_POPUP_TEXT:
2723 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
2724 break;
2726 case RC_COMPLETION_POPUP_DELAY:
2727 str = _("The inline completion delay.");
2728 break;
2730 case RC_COMPLETION_INLINE_MATH:
2731 str = _("Select to display the inline completion in math mode.");
2732 break;
2734 case RC_COMPLETION_INLINE_TEXT:
2735 str = _("Select to display the inline completion in text mode.");
2736 break;
2738 case RC_COMPLETION_INLINE_DOTS:
2739 str = _("Use \"...\" to shorten long completions.");
2740 break;
2742 case RC_AUTOCORRECTION_MATH:
2743 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
2744 break;
2746 case RC_NUMLASTFILES:
2747 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
2748 maxlastfiles);
2749 break;
2751 case RC_PATH_PREFIX:
2752 str = _("Specify those directories which should be "
2753 "prepended to the PATH environment variable. "
2754 "Use the OS native format.");
2755 break;
2757 case RC_PREVIEW:
2758 str = _("Shows a typeset preview of things such as math");
2759 break;
2761 case RC_PREVIEW_HASHED_LABELS:
2762 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2763 break;
2765 case RC_PREVIEW_SCALE_FACTOR:
2766 str = _("Scale the preview size to suit.");
2767 break;
2769 case RC_PRINTCOLLCOPIESFLAG:
2770 str = _("The option for specifying whether the copies should be collated.");
2771 break;
2773 case RC_PRINTCOPIESFLAG:
2774 str = _("The option for specifying the number of copies to print.");
2775 break;
2777 case RC_PRINTER:
2778 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2779 break;
2781 case RC_PRINTEVENPAGEFLAG:
2782 str = _("The option to print only even pages.");
2783 break;
2785 case RC_PRINTEXSTRAOPTIONS:
2786 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2787 break;
2789 case RC_PRINTFILEEXTENSION:
2790 str = _("Extension of printer program output file. Usually \".ps\".");
2791 break;
2793 case RC_PRINTLANDSCAPEFLAG:
2794 str = _("The option to print out in landscape.");
2795 break;
2797 case RC_PRINTODDPAGEFLAG:
2798 str = _("The option to print only odd pages.");
2799 break;
2801 case RC_PRINTPAGERANGEFLAG:
2802 str = _("The option for specifying a comma-separated list of pages to print.");
2803 break;
2805 case RC_PRINTPAPERDIMENSIONFLAG:
2806 str = _("Option to specify the dimensions of the print paper.");
2807 break;
2809 case RC_PRINTPAPERFLAG:
2810 str = _("The option to specify paper type.");
2811 break;
2813 case RC_PRINTREVERSEFLAG:
2814 str = _("The option to reverse the order of the pages printed.");
2815 break;
2817 case RC_PRINTSPOOL_COMMAND:
2818 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.");
2819 break;
2821 case RC_PRINTSPOOL_PRINTERPREFIX:
2822 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.");
2823 break;
2825 case RC_PRINTTOFILE:
2826 str = _("Option to pass to the print program to print to a file.");
2827 break;
2829 case RC_PRINTTOPRINTER:
2830 str = _("Option to pass to the print program to print on a specific printer.");
2831 break;
2833 case RC_PRINT_ADAPTOUTPUT:
2834 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2835 break;
2837 case RC_PRINT_COMMAND:
2838 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2839 break;
2841 case RC_RTL_SUPPORT:
2842 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2843 break;
2845 case RC_VISUAL_CURSOR:
2846 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
2847 break;
2849 case RC_SCREEN_DPI:
2850 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2851 break;
2853 case RC_SCREEN_FONT_ROMAN:
2854 case RC_SCREEN_FONT_SANS:
2855 case RC_SCREEN_FONT_TYPEWRITER:
2856 str = _("The screen fonts used to display the text while editing.");
2857 break;
2859 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2860 case RC_SCREEN_FONT_SANS_FOUNDRY:
2861 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2862 break;
2864 case RC_SCREEN_FONT_SCALABLE:
2865 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.");
2866 break;
2868 case RC_SCREEN_FONT_SIZES:
2869 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2870 break;
2872 case RC_SCREEN_ZOOM:
2873 //xgettext:no-c-format
2874 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2875 break;
2877 case RC_GEOMETRY_SESSION:
2878 str = _("Allow session manager to save and restore windows geometry.");
2879 break;
2881 case RC_SERVERPIPE:
2882 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2883 break;
2885 case RC_SET_COLOR:
2886 break;
2888 case RC_SHOW_BANNER:
2889 str = _("De-select if you don't want the startup banner.");
2890 break;
2892 case RC_TEMPDIRPATH:
2893 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2894 break;
2896 case RC_THESAURUSDIRPATH:
2897 str = _("This is the place where the files of the thesaurus library reside.");
2898 break;
2900 case RC_TEMPLATEPATH:
2901 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2902 break;
2904 case RC_TEX_ALLOWS_SPACES:
2905 break;
2907 case RC_TEX_EXPECTS_WINDOWS_PATHS:
2908 break;
2910 case RC_UIFILE:
2911 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2912 break;
2914 case RC_USER_EMAIL:
2915 break;
2917 case RC_USER_NAME:
2918 break;
2920 case RC_USETEMPDIR:
2921 break;
2923 case RC_USE_TOOLTIP:
2924 str = _("Enable the automatic appearance of tool tips in the work area.");
2925 break;
2927 case RC_USE_PIXMAP_CACHE:
2928 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
2929 break;
2931 case RC_USE_SPELL_LIB:
2932 break;
2934 case RC_VIEWDVI_PAPEROPTION:
2935 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2936 break;
2938 case RC_VIEWER:
2939 break;
2941 case RC_LAST:
2942 break;
2945 return str;
2947 #endif
2950 // The global instance
2951 LyXRC lyxrc;
2953 // The global copy of the system lyxrc entries (everything except preferences)
2954 LyXRC system_lyxrc;
2957 } // namespace lyx