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