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