]> git.lyx.org Git - lyx.git/blob - src/LyXRC.h
3b5daaedbe664b7c3d221f498ece02e6c3efb63c
[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_BUNDLED_FORMAT,
156                 RC_USE_CONVERTER_CACHE,
157                 RC_USE_ESC_CHARS,
158                 RC_USE_INP_ENC,
159                 RC_USE_PERS_DICT,
160                 RC_USE_TOOLTIP,
161                 RC_USE_PIXMAP_CACHE,
162                 RC_USE_SPELL_LIB,
163                 RC_VIEWDVI_PAPEROPTION,
164                 RC_VIEWER,
165                 RC_VISUAL_CURSOR,
166                 RC_LAST
167         };
168
169         ///
170         LyXRC();
171         ///
172         void setDefaults();
173         ///
174         int read(support::FileName const & filename);
175         ///
176         int read(std::istream &);
177 private:
178         ///
179         int read(Lexer &);
180 public:
181         ///
182         void write(support::FileName const & filename,
183                    bool ignore_system_lyxrc) const;
184         /// write rc. If a specific tag is given, only output that one.
185         void write(std::ostream & os,
186                    bool ignore_system_lyxrc, 
187                    std::string const & tag = std::string()) const;
188         ///
189         void print() const;
190         // FIXME unused (was used for xforms. Do we still need this?)
191         //static docstring const getDescription(LyXRCTags);
192         ///
193         std::string bind_file;
194         ///
195         std::string def_file;
196         ///
197         std::string ui_file;
198         ///
199         std::string printer;
200         ///
201         std::string print_command;
202         ///
203         std::string print_evenpage_flag;
204         ///
205         std::string print_oddpage_flag;
206         ///
207         std::string print_pagerange_flag;
208         ///
209         std::string print_copies_flag;
210         ///
211         std::string print_collcopies_flag;
212         ///
213         std::string print_reverse_flag;
214         ///
215         std::string print_landscape_flag;
216         ///
217         std::string print_to_printer;
218         ///
219         bool print_adapt_output;
220         ///
221         std::string print_to_file;
222         ///
223         std::string print_file_extension;
224         ///
225         std::string print_extra_options;
226         ///
227         std::string print_spool_command;
228         ///
229         std::string print_spool_printerprefix;
230         ///
231         std::string print_paper_flag;
232         ///
233         std::string print_paper_dimension_flag;
234         ///
235         std::string custom_export_command;
236         ///
237         std::string custom_export_format;
238         /// option for telling the dvi viewer about the paper size
239         std::string view_dvi_paper_option;
240         /// default paper size for local xdvi/dvips/ghostview/whatever
241         PAPER_SIZE default_papersize;
242         /// command to run chktex incl. options
243         std::string chktex_command;
244         /// command to run bibtex incl. options
245         std::string bibtex_command;
246         /// command to run makeindex incl. options or other index programs
247         std::string index_command;
248         ///
249         std::string document_path;
250         ///
251         std::string example_path;
252         ///
253         std::string template_path;
254         ///
255         std::string tempdir_path;
256         ///
257         bool auto_region_delete;
258         /// flag telling whether lastfiles should be checked for existance
259         bool auto_reset_options;
260         ///
261         bool check_lastfiles;
262         /// maximal number of lastfiles
263         unsigned int num_lastfiles;
264         /// whether or not go to saved position when opening a file
265         bool use_lastfilepos;
266         /// load files from last session automatically
267         bool load_session;
268         /// shall a backup file be created
269         bool make_backup;
270         /// A directory for storing backup files
271         std::string backupdir_path;
272         /// Whether or not save/restore session information
273         /// like windows position and geometry.
274         bool allow_geometry_session;
275         /// Scrolling speed of the mouse wheel
276         double mouse_wheel_speed;
277         /// Zoom factor for screen fonts
278         unsigned int zoom;
279         /// Screen font sizes in points for each font size
280         std::string font_sizes[10];
281         /// Allow the use of scalable fonts? Default is yes.
282         bool use_scalable_fonts;
283         /// DPI of monitor
284         unsigned int dpi;
285         ///
286         std::string fontenc;
287         ///
288         std::string roman_font_name;
289         ///
290         std::string sans_font_name;
291         ///
292         std::string typewriter_font_name;
293         ///
294         std::string roman_font_foundry;
295         ///
296         std::string sans_font_foundry;
297         ///
298         std::string typewriter_font_foundry;
299         ///
300         unsigned int autosave;
301         ///
302         std::string plaintext_roff_command;
303         ///
304         unsigned int plaintext_linelen;
305         /// use library instead of process
306         bool use_spell_lib;
307         /// Ispell command
308         std::string isp_command;
309         /// Accept compound words in spellchecker?
310         bool isp_accept_compound;
311         /// Pass input encoding switch to ispell?
312         bool isp_use_input_encoding;
313         /// Use alternate language?
314         bool isp_use_alt_lang;
315         /// Use personal dictionary?
316         bool isp_use_pers_dict;
317         /// Use tooltips?
318         bool use_tooltip;
319         /// Use pixmap cache?
320         bool use_pixmap_cache;
321         /// Use escape chars?
322         bool isp_use_esc_chars;
323         /// Alternate language for ispell
324         std::string isp_alt_lang;
325         /// Alternate personal dictionary file for ispell
326         std::string isp_pers_dict;
327         /// Escape characters
328         std::string isp_esc_chars;
329         ///
330         bool use_kbmap;
331         ///
332         std::string primary_kbmap;
333         ///
334         std::string secondary_kbmap;
335         ///
336         std::string lyxpipes;
337         ///
338         std::string date_insert_format;
339         ///
340         std::string language_package;
341         ///
342         bool language_auto_begin;
343         ///
344         bool language_auto_end;
345         ///
346         std::string language_command_begin;
347         ///
348         std::string language_command_end;
349         ///
350         std::string language_command_local;
351         ///
352         bool language_global_options;
353         ///
354         bool language_use_babel;
355         ///
356         bool rtl_support;
357         /// bidi cursor movement: true = visual, false = logical
358         bool visual_cursor;
359         ///
360         bool auto_number;
361         ///
362         bool mark_foreign_language;
363         ///
364         std::string default_language;
365         ///
366         bool cursor_follows_scrollbar;
367         ///
368         enum MacroEditStyle {
369                 MACRO_EDIT_INLINE_BOX = 0,
370                 MACRO_EDIT_INLINE,
371                 MACRO_EDIT_LIST
372         };
373         ///
374         MacroEditStyle macro_edit_style;
375         ///
376         bool dialogs_iconify_with_main;
377         ///
378         int label_init_length;
379         ///
380         ///graphics::DisplayType
381         int display_graphics;
382         ///
383         bool show_banner;
384         ///
385         enum PreviewStatus {
386                 PREVIEW_OFF,
387                 PREVIEW_NO_MATH,
388                 PREVIEW_ON
389         };
390         ///
391         PreviewStatus preview;
392         ///
393         bool preview_hashed_labels;
394         ///
395         std::string preview_scale_factor;
396         /// user name
397         std::string user_name;
398         /// user email
399         std::string user_email;
400         /// True if the TeX engine cannot handle posix paths
401         bool windows_style_tex_paths;
402         /// True if the TeX engine can handle file names containing spaces
403         bool tex_allows_spaces;
404         /** Prepend paths to the PATH environment variable.
405          *  The string is input, stored and output in native format.
406          */
407         std::string path_prefix;
408         /// Use the cache for file converters?
409         bool use_converter_cache;
410         /// The maximum age of cache files in seconds
411         unsigned int converter_cache_maxage;
412         /// Sort layouts alphabetically
413         bool sort_layouts;
414         /// Group layout by their category
415         bool group_layouts;
416         /// Toggle toolbars in fullscreen mode?
417         bool full_screen_toolbars;
418         /// Toggle scrollbar in fullscreen mode?
419         bool full_screen_scrollbar;
420         /// Toggle tabbar in fullscreen mode?
421         bool full_screen_tabbar;
422         /// Limit the text width?
423         bool full_screen_limit;
424         /// Width of limited screen (in pixels) in fullscreen mode
425         int full_screen_width;
426         ///
427         bool completion_cursor_text;
428         ///
429         double completion_inline_delay;
430         ///
431         bool completion_inline_math;
432         ///
433         bool completion_inline_text;
434         ///
435         int completion_inline_dots;
436         ///
437         double completion_popup_delay;
438         ///
439         bool completion_popup_math;
440         ///
441         bool completion_popup_text;
442         ///
443         bool completion_popup_after_complete;
444         ///
445         bool open_buffers_in_tabs;
446         ///
447         bool use_bundled_format;
448 };
449
450
451 /** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
452  *  It can be forward-declared and passed as a function argument without
453  *  having to expose LyXRC.h.
454  */
455 class LyXRC_PreviewStatus {
456         LyXRC::PreviewStatus val_;
457 public:
458         LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
459         operator LyXRC::PreviewStatus() const { return val_; }
460 };
461
462
463 ///
464 extern LyXRC lyxrc;
465 ///
466 extern LyXRC system_lyxrc;
467
468 } // namespace lyx
469
470 #endif