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