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