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