]> git.lyx.org Git - features.git/blob - src/LyXRC.h
Fix bug #6129: Show paragraph marks / pilcrows.
[features.git] / src / LyXRC.h
1 // -*- C++ -*-
2 /**
3  * \file LyXRC.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  * \author Angus Leeming
10  * \author John Levon
11  * \author André Pönitz
12  * \author Allan Rae
13  * \author Dekel Tsur
14  *
15  * Full author contact details are available in file CREDITS.
16  */
17
18 #ifndef LYXRC_H
19 #define LYXRC_H
20
21 #include "paper.h"
22
23 #include "support/strfwd.h"
24
25 #include <set>
26 #include <string>
27
28
29 namespace lyx {
30
31 namespace support { class FileName; }
32
33 class Lexer;
34
35 /// This contains the runtime configuration of LyX
36 class LyXRC
37 {
38 public:
39         enum LyXRCTags {
40                 RC_ACCEPT_COMPOUND = 1,
41                 RC_ALT_LANG,
42                 RC_AUTOCORRECTION_MATH,
43                 RC_AUTOREGIONDELETE,
44                 RC_AUTORESET_OPTIONS,
45                 RC_AUTOSAVE,
46                 RC_AUTO_NUMBER,
47                 RC_BACKUPDIR_PATH,
48                 RC_BIBTEX_ALTERNATIVES,
49                 RC_BIBTEX_COMMAND,
50                 RC_BINDFILE,
51                 RC_CHECKLASTFILES,
52                 RC_CHKTEX_COMMAND,
53                 RC_COMPLETION_CURSOR_TEXT,
54                 RC_COMPLETION_INLINE_DELAY,
55                 RC_COMPLETION_INLINE_MATH,
56                 RC_COMPLETION_INLINE_TEXT,
57                 RC_COMPLETION_INLINE_DOTS,
58                 RC_COMPLETION_POPUP_DELAY,
59                 RC_COMPLETION_POPUP_MATH,
60                 RC_COMPLETION_POPUP_TEXT,
61                 RC_COMPLETION_POPUP_AFTER_COMPLETE,
62                 RC_CONVERTER,
63                 RC_CONVERTER_CACHE_MAXAGE,
64                 RC_COPIER,
65                 RC_CURSOR_FOLLOWS_SCROLLBAR,
66                 RC_DATE_INSERT_FORMAT,
67                 RC_DEFAULT_LANGUAGE,
68                 RC_DEFAULT_VIEW_FORMAT,
69                 RC_DEFAULT_PAPERSIZE,
70                 RC_DEFFILE,
71                 RC_DIALOGS_ICONIFY_WITH_MAIN,
72                 RC_DISPLAY_GRAPHICS,
73                 RC_DOCUMENTPATH,
74                 RC_ESC_CHARS,
75                 RC_EXAMPLEPATH,
76                 RC_FONT_ENCODING,
77                 RC_FORMAT,
78                 RC_FULL_SCREEN_LIMIT,
79                 RC_FULL_SCREEN_SCROLLBAR,
80                 RC_FULL_SCREEN_TABBAR,
81                 RC_FULL_SCREEN_MENUBAR,
82                 RC_FULL_SCREEN_TOOLBARS,
83                 RC_FULL_SCREEN_WIDTH,
84                 RC_GEOMETRY_SESSION,
85                 RC_GROUP_LAYOUTS,
86                 RC_GUI_LANGUAGE,
87                 RC_HUNSPELLDIR_PATH,
88                 RC_INDEX_ALTERNATIVES,
89                 RC_INDEX_COMMAND,
90                 RC_INPUT,
91                 RC_JBIBTEX_COMMAND,
92                 RC_JINDEX_COMMAND,
93                 RC_KBMAP,
94                 RC_KBMAP_PRIMARY,
95                 RC_KBMAP_SECONDARY,
96                 RC_LABEL_INIT_LENGTH,
97                 RC_LANGUAGE_AUTO_BEGIN,
98                 RC_LANGUAGE_AUTO_END,
99                 RC_LANGUAGE_COMMAND_BEGIN,
100                 RC_LANGUAGE_COMMAND_END,
101                 RC_LANGUAGE_COMMAND_LOCAL,
102                 RC_LANGUAGE_GLOBAL_OPTIONS,
103                 RC_LANGUAGE_PACKAGE,
104                 RC_LANGUAGE_USE_BABEL,
105                 RC_LOADSESSION,
106                 RC_MACRO_EDIT_STYLE,
107                 RC_MAC_LIKE_WORD_MOVEMENT,
108                 RC_MAKE_BACKUP,
109                 RC_MARK_FOREIGN_LANGUAGE,
110                 RC_MOUSE_WHEEL_SPEED,
111                 RC_NOMENCL_COMMAND,
112                 RC_NUMLASTFILES,
113                 RC_OPEN_BUFFERS_IN_TABS,
114                 RC_PARAGRAPH_MARKERS,
115                 RC_PATH_PREFIX,
116                 RC_PERS_DICT,
117                 RC_PLAINTEXT_LINELEN,
118                 RC_PLAINTEXT_ROFF_COMMAND,
119                 RC_PREVIEW,
120                 RC_PREVIEW_HASHED_LABELS,
121                 RC_PREVIEW_SCALE_FACTOR,
122                 RC_PRINTCOLLCOPIESFLAG,
123                 RC_PRINTCOPIESFLAG,
124                 RC_PRINTER,
125                 RC_PRINTEVENPAGEFLAG,
126                 RC_PRINTEXSTRAOPTIONS,
127                 RC_PRINTFILEEXTENSION,
128                 RC_PRINTLANDSCAPEFLAG,
129                 RC_PRINTODDPAGEFLAG,
130                 RC_PRINTPAGERANGEFLAG,
131                 RC_PRINTPAPERDIMENSIONFLAG,
132                 RC_PRINTPAPERFLAG,
133                 RC_PRINTREVERSEFLAG,
134                 RC_PRINTSPOOL_COMMAND,
135                 RC_PRINTSPOOL_PRINTERPREFIX,
136                 RC_PRINTTOFILE,
137                 RC_PRINTTOPRINTER,
138                 RC_PRINT_ADAPTOUTPUT,
139                 RC_PRINT_COMMAND,
140                 RC_RTL_SUPPORT,
141                 RC_SCREEN_DPI,
142                 RC_SCREEN_FONT_ROMAN,
143                 RC_SCREEN_FONT_ROMAN_FOUNDRY,
144                 RC_SCREEN_FONT_SANS,
145                 RC_SCREEN_FONT_SANS_FOUNDRY,
146                 RC_SCREEN_FONT_SCALABLE,
147                 RC_SCREEN_FONT_SIZES,
148                 RC_SCREEN_FONT_TYPEWRITER,
149                 RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
150                 RC_SCREEN_ZOOM,
151                 RC_SCROLL_BELOW_DOCUMENT,
152                 RC_SERVERPIPE,
153                 RC_SET_COLOR,
154                 RC_SHOW_BANNER,
155                 RC_SORT_LAYOUTS,
156                 RC_SPELL_COMMAND,
157                 RC_SPELLCHECK_CONTINUOUSLY,
158                 RC_SPELLCHECKER,
159                 RC_SPLITINDEX_COMMAND,
160                 RC_TEMPDIRPATH,
161                 RC_TEMPLATEPATH,
162                 RC_TEX_ALLOWS_SPACES,
163                 RC_TEX_EXPECTS_WINDOWS_PATHS,
164                 RC_THESAURUSDIRPATH,
165                 RC_UIFILE,
166                 RC_USELASTFILEPOS,
167                 RC_USER_EMAIL,
168                 RC_USER_NAME,
169                 RC_USETEMPDIR,
170                 RC_USE_ALT_LANG,
171                 RC_USE_CONVERTER_CACHE,
172                 RC_USE_ESC_CHARS,
173                 RC_USE_INP_ENC,
174                 RC_USE_PERS_DICT,
175                 RC_USE_TOOLTIP,
176                 RC_USE_PIXMAP_CACHE,
177                 RC_USE_SPELL_LIB,
178                 RC_VIEWDVI_PAPEROPTION,
179                 RC_VIEWER,
180                 RC_VISUAL_CURSOR,
181                 RC_LAST
182         };
183
184         ///
185         LyXRC();
186         ///
187         void setDefaults();
188         ///
189         int read(support::FileName const & filename);
190         ///
191         int read(std::istream &);
192 private:
193         ///
194         int read(Lexer &);
195 public:
196         ///
197         void write(support::FileName const & filename,
198                    bool ignore_system_lyxrc) const;
199         /// write rc. If a specific tag is given, only output that one.
200         void write(std::ostream & os,
201                    bool ignore_system_lyxrc, 
202                    std::string const & tag = std::string()) const;
203         ///
204         void print() const;
205         // FIXME unused (was used for xforms. Do we still need this?)
206         //static docstring const getDescription(LyXRCTags);
207         ///
208         std::string bind_file;
209         ///
210         std::string def_file;
211         ///
212         std::string ui_file;
213         ///
214         std::string printer;
215         ///
216         std::string print_command;
217         ///
218         std::string print_evenpage_flag;
219         ///
220         std::string print_oddpage_flag;
221         ///
222         std::string print_pagerange_flag;
223         ///
224         std::string print_copies_flag;
225         ///
226         std::string print_collcopies_flag;
227         ///
228         std::string print_reverse_flag;
229         ///
230         std::string print_landscape_flag;
231         ///
232         std::string print_to_printer;
233         ///
234         bool print_adapt_output;
235         ///
236         std::string print_to_file;
237         ///
238         std::string print_file_extension;
239         ///
240         std::string print_extra_options;
241         ///
242         std::string print_spool_command;
243         ///
244         std::string print_spool_printerprefix;
245         ///
246         std::string print_paper_flag;
247         ///
248         std::string print_paper_dimension_flag;
249         /// option for telling the dvi viewer about the paper size
250         std::string view_dvi_paper_option;
251         /// default paper size for local xdvi/dvips/ghostview/whatever
252         PAPER_SIZE default_papersize;
253         /// command to run chktex incl. options
254         std::string chktex_command;
255         /// all available commands to run bibtex incl. options
256         std::set<std::string> bibtex_alternatives;
257         /// command to run bibtex incl. options
258         std::string bibtex_command;
259         /// command to run japanese bibtex incl. options
260         std::string jbibtex_command;
261         /// all available index commands incl. options
262         std::set<std::string> index_alternatives;
263         /// command to run makeindex incl. options or other index programs
264         std::string index_command;
265         /// command to run japanese index program incl. options
266         std::string jindex_command;
267         /// command to generate multiple indices
268         std::string splitindex_command;
269         /// command to run makeindex incl. options for nomencl
270         std::string nomencl_command;
271         ///
272         std::string document_path;
273         ///
274         std::string example_path;
275         ///
276         std::string template_path;
277         ///
278         std::string tempdir_path;
279         ///
280         std::string thesaurusdir_path;
281         ///
282         std::string hunspelldir_path;
283         ///
284         bool auto_region_delete;
285         /// flag telling whether lastfiles should be checked for existance
286         bool auto_reset_options;
287         ///
288         bool check_lastfiles;
289         /// maximal number of lastfiles
290         unsigned int num_lastfiles;
291         /// whether or not go to saved position when opening a file
292         bool use_lastfilepos;
293         /// load files from last session automatically
294         bool load_session;
295         /// shall a backup file be created
296         bool make_backup;
297         /// A directory for storing backup files
298         std::string backupdir_path;
299         /// Whether or not save/restore session information
300         /// like windows position and geometry.
301         bool allow_geometry_session;
302         /// Scrolling speed of the mouse wheel
303         double mouse_wheel_speed;
304         /// Zoom factor for screen fonts
305         unsigned int zoom;
306         /// Screen font sizes in points for each font size
307         std::string font_sizes[10];
308         /// Allow the use of scalable fonts? Default is yes.
309         bool use_scalable_fonts;
310         /// DPI of monitor
311         unsigned int dpi;
312         ///
313         std::string fontenc;
314         ///
315         std::string roman_font_name;
316         ///
317         std::string sans_font_name;
318         ///
319         std::string typewriter_font_name;
320         ///
321         std::string roman_font_foundry;
322         ///
323         std::string sans_font_foundry;
324         ///
325         std::string typewriter_font_foundry;
326         ///
327         unsigned int autosave;
328         ///
329         unsigned int plaintext_linelen;
330         /// Accept compound words in spellchecker?
331         bool spellchecker_accept_compound;
332         /// End of paragraph markers?
333         bool paragraph_markers;
334         /// Use tooltips?
335         bool use_tooltip;
336         /// Use pixmap cache?
337         bool use_pixmap_cache;
338         /// Spellchecker engine: aspell, hunspell, etc
339         std::string spellchecker;
340         /// Alternate language for spellchecker
341         std::string spellchecker_alt_lang;
342         /// Escape characters
343         std::string spellchecker_esc_chars;
344         /// spellcheck continuously?
345         bool spellcheck_continuously;
346         ///
347         bool use_kbmap;
348         ///
349         std::string primary_kbmap;
350         ///
351         std::string secondary_kbmap;
352         ///
353         std::string lyxpipes;
354         ///
355         std::string date_insert_format;
356         ///
357         std::string language_package;
358         ///
359         bool language_auto_begin;
360         ///
361         bool language_auto_end;
362         ///
363         std::string language_command_begin;
364         ///
365         std::string language_command_end;
366         ///
367         std::string language_command_local;
368         ///
369         bool language_global_options;
370         ///
371         bool language_use_babel;
372         ///
373         bool rtl_support;
374         /// bidi cursor movement: true = visual, false = logical
375         bool visual_cursor;
376         ///
377         bool auto_number;
378         ///
379         bool mark_foreign_language;
380         ///
381         std::string default_language;
382         ///
383         std::string gui_language;
384         ///
385         std::string default_view_format;
386         ///
387         bool mac_like_word_movement;
388         ///
389         bool cursor_follows_scrollbar;
390         ///
391         bool scroll_below_document;
392         ///
393         enum MacroEditStyle {
394                 MACRO_EDIT_INLINE_BOX = 0,
395                 MACRO_EDIT_INLINE,
396                 MACRO_EDIT_LIST
397         };
398         ///
399         MacroEditStyle macro_edit_style;
400         ///
401         bool dialogs_iconify_with_main;
402         ///
403         int label_init_length;
404         ///
405         bool display_graphics;
406         ///
407         bool show_banner;
408         ///
409         enum PreviewStatus {
410                 PREVIEW_OFF,
411                 PREVIEW_NO_MATH,
412                 PREVIEW_ON
413         };
414         ///
415         PreviewStatus preview;
416         ///
417         bool preview_hashed_labels;
418         ///
419         std::string preview_scale_factor;
420         /// user name
421         std::string user_name;
422         /// user email
423         std::string user_email;
424         /// True if the TeX engine cannot handle posix paths
425         bool windows_style_tex_paths;
426         /// True if the TeX engine can handle file names containing spaces
427         bool tex_allows_spaces;
428         /** Prepend paths to the PATH environment variable.
429          *  The string is input, stored and output in native format.
430          */
431         std::string path_prefix;
432         /// Use the cache for file converters?
433         bool use_converter_cache;
434         /// The maximum age of cache files in seconds
435         unsigned int converter_cache_maxage;
436         /// Sort layouts alphabetically
437         bool sort_layouts;
438         /// Group layout by their category
439         bool group_layouts;
440         /// Toggle toolbars in fullscreen mode?
441         bool full_screen_toolbars;
442         /// Toggle scrollbar in fullscreen mode?
443         bool full_screen_scrollbar;
444         /// Toggle tabbar in fullscreen mode?
445         bool full_screen_tabbar;
446         /// Toggle menubar in fullscreen mode?
447         bool full_screen_menubar;
448         /// Limit the text width?
449         bool full_screen_limit;
450         /// Width of limited screen (in pixels) in fullscreen mode
451         int full_screen_width;
452         ///
453         bool completion_cursor_text;
454         ///
455         double completion_inline_delay;
456         ///
457         bool completion_inline_math;
458         ///
459         bool completion_inline_text;
460         ///
461         int completion_inline_dots;
462         ///
463         bool autocorrection_math;
464         ///
465         double completion_popup_delay;
466         ///
467         bool completion_popup_math;
468         ///
469         bool completion_popup_text;
470         ///
471         bool completion_popup_after_complete;
472         ///
473         bool open_buffers_in_tabs;
474 };
475
476
477 /** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
478  *  It can be forward-declared and passed as a function argument without
479  *  having to expose LyXRC.h.
480  */
481 class LyXRC_PreviewStatus {
482         LyXRC::PreviewStatus val_;
483 public:
484         LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
485         operator LyXRC::PreviewStatus() const { return val_; }
486 };
487
488
489 ///
490 extern LyXRC lyxrc;
491 ///
492 extern LyXRC system_lyxrc;
493
494 // used by at least frontends/qt4/GuiPref.cpp
495 const long maxlastfiles = 20;
496
497 } // namespace lyx
498
499 #endif