]> git.lyx.org Git - lyx.git/blob - src/lyxrc.h
* src/frontends/qt4/GuiWorkArea.C:
[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_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_ENCODING,
114                 RC_SCREEN_FONT_ROMAN,
115                 RC_SCREEN_FONT_ROMAN_FOUNDRY,
116                 RC_SCREEN_FONT_SANS,
117                 RC_SCREEN_FONT_SANS_FOUNDRY,
118                 RC_SCREEN_FONT_SCALABLE,
119                 RC_SCREEN_FONT_SIZES,
120                 RC_SCREEN_FONT_TYPEWRITER,
121                 RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
122                 RC_SCREEN_GEOMETRY_HEIGHT,
123                 RC_SCREEN_GEOMETRY_WIDTH,
124                 RC_SCREEN_GEOMETRY_XYSAVED,
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_SPELL_LIB,
144                 RC_VIEWDVI_PAPEROPTION,
145                 RC_VIEWER,
146                 RC_LAST
147         };
148
149         ///
150         LyXRC();
151         ///
152         void setDefaults();
153         ///
154         int read(support::FileName const & filename);
155         ///
156         int read(std::istream &);
157 private:
158         ///
159         int read(LyXLex &);
160 public:
161         ///
162         void write(support::FileName const & filename,
163                    bool ignore_system_lyxrc) const;
164         ///
165         void write(std::ostream & os,
166                    bool ignore_system_lyxrc) 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 ui_file;
175         ///
176         std::string printer;
177         ///
178         std::string print_command;
179         ///
180         std::string print_evenpage_flag;
181         ///
182         std::string print_oddpage_flag;
183         ///
184         std::string print_pagerange_flag;
185         ///
186         std::string print_copies_flag;
187         ///
188         std::string print_collcopies_flag;
189         ///
190         std::string print_reverse_flag;
191         ///
192         std::string print_landscape_flag;
193         ///
194         std::string print_to_printer;
195         ///
196         bool print_adapt_output;
197         ///
198         std::string print_to_file;
199         ///
200         std::string print_file_extension;
201         ///
202         std::string print_extra_options;
203         ///
204         std::string print_spool_command;
205         ///
206         std::string print_spool_printerprefix;
207         ///
208         std::string print_paper_flag;
209         ///
210         std::string print_paper_dimension_flag;
211         ///
212         std::string custom_export_command;
213         ///
214         std::string custom_export_format;
215         /// option for telling the dvi viewer about the paper size
216         std::string view_dvi_paper_option;
217         /// default paper size for local xdvi/dvips/ghostview/whatever
218         PAPER_SIZE default_papersize;
219         /// command to run chktex incl. options
220         std::string chktex_command;
221         /// command to run bibtex incl. options
222         std::string bibtex_command;
223         /// command to run makeindex incl. options or other index programs
224         std::string index_command;
225         ///
226         std::string document_path;
227         ///
228         std::string template_path;
229         ///
230         std::string tempdir_path;
231         ///
232         bool auto_region_delete;
233         /// flag telling whether lastfiles should be checked for existance
234         bool auto_reset_options;
235         ///
236         bool check_lastfiles;
237         /// maximal number of lastfiles
238         unsigned int num_lastfiles;
239         /// whether or not go to saved position when opening a file
240         bool use_lastfilepos;
241         /// load files from last session automatically
242         bool load_session;
243         /// shall a backup file be created
244         bool make_backup;
245         /// A directory for storing backup files
246         std::string backupdir_path;
247         /// Width of MainWindow. if 0, value from last session will be used
248         int geometry_width;
249         /// Height of MainWindow, if 0, value from last session will be used
250         int geometry_height;
251         /// Whether or not save/restore windows position as session info
252         bool geometry_xysaved;
253         /// Zoom factor for screen fonts
254         unsigned int zoom;
255         /// Screen font sizes in points for each font size
256         std::string font_sizes[10];
257         /// Allow the use of scalable fonts? Default is yes.
258         bool use_scalable_fonts;
259         /// DPI of monitor
260         unsigned int dpi;
261         ///
262         std::string fontenc;
263         ///
264         std::string roman_font_name;
265         ///
266         std::string sans_font_name;
267         ///
268         std::string typewriter_font_name;
269         ///
270         std::string roman_font_foundry;
271         ///
272         std::string sans_font_foundry;
273         ///
274         std::string typewriter_font_foundry;
275         ///
276         std::string font_norm;
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 escape chars?
296         bool isp_use_esc_chars;
297         /// Alternate language for ispell
298         std::string isp_alt_lang;
299         /// Alternate personal dictionary file for ispell
300         std::string isp_pers_dict;
301         /// Escape characters
302         std::string isp_esc_chars;
303         ///
304         bool use_kbmap;
305         ///
306         std::string primary_kbmap;
307         ///
308         std::string secondary_kbmap;
309         ///
310         std::string lyxpipes;
311         ///
312         std::string date_insert_format;
313         ///
314         std::string language_package;
315         ///
316         bool language_auto_begin;
317         ///
318         bool language_auto_end;
319         ///
320         std::string language_command_begin;
321         ///
322         std::string language_command_end;
323         ///
324         std::string language_command_local;
325         ///
326         bool language_global_options;
327         ///
328         bool language_use_babel;
329         ///
330         bool rtl_support;
331         ///
332         bool auto_number;
333         ///
334         bool mark_foreign_language;
335         ///
336         std::string default_language;
337         ///
338         bool cursor_follows_scrollbar;
339         ///
340         bool dialogs_iconify_with_main;
341         ///
342         int label_init_length;
343         ///
344         graphics::DisplayType display_graphics;
345         ///
346         bool show_banner;
347         ///
348         enum PreviewStatus {
349                 PREVIEW_OFF,
350                 PREVIEW_NO_MATH,
351                 PREVIEW_ON
352         };
353         ///
354         PreviewStatus preview;
355         ///
356         bool preview_hashed_labels;
357         ///
358         std::string preview_scale_factor;
359         /// user name
360         std::string user_name;
361         /// user email
362         std::string user_email;
363         /// True if the TeX engine cannot handle posix paths
364         bool windows_style_tex_paths;
365         /// True if the TeX engine can handle file names containing spaces
366         bool tex_allows_spaces;
367         /** Prepend paths to the PATH environment variable.
368          *  The string is input, stored and output in native format.
369          */
370         std::string path_prefix;
371         /// Use the cache for file converters?
372         bool use_converter_cache;
373         /// The maximum age of cache files in seconds
374         unsigned int converter_cache_maxage;
375 };
376
377
378 /** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
379  *  It can be forward-declared and passed as a function argument without
380  *  having to expose lyxrc.h.
381  */
382 class LyXRC_PreviewStatus {
383         LyXRC::PreviewStatus val_;
384 public:
385         LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
386         operator LyXRC::PreviewStatus() const{ return val_; }
387 };
388
389
390 ///
391 extern LyXRC lyxrc;
392 ///
393 extern LyXRC system_lyxrc;
394
395 } // namespace lyx
396
397 #endif