]> git.lyx.org Git - lyx.git/blob - src/lyxrc.h
more code in the menu backend == less code in the menu frontends; add support for...
[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  * Full author contact details are available in file CREDITS
8  */
9
10 #ifndef LYXRC_H
11 #define LYXRC_H
12
13 #include "bufferparams.h" // Just to get the enum BufferParams::PAPER_SIZE (sic)
14 #include "graphics/GraphicsTypes.h"
15
16 // #include <boost/utility.hpp>
17
18 /// This contains the runtime configuration of LyX
19 class LyXRC //: public noncopyable {
20 // after 1.1.6 I will use a LyXRCStruct here and then this can be made
21 // noncopyable again.  For now I want to minimise changes.  ARRae 20001010
22 {
23 public:
24 enum LyXRCTags {
25         RC_FONT_ENCODING = 1,
26         RC_PRINTER,
27         RC_PRINT_COMMAND,
28         RC_PRINTEVENPAGEFLAG,
29         RC_PRINTODDPAGEFLAG,
30         RC_PRINTPAGERANGEFLAG,
31         RC_PRINTCOPIESFLAG,
32         RC_PRINTCOLLCOPIESFLAG,
33         RC_PRINTREVERSEFLAG,
34         RC_PRINTLANDSCAPEFLAG,
35         RC_PRINTTOPRINTER,
36         RC_PRINT_ADAPTOUTPUT,
37         RC_PRINTTOFILE,
38         RC_PRINTFILEEXTENSION,
39         RC_PRINTEXSTRAOPTIONS,
40         RC_PRINTSPOOL_COMMAND,
41         RC_PRINTSPOOL_PRINTERPREFIX,
42         RC_PRINTPAPERFLAG,
43         RC_PRINTPAPERDIMENSIONFLAG,
44         RC_CUSTOM_EXPORT_COMMAND,
45         RC_CUSTOM_EXPORT_FORMAT,
46         RC_SCREEN_DPI,
47         RC_SCREEN_ZOOM,
48         RC_SCREEN_FONT_SIZES,
49         RC_SCREEN_FONT_ROMAN,
50         RC_SCREEN_FONT_SANS,
51         RC_SCREEN_FONT_TYPEWRITER,
52         RC_SCREEN_FONT_ROMAN_FOUNDRY,
53         RC_SCREEN_FONT_SANS_FOUNDRY,
54         RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
55         RC_SCREEN_FONT_ENCODING,
56         RC_POPUP_BOLD_FONT,
57         RC_POPUP_NORMAL_FONT,
58         RC_POPUP_FONT_ENCODING,
59         RC_SET_COLOR,
60         RC_AUTOSAVE,
61         RC_DOCUMENTPATH,
62         RC_TEMPLATEPATH,
63         RC_TEMPDIRPATH,
64         RC_USETEMPDIR,
65         RC_LASTFILES,
66         RC_AUTOREGIONDELETE,
67         RC_AUTORESET_OPTIONS,
68         RC_BIND,
69         RC_SERVERPIPE,
70         RC_INPUT,
71         RC_BINDFILE,
72         RC_UIFILE,
73         RC_KBMAP,
74         RC_KBMAP_PRIMARY,
75         RC_KBMAP_SECONDARY,
76         RC_ASCIIROFF_COMMAND,
77         RC_ASCII_LINELEN,
78         RC_NUMLASTFILES,
79         RC_CHECKLASTFILES,
80         RC_VIEWDVI_PAPEROPTION,
81         RC_DEFAULT_PAPERSIZE,
82         RC_PS_COMMAND,
83         RC_ACCEPT_COMPOUND,
84         RC_SPELL_COMMAND,
85         RC_USE_INP_ENC,
86         RC_USE_ALT_LANG,
87         RC_USE_PERS_DICT,
88         RC_USE_ESC_CHARS,
89         RC_SCREEN_FONT_SCALABLE,
90         RC_ALT_LANG,
91         RC_PERS_DICT,
92         RC_ESC_CHARS,
93         RC_CHKTEX_COMMAND,
94         RC_CURSOR_FOLLOWS_SCROLLBAR,
95         RC_DIALOGS_ICONIFY_WITH_MAIN,
96         RC_MAKE_BACKUP,
97         RC_BACKUPDIR_PATH,
98         RC_RTL_SUPPORT,
99         RC_AUTO_NUMBER,
100         RC_MARK_FOREIGN_LANGUAGE,
101         RC_LANGUAGE_PACKAGE,
102         RC_LANGUAGE_AUTO_BEGIN,
103         RC_LANGUAGE_AUTO_END,
104         RC_LANGUAGE_COMMAND_BEGIN,
105         RC_LANGUAGE_COMMAND_END,
106         RC_LANGUAGE_COMMAND_LOCAL,
107         RC_LANGUAGE_GLOBAL_OPTIONS,
108         RC_LANGUAGE_USE_BABEL,
109         RC_DATE_INSERT_FORMAT,
110         RC_SHOW_BANNER,
111         RC_WHEEL_JUMP,
112         RC_CONVERTER,
113         RC_VIEWER,
114         RC_FORMAT,
115         RC_DEFAULT_LANGUAGE,
116         RC_LABEL_INIT_LENGTH,
117         RC_DISPLAY_GRAPHICS,
118         RC_PREVIEW,
119         RC_PREVIEW_HASHED_LABELS,
120         RC_PREVIEW_SCALE_FACTOR,
121 #ifdef USE_PSPELL
122         RC_USE_PSPELL,
123 #endif
124         RC_USER_NAME,
125         RC_USER_EMAIL,
126         RC_LAST
127 };
128
129
130         ///
131         LyXRC();
132         ///
133         void setDefaults();
134         ///
135         int read(string const & filename);
136         ///
137         void readBindFileIfNeeded();
138         ///
139         void write(string const & filename) const;
140         ///
141         void print() const;
142         ///
143         void output(std::ostream & os) const;
144         ///
145         static string const getDescription(LyXRCTags);
146         ///
147         string bind_file;
148         ///
149         string ui_file;
150         ///
151         string printer;
152         ///
153         string print_command;
154         ///
155         string print_evenpage_flag;
156         ///
157         string print_oddpage_flag;
158         ///
159         string print_pagerange_flag;
160         ///
161         string print_copies_flag;
162         ///
163         string print_collcopies_flag;
164         ///
165         string print_reverse_flag;
166         ///
167         string print_landscape_flag;
168         ///
169         string print_to_printer;
170         ///
171         bool print_adapt_output;
172         ///
173         string print_to_file;
174         ///
175         string print_file_extension;
176         ///
177         string print_extra_options;
178         ///
179         string print_spool_command;
180         ///
181         string print_spool_printerprefix;
182         ///
183         string print_paper_flag;
184         ///
185         string print_paper_dimension_flag;
186         ///
187         string custom_export_command;
188         ///
189         string custom_export_format;
190         ///
191         bool pdf_mode;
192         /// postscript interpreter (in general "gs", if it is installed)
193         string ps_command;
194         /// option for telling the dvi viewer about the paper size
195         string view_dvi_paper_option;
196         /// default paper size for local xdvi/dvips/ghostview/whatever
197         BufferParams::PAPER_SIZE default_papersize;
198         /// command to run chktex incl. options
199         string chktex_command;
200         ///
201         string document_path;
202         ///
203         string template_path;
204         ///
205         string tempdir_path;
206         ///
207         bool use_tempdir;
208         ///
209         bool auto_region_delete;
210         /// flag telling whether lastfiles should be checked for existance
211         bool auto_reset_options;
212         ///
213         bool check_lastfiles;
214         /// filename for lastfiles file
215         string lastfiles;
216         /// maximal number of lastfiles
217         unsigned int num_lastfiles;
218         /// shall a backup file be created
219         bool make_backup;
220         /// A directory for storing backup files
221         string backupdir_path;
222         /// Zoom factor for screen fonts
223         unsigned int zoom;
224         /// parameter for button_4 and button_5 (scrollwheel)
225         unsigned int wheel_jump;
226         /// Screen font sizes in points for each font size
227         float font_sizes[10];
228         /// Allow the use of scalable fonts? Default is yes.
229         bool use_scalable_fonts;
230         /// DPI of monitor
231         float dpi;
232         ///
233         string fontenc;
234         ///
235         string roman_font_name;
236         ///
237         string sans_font_name;
238         ///
239         string typewriter_font_name;
240         ///
241         string roman_font_foundry;
242         ///
243         string sans_font_foundry;
244         ///
245         string typewriter_font_foundry;
246         ///
247         string popup_bold_font;
248         ///
249         string popup_normal_font;
250         ///
251         string font_norm;
252         ///
253         enum FontEncoding {
254                 ///
255                 ISO_10646_1,
256                 ///
257                 ISO_8859_1,
258                 ///
259                 ISO_8859_3,
260                 ///
261                 ISO_8859_4,
262                 ///
263                 ISO_8859_6_8,
264                 ///
265                 ISO_8859_9,
266                 ///
267                 ISO_8859_15,
268                 ///
269                 OTHER_ENCODING
270         };
271         ///
272         FontEncoding font_norm_type;
273         ///
274         void set_font_norm_type();
275         ///
276         string popup_font_encoding;
277         ///
278         unsigned int autosave;
279         ///
280         string ascii_roff_command;
281         ///
282         unsigned int ascii_linelen;
283         /// Ispell command
284 #ifdef USE_PSPELL
285         bool use_pspell;
286 #endif
287         string isp_command;
288         /// Accept compound words in spellchecker?
289         bool isp_accept_compound;
290         /// Pass input encoding switch to ispell?
291         bool isp_use_input_encoding;
292         /// Use alternate language?
293         bool isp_use_alt_lang;
294         /// Use personal dictionary?
295         bool isp_use_pers_dict;
296         /// Use escape chars?
297         bool isp_use_esc_chars;
298         /// Alternate language for ispell
299         string isp_alt_lang;
300         /// Alternate personal dictionary file for ispell
301         string isp_pers_dict;
302         /// Escape characters
303         string isp_esc_chars;
304         ///
305         bool use_kbmap;
306         ///
307         string primary_kbmap;
308         ///
309         string secondary_kbmap;
310         ///
311         string lyxpipes;
312         ///
313         string date_insert_format;
314         ///
315         string language_package;
316         ///
317         bool language_auto_begin;
318         ///
319         bool language_auto_end;
320         ///
321         string language_command_begin;
322         ///
323         string language_command_end;
324         ///
325         string language_command_local;
326         ///
327         bool language_global_options;
328         ///
329         bool language_use_babel;
330         ///
331         bool rtl_support;
332         ///
333         bool auto_number;
334         ///
335         bool mark_foreign_language;
336         /// Do we have to use a GUI?
337         bool use_gui;
338         ///
339         string default_language;
340         ///
341         bool cursor_follows_scrollbar;
342         ///
343         bool dialogs_iconify_with_main;
344         ///
345         int label_init_length;
346         ///
347         grfx::DisplayType display_graphics;
348         ///
349         bool show_banner;
350         ///
351         bool preview;
352         ///
353         bool preview_hashed_labels;
354         ///
355         float preview_scale_factor;
356         /// user name
357         string user_name;
358         /// user email
359         string user_email;
360
361 private:
362         /// Is a bind file already (or currently) read?
363         bool hasBindFile;
364         ///
365         int ReadBindFile(string const & name);
366 };
367
368 ///
369 extern LyXRC lyxrc;
370 ///
371 extern LyXRC system_lyxrc;
372 #endif