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