]> git.lyx.org Git - lyx.git/blob - src/LyXRC.h
rename MathArray into MathData
[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 #include "graphics/GraphicsTypes.h"
23
24 #include <iosfwd>
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 //: public noncopyable 
36 // after 1.1.6 I will use a LyXRCStruct here and then this can be made
37 // noncopyable again.  For now I want to minimise changes.  ARRae 20001010
38 {
39 public:
40         enum LyXRCTags {
41                 RC_ACCEPT_COMPOUND = 1,
42                 RC_ALT_LANG,
43                 RC_PLAINTEXT_ROFF_COMMAND,
44                 RC_PLAINTEXT_LINELEN,
45                 RC_AUTOREGIONDELETE,
46                 RC_AUTORESET_OPTIONS,
47                 RC_AUTOSAVE,
48                 RC_AUTO_NUMBER,
49                 RC_BACKUPDIR_PATH,
50                 RC_BIBTEX_COMMAND,
51                 RC_BINDFILE,
52                 RC_CHECKLASTFILES,
53                 RC_CHKTEX_COMMAND,
54                 RC_CONVERTER,
55                 RC_CONVERTER_CACHE_MAXAGE,
56                 RC_COPIER,
57                 RC_CURSOR_FOLLOWS_SCROLLBAR,
58                 RC_CUSTOM_EXPORT_COMMAND,
59                 RC_CUSTOM_EXPORT_FORMAT,
60                 RC_DATE_INSERT_FORMAT,
61                 RC_DEFAULT_LANGUAGE,
62                 RC_DEFAULT_PAPERSIZE,
63                 RC_DIALOGS_ICONIFY_WITH_MAIN,
64                 RC_DISPLAY_GRAPHICS,
65                 RC_DOCUMENTPATH,
66                 RC_ESC_CHARS,
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_USELASTFILEPOS,
84                 RC_LOADSESSION,
85                 RC_MAKE_BACKUP,
86                 RC_MARK_FOREIGN_LANGUAGE,
87                 RC_NUMLASTFILES,
88                 RC_PATH_PREFIX,
89                 RC_PERS_DICT,
90                 RC_PREVIEW,
91                 RC_PREVIEW_HASHED_LABELS,
92                 RC_PREVIEW_SCALE_FACTOR,
93                 RC_PRINTCOLLCOPIESFLAG,
94                 RC_PRINTCOPIESFLAG,
95                 RC_PRINTER,
96                 RC_PRINTEVENPAGEFLAG,
97                 RC_PRINTEXSTRAOPTIONS,
98                 RC_PRINTFILEEXTENSION,
99                 RC_PRINTLANDSCAPEFLAG,
100                 RC_PRINTODDPAGEFLAG,
101                 RC_PRINTPAGERANGEFLAG,
102                 RC_PRINTPAPERDIMENSIONFLAG,
103                 RC_PRINTPAPERFLAG,
104                 RC_PRINTREVERSEFLAG,
105                 RC_PRINTSPOOL_COMMAND,
106                 RC_PRINTSPOOL_PRINTERPREFIX,
107                 RC_PRINTTOFILE,
108                 RC_PRINTTOPRINTER,
109                 RC_PRINT_ADAPTOUTPUT,
110                 RC_PRINT_COMMAND,
111                 RC_RTL_SUPPORT,
112                 RC_SCREEN_DPI,
113                 RC_SCREEN_FONT_ROMAN,
114                 RC_SCREEN_FONT_ROMAN_FOUNDRY,
115                 RC_SCREEN_FONT_SANS,
116                 RC_SCREEN_FONT_SANS_FOUNDRY,
117                 RC_SCREEN_FONT_SCALABLE,
118                 RC_SCREEN_FONT_SIZES,
119                 RC_SCREEN_FONT_TYPEWRITER,
120                 RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
121                 RC_SCREEN_GEOMETRY_HEIGHT,
122                 RC_SCREEN_GEOMETRY_WIDTH,
123                 RC_SCREEN_GEOMETRY_XYSAVED,
124                 RC_SCREEN_ZOOM,
125                 RC_SERVERPIPE,
126                 RC_SET_COLOR,
127                 RC_SHOW_BANNER,
128                 RC_SPELL_COMMAND,
129                 RC_TEMPDIRPATH,
130                 RC_TEMPLATEPATH,
131                 RC_TEX_ALLOWS_SPACES,
132                 RC_TEX_EXPECTS_WINDOWS_PATHS,
133                 RC_UIFILE,
134                 RC_USER_EMAIL,
135                 RC_USER_NAME,
136                 RC_USETEMPDIR,
137                 RC_USE_ALT_LANG,
138                 RC_USE_CONVERTER_CACHE,
139                 RC_USE_ESC_CHARS,
140                 RC_USE_INP_ENC,
141                 RC_USE_PERS_DICT,
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         ///
164         void write(std::ostream & os,
165                    bool ignore_system_lyxrc) const;
166         ///
167         void print() const;
168         // FIXME unused (was used for xforms. Do we still need this?)
169         //static docstring const getDescription(LyXRCTags);
170         ///
171         std::string bind_file;
172         ///
173         std::string ui_file;
174         ///
175         std::string printer;
176         ///
177         std::string print_command;
178         ///
179         std::string print_evenpage_flag;
180         ///
181         std::string print_oddpage_flag;
182         ///
183         std::string print_pagerange_flag;
184         ///
185         std::string print_copies_flag;
186         ///
187         std::string print_collcopies_flag;
188         ///
189         std::string print_reverse_flag;
190         ///
191         std::string print_landscape_flag;
192         ///
193         std::string print_to_printer;
194         ///
195         bool print_adapt_output;
196         ///
197         std::string print_to_file;
198         ///
199         std::string print_file_extension;
200         ///
201         std::string print_extra_options;
202         ///
203         std::string print_spool_command;
204         ///
205         std::string print_spool_printerprefix;
206         ///
207         std::string print_paper_flag;
208         ///
209         std::string print_paper_dimension_flag;
210         ///
211         std::string custom_export_command;
212         ///
213         std::string custom_export_format;
214         /// option for telling the dvi viewer about the paper size
215         std::string view_dvi_paper_option;
216         /// default paper size for local xdvi/dvips/ghostview/whatever
217         PAPER_SIZE default_papersize;
218         /// command to run chktex incl. options
219         std::string chktex_command;
220         /// command to run bibtex incl. options
221         std::string bibtex_command;
222         /// command to run makeindex incl. options or other index programs
223         std::string index_command;
224         ///
225         std::string document_path;
226         ///
227         std::string template_path;
228         ///
229         std::string tempdir_path;
230         ///
231         bool auto_region_delete;
232         /// flag telling whether lastfiles should be checked for existance
233         bool auto_reset_options;
234         ///
235         bool check_lastfiles;
236         /// maximal number of lastfiles
237         unsigned int num_lastfiles;
238         /// whether or not go to saved position when opening a file
239         bool use_lastfilepos;
240         /// load files from last session automatically
241         bool load_session;
242         /// shall a backup file be created
243         bool make_backup;
244         /// A directory for storing backup files
245         std::string backupdir_path;
246         /// Width of MainWindow. if 0, value from last session will be used
247         int geometry_width;
248         /// Height of MainWindow, if 0, value from last session will be used
249         int geometry_height;
250         /// Whether or not save/restore windows position as session info
251         bool geometry_xysaved;
252         /// Zoom factor for screen fonts
253         unsigned int zoom;
254         /// Screen font sizes in points for each font size
255         std::string font_sizes[10];
256         /// Allow the use of scalable fonts? Default is yes.
257         bool use_scalable_fonts;
258         /// DPI of monitor
259         unsigned int dpi;
260         ///
261         std::string fontenc;
262         ///
263         std::string roman_font_name;
264         ///
265         std::string sans_font_name;
266         ///
267         std::string typewriter_font_name;
268         ///
269         std::string roman_font_foundry;
270         ///
271         std::string sans_font_foundry;
272         ///
273         std::string typewriter_font_foundry;
274         ///
275         unsigned int autosave;
276         ///
277         std::string plaintext_roff_command;
278         ///
279         unsigned int plaintext_linelen;
280         /// use library instead of process
281         bool use_spell_lib;
282         /// Ispell command
283         std::string isp_command;
284         /// Accept compound words in spellchecker?
285         bool isp_accept_compound;
286         /// Pass input encoding switch to ispell?
287         bool isp_use_input_encoding;
288         /// Use alternate language?
289         bool isp_use_alt_lang;
290         /// Use personal dictionary?
291         bool isp_use_pers_dict;
292         /// Use escape chars?
293         bool isp_use_esc_chars;
294         /// Alternate language for ispell
295         std::string isp_alt_lang;
296         /// Alternate personal dictionary file for ispell
297         std::string isp_pers_dict;
298         /// Escape characters
299         std::string isp_esc_chars;
300         ///
301         bool use_kbmap;
302         ///
303         std::string primary_kbmap;
304         ///
305         std::string secondary_kbmap;
306         ///
307         std::string lyxpipes;
308         ///
309         std::string date_insert_format;
310         ///
311         std::string language_package;
312         ///
313         bool language_auto_begin;
314         ///
315         bool language_auto_end;
316         ///
317         std::string language_command_begin;
318         ///
319         std::string language_command_end;
320         ///
321         std::string language_command_local;
322         ///
323         bool language_global_options;
324         ///
325         bool language_use_babel;
326         ///
327         bool rtl_support;
328         ///
329         bool auto_number;
330         ///
331         bool mark_foreign_language;
332         ///
333         std::string default_language;
334         ///
335         bool cursor_follows_scrollbar;
336         ///
337         bool dialogs_iconify_with_main;
338         ///
339         int label_init_length;
340         ///
341         graphics::DisplayType display_graphics;
342         ///
343         bool show_banner;
344         ///
345         enum PreviewStatus {
346                 PREVIEW_OFF,
347                 PREVIEW_NO_MATH,
348                 PREVIEW_ON
349         };
350         ///
351         PreviewStatus preview;
352         ///
353         bool preview_hashed_labels;
354         ///
355         std::string preview_scale_factor;
356         /// user name
357         std::string user_name;
358         /// user email
359         std::string user_email;
360         /// True if the TeX engine cannot handle posix paths
361         bool windows_style_tex_paths;
362         /// True if the TeX engine can handle file names containing spaces
363         bool tex_allows_spaces;
364         /** Prepend paths to the PATH environment variable.
365          *  The string is input, stored and output in native format.
366          */
367         std::string path_prefix;
368         /// Use the cache for file converters?
369         bool use_converter_cache;
370         /// The maximum age of cache files in seconds
371         unsigned int converter_cache_maxage;
372 };
373
374
375 /** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
376  *  It can be forward-declared and passed as a function argument without
377  *  having to expose LyXRC.h.
378  */
379 class LyXRC_PreviewStatus {
380         LyXRC::PreviewStatus val_;
381 public:
382         LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
383         operator LyXRC::PreviewStatus() const{ return val_; }
384 };
385
386
387 ///
388 extern LyXRC lyxrc;
389 ///
390 extern LyXRC system_lyxrc;
391
392 } // namespace lyx
393
394 #endif