]> git.lyx.org Git - lyx.git/blob - src/lyxrc.h
Allows editing when the Prefs dialog is opened; fix bug 3140:
[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 LyXLex;
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_POPUP_BOLD_FONT,
91                 RC_POPUP_FONT_ENCODING,
92                 RC_POPUP_NORMAL_FONT,
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_ENCODING,
117                 RC_SCREEN_FONT_ROMAN,
118                 RC_SCREEN_FONT_ROMAN_FOUNDRY,
119                 RC_SCREEN_FONT_SANS,
120                 RC_SCREEN_FONT_SANS_FOUNDRY,
121                 RC_SCREEN_FONT_SCALABLE,
122                 RC_SCREEN_FONT_SIZES,
123                 RC_SCREEN_FONT_TYPEWRITER,
124                 RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
125                 RC_SCREEN_GEOMETRY_HEIGHT,
126                 RC_SCREEN_GEOMETRY_WIDTH,
127                 RC_SCREEN_GEOMETRY_XYSAVED,
128                 RC_SCREEN_ZOOM,
129                 RC_SERVERPIPE,
130                 RC_SET_COLOR,
131                 RC_SHOW_BANNER,
132                 RC_SPELL_COMMAND,
133                 RC_TEMPDIRPATH,
134                 RC_TEMPLATEPATH,
135                 RC_TEX_ALLOWS_SPACES,
136                 RC_TEX_EXPECTS_WINDOWS_PATHS,
137                 RC_UIFILE,
138                 RC_USER_EMAIL,
139                 RC_USER_NAME,
140                 RC_USETEMPDIR,
141                 RC_USE_ALT_LANG,
142                 RC_USE_CONVERTER_CACHE,
143                 RC_USE_ESC_CHARS,
144                 RC_USE_INP_ENC,
145                 RC_USE_PERS_DICT,
146                 RC_USE_SPELL_LIB,
147                 RC_VIEWDVI_PAPEROPTION,
148                 RC_VIEWER,
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(LyXLex &);
163 public:
164         ///
165         void write(support::FileName const & filename,
166                    bool ignore_system_lyxrc) const;
167         ///
168         void write(std::ostream & os,
169                    bool ignore_system_lyxrc) const;
170         ///
171         void print() const;
172         // FIXME unused (was used for xforms. Do we still need this?)
173         //static docstring const getDescription(LyXRCTags);
174         ///
175         std::string bind_file;
176         ///
177         std::string ui_file;
178         ///
179         std::string printer;
180         ///
181         std::string print_command;
182         ///
183         std::string print_evenpage_flag;
184         ///
185         std::string print_oddpage_flag;
186         ///
187         std::string print_pagerange_flag;
188         ///
189         std::string print_copies_flag;
190         ///
191         std::string print_collcopies_flag;
192         ///
193         std::string print_reverse_flag;
194         ///
195         std::string print_landscape_flag;
196         ///
197         std::string print_to_printer;
198         ///
199         bool print_adapt_output;
200         ///
201         std::string print_to_file;
202         ///
203         std::string print_file_extension;
204         ///
205         std::string print_extra_options;
206         ///
207         std::string print_spool_command;
208         ///
209         std::string print_spool_printerprefix;
210         ///
211         std::string print_paper_flag;
212         ///
213         std::string print_paper_dimension_flag;
214         ///
215         std::string custom_export_command;
216         ///
217         std::string custom_export_format;
218         /// option for telling the dvi viewer about the paper size
219         std::string view_dvi_paper_option;
220         /// default paper size for local xdvi/dvips/ghostview/whatever
221         PAPER_SIZE default_papersize;
222         /// command to run chktex incl. options
223         std::string chktex_command;
224         /// command to run bibtex incl. options
225         std::string bibtex_command;
226         /// command to run makeindex incl. options or other index programs
227         std::string index_command;
228         ///
229         std::string document_path;
230         ///
231         std::string template_path;
232         ///
233         std::string tempdir_path;
234         ///
235         bool auto_region_delete;
236         /// flag telling whether lastfiles should be checked for existance
237         bool auto_reset_options;
238         ///
239         bool check_lastfiles;
240         /// maximal number of lastfiles
241         unsigned int num_lastfiles;
242         /// whether or not go to saved position when opening a file
243         bool use_lastfilepos;
244         /// load files from last session automatically
245         bool load_session;
246         /// shall a backup file be created
247         bool make_backup;
248         /// A directory for storing backup files
249         std::string backupdir_path;
250         /// Width of MainWindow. if 0, value from last session will be used
251         int geometry_width;
252         /// Height of MainWindow, if 0, value from last session will be used
253         int geometry_height;
254         /// Whether or not save/restore windows position as session info
255         bool geometry_xysaved;
256         /// Zoom factor for screen fonts
257         unsigned int zoom;
258         /// Screen font sizes in points for each font size
259         std::string font_sizes[10];
260         /// Allow the use of scalable fonts? Default is yes.
261         bool use_scalable_fonts;
262         /// DPI of monitor
263         unsigned int dpi;
264         ///
265         std::string fontenc;
266         ///
267         std::string roman_font_name;
268         ///
269         std::string sans_font_name;
270         ///
271         std::string typewriter_font_name;
272         ///
273         std::string roman_font_foundry;
274         ///
275         std::string sans_font_foundry;
276         ///
277         std::string typewriter_font_foundry;
278         ///
279         std::string popup_bold_font;
280         ///
281         std::string popup_normal_font;
282         ///
283         std::string font_norm;
284         ///
285         enum FontEncoding {
286                 ///
287                 ISO_10646_1,
288                 ///
289                 ISO_8859_1,
290                 ///
291                 ISO_8859_3,
292                 ///
293                 ISO_8859_4,
294                 ///
295                 ISO_8859_6_8,
296                 ///
297                 ISO_8859_9,
298                 ///
299                 ISO_8859_15,
300                 ///
301                 OTHER_ENCODING
302         };
303         ///
304         FontEncoding font_norm_type;
305         ///
306         void set_font_norm_type();
307         ///
308         std::string popup_font_encoding;
309         ///
310         unsigned int autosave;
311         ///
312         std::string plaintext_roff_command;
313         ///
314         unsigned int plaintext_linelen;
315         /// use library instead of process
316         bool use_spell_lib;
317         /// Ispell command
318         std::string isp_command;
319         /// Accept compound words in spellchecker?
320         bool isp_accept_compound;
321         /// Pass input encoding switch to ispell?
322         bool isp_use_input_encoding;
323         /// Use alternate language?
324         bool isp_use_alt_lang;
325         /// Use personal dictionary?
326         bool isp_use_pers_dict;
327         /// Use escape chars?
328         bool isp_use_esc_chars;
329         /// Alternate language for ispell
330         std::string isp_alt_lang;
331         /// Alternate personal dictionary file for ispell
332         std::string isp_pers_dict;
333         /// Escape characters
334         std::string isp_esc_chars;
335         ///
336         bool use_kbmap;
337         ///
338         std::string primary_kbmap;
339         ///
340         std::string secondary_kbmap;
341         ///
342         std::string lyxpipes;
343         ///
344         std::string date_insert_format;
345         ///
346         std::string language_package;
347         ///
348         bool language_auto_begin;
349         ///
350         bool language_auto_end;
351         ///
352         std::string language_command_begin;
353         ///
354         std::string language_command_end;
355         ///
356         std::string language_command_local;
357         ///
358         bool language_global_options;
359         ///
360         bool language_use_babel;
361         ///
362         bool rtl_support;
363         ///
364         bool auto_number;
365         ///
366         bool mark_foreign_language;
367         ///
368         std::string default_language;
369         ///
370         bool cursor_follows_scrollbar;
371         ///
372         bool dialogs_iconify_with_main;
373         ///
374         int label_init_length;
375         ///
376         graphics::DisplayType display_graphics;
377         ///
378         bool show_banner;
379         ///
380         enum PreviewStatus {
381                 PREVIEW_OFF,
382                 PREVIEW_NO_MATH,
383                 PREVIEW_ON
384         };
385         ///
386         PreviewStatus preview;
387         ///
388         bool preview_hashed_labels;
389         ///
390         std::string preview_scale_factor;
391         /// user name
392         std::string user_name;
393         /// user email
394         std::string user_email;
395         /// True if the TeX engine cannot handle posix paths
396         bool windows_style_tex_paths;
397         /// True if the TeX engine can handle file names containing spaces
398         bool tex_allows_spaces;
399         /** Prepend paths to the PATH environment variable.
400          *  The string is input, stored and output in native format.
401          */
402         std::string path_prefix;
403         /// Use the cache for file converters?
404         bool use_converter_cache;
405         /// The maximum age of cache files in seconds
406         unsigned int converter_cache_maxage;
407 };
408
409
410 /** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
411  *  It can be forward-declared and passed as a function argument without
412  *  having to expose lyxrc.h.
413  */
414 class LyXRC_PreviewStatus {
415         LyXRC::PreviewStatus val_;
416 public:
417         LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
418         operator LyXRC::PreviewStatus() const{ return val_; }
419 };
420
421
422 ///
423 extern LyXRC lyxrc;
424 ///
425 extern LyXRC system_lyxrc;
426
427 } // namespace lyx
428
429 #endif