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