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