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