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