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