]> git.lyx.org Git - lyx.git/blob - src/lyxrc.h
ws changes mostly
[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_CYGWIN_PATH_FIX,
55                 RC_DATE_INSERT_FORMAT,
56                 RC_DEFAULT_LANGUAGE,
57                 RC_DEFAULT_PAPERSIZE,
58                 RC_DIALOGS_ICONIFY_WITH_MAIN,
59                 RC_DISPLAY_GRAPHICS,
60                 RC_DOCUMENTPATH,
61                 RC_ESC_CHARS,
62                 RC_FONT_ENCODING,
63                 RC_FORMAT,
64                 RC_INDEX_COMMAND,
65                 RC_INPUT,
66                 RC_KBMAP,
67                 RC_KBMAP_PRIMARY,
68                 RC_KBMAP_SECONDARY,
69                 RC_LABEL_INIT_LENGTH,
70                 RC_LANGUAGE_AUTO_BEGIN,
71                 RC_LANGUAGE_AUTO_END,
72                 RC_LANGUAGE_COMMAND_BEGIN,
73                 RC_LANGUAGE_COMMAND_END,
74                 RC_LANGUAGE_COMMAND_LOCAL,
75                 RC_LANGUAGE_GLOBAL_OPTIONS,
76                 RC_LANGUAGE_PACKAGE,
77                 RC_LANGUAGE_USE_BABEL,
78                 RC_LASTFILES,
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_ZOOM,
120                 RC_SERVERPIPE,
121                 RC_SET_COLOR,
122                 RC_SHOW_BANNER,
123                 RC_SPELL_COMMAND,
124                 RC_TEMPDIRPATH,
125                 RC_TEMPLATEPATH,
126                 RC_UIFILE,
127                 RC_USER_EMAIL,
128                 RC_USER_NAME,
129                 RC_USETEMPDIR,
130                 RC_USE_ALT_LANG,
131                 RC_USE_ESC_CHARS,
132                 RC_USE_INP_ENC,
133                 RC_USE_PERS_DICT,
134                 RC_USE_SPELL_LIB,
135                 RC_VIEWDVI_PAPEROPTION,
136                 RC_VIEWER,
137                 RC_WHEEL_JUMP,
138                 RC_LAST
139         };
140
141         ///
142         LyXRC();
143         ///
144         void setDefaults();
145         ///
146         int read(std::string const & filename);
147         ///
148         int read(std::istream &);
149 private:
150         ///
151         int read(LyXLex &);
152 public:
153         ///
154         void write(std::string const & filename,
155                    bool ignore_system_lyxrc) const;
156         ///
157         void write(std::ostream & os,
158                    bool ignore_system_lyxrc) const;
159         ///
160         void print() const;
161         ///
162         static std::string const getDescription(LyXRCTags);
163         ///
164         std::string bind_file;
165         ///
166         std::string ui_file;
167         ///
168         std::string printer;
169         ///
170         std::string print_command;
171         ///
172         std::string print_evenpage_flag;
173         ///
174         std::string print_oddpage_flag;
175         ///
176         std::string print_pagerange_flag;
177         ///
178         std::string print_copies_flag;
179         ///
180         std::string print_collcopies_flag;
181         ///
182         std::string print_reverse_flag;
183         ///
184         std::string print_landscape_flag;
185         ///
186         std::string print_to_printer;
187         ///
188         bool print_adapt_output;
189         ///
190         std::string print_to_file;
191         ///
192         std::string print_file_extension;
193         ///
194         std::string print_extra_options;
195         ///
196         std::string print_spool_command;
197         ///
198         std::string print_spool_printerprefix;
199         ///
200         std::string print_paper_flag;
201         ///
202         std::string print_paper_dimension_flag;
203         ///
204         std::string custom_export_command;
205         ///
206         std::string custom_export_format;
207         /// option for telling the dvi viewer about the paper size
208         std::string view_dvi_paper_option;
209         /// default paper size for local xdvi/dvips/ghostview/whatever
210         PAPER_SIZE default_papersize;
211         /// command to run chktex incl. options
212         std::string chktex_command;
213         /// command to run bibtex incl. options
214         std::string bibtex_command;
215         /// command to run makeindex incl. options or other index programs
216         std::string index_command;
217         ///
218         std::string document_path;
219         ///
220         std::string template_path;
221         ///
222         std::string tempdir_path;
223         ///
224         bool auto_region_delete;
225         /// flag telling whether lastfiles should be checked for existance
226         bool auto_reset_options;
227         ///
228         bool check_lastfiles;
229         /// filename for lastfiles file
230         std::string lastfiles;
231         /// maximal number of lastfiles
232         unsigned int num_lastfiles;
233         /// shall a backup file be created
234         bool make_backup;
235         /// A directory for storing backup files
236         std::string backupdir_path;
237         /// Zoom factor for screen fonts
238         unsigned int zoom;
239         /// parameter for button_4 and button_5 (scrollwheel)
240         unsigned int wheel_jump;
241         /// Screen font sizes in points for each font size
242         std::string font_sizes[10];
243         /// Allow the use of scalable fonts? Default is yes.
244         bool use_scalable_fonts;
245         /// DPI of monitor
246         unsigned int dpi;
247         ///
248         std::string fontenc;
249         ///
250         std::string roman_font_name;
251         ///
252         std::string sans_font_name;
253         ///
254         std::string typewriter_font_name;
255         ///
256         std::string roman_font_foundry;
257         ///
258         std::string sans_font_foundry;
259         ///
260         std::string typewriter_font_foundry;
261         ///
262         std::string popup_bold_font;
263         ///
264         std::string popup_normal_font;
265         ///
266         std::string font_norm;
267         ///
268         enum FontEncoding {
269                 ///
270                 ISO_10646_1,
271                 ///
272                 ISO_8859_1,
273                 ///
274                 ISO_8859_3,
275                 ///
276                 ISO_8859_4,
277                 ///
278                 ISO_8859_6_8,
279                 ///
280                 ISO_8859_9,
281                 ///
282                 ISO_8859_15,
283                 ///
284                 OTHER_ENCODING
285         };
286         ///
287         FontEncoding font_norm_type;
288         ///
289         void set_font_norm_type();
290         ///
291         std::string popup_font_encoding;
292         ///
293         unsigned int autosave;
294         ///
295         std::string ascii_roff_command;
296         ///
297         unsigned int ascii_linelen;
298         /// use library instead of process
299         bool use_spell_lib;
300         /// Ispell command
301         std::string isp_command;
302         /// Accept compound words in spellchecker?
303         bool isp_accept_compound;
304         /// Pass input encoding switch to ispell?
305         bool isp_use_input_encoding;
306         /// Use alternate language?
307         bool isp_use_alt_lang;
308         /// Use personal dictionary?
309         bool isp_use_pers_dict;
310         /// Use escape chars?
311         bool isp_use_esc_chars;
312         /// Alternate language for ispell
313         std::string isp_alt_lang;
314         /// Alternate personal dictionary file for ispell
315         std::string isp_pers_dict;
316         /// Escape characters
317         std::string isp_esc_chars;
318         ///
319         bool use_kbmap;
320         ///
321         std::string primary_kbmap;
322         ///
323         std::string secondary_kbmap;
324         ///
325         std::string lyxpipes;
326         ///
327         std::string date_insert_format;
328         ///
329         std::string language_package;
330         ///
331         bool language_auto_begin;
332         ///
333         bool language_auto_end;
334         ///
335         std::string language_command_begin;
336         ///
337         std::string language_command_end;
338         ///
339         std::string language_command_local;
340         ///
341         bool language_global_options;
342         ///
343         bool language_use_babel;
344         ///
345         bool rtl_support;
346         ///
347         bool auto_number;
348         ///
349         bool mark_foreign_language;
350         ///
351         std::string default_language;
352         ///
353         bool cursor_follows_scrollbar;
354         ///
355         bool dialogs_iconify_with_main;
356         ///
357         int label_init_length;
358         ///
359         lyx::graphics::DisplayType display_graphics;
360         ///
361         bool show_banner;
362         ///
363         enum PreviewStatus {
364                 PREVIEW_OFF,
365                 PREVIEW_NO_MATH,
366                 PREVIEW_ON
367         };
368         ///
369         PreviewStatus preview;
370         ///
371         bool preview_hashed_labels;
372         ///
373         std::string preview_scale_factor;
374         /// user name
375         std::string user_name;
376         /// user email
377         std::string user_email;
378         ///
379         bool cygwin_path_fix;
380         /** Prepend paths to the PATH environment variable.
381          *  The string is input, stored and output in native format.
382          */
383         std::string path_prefix;
384 };
385
386
387 /** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
388  *  It can be forward-declared and passed as a function argument without
389  *  having to expose lyxrc.h.
390  */
391 class LyXRC_PreviewStatus {
392         LyXRC::PreviewStatus val_;
393 public:
394         LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
395         operator LyXRC::PreviewStatus() const{ return val_; }
396 };
397
398
399 ///
400 extern LyXRC lyxrc;
401 ///
402 extern LyXRC system_lyxrc;
403 #endif