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