]> git.lyx.org Git - lyx.git/blob - src/lyxrc.h
406a26d493e9928f97ecbe5f458093f13bcb68ff
[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         RC_USE_SPELL_LIB,
122         RC_USER_NAME,
123         RC_USER_EMAIL,
124         RC_LAST
125 };
126
127
128         ///
129         LyXRC();
130         ///
131         void setDefaults();
132         ///
133         int read(string const & filename);
134         ///
135         void readBindFileIfNeeded();
136         ///
137         void write(string const & filename) const;
138         ///
139         void print() const;
140         ///
141         void output(std::ostream & os) const;
142         ///
143         static string const getDescription(LyXRCTags);
144         ///
145         string bind_file;
146         ///
147         string ui_file;
148         ///
149         string printer;
150         ///
151         string print_command;
152         ///
153         string print_evenpage_flag;
154         ///
155         string print_oddpage_flag;
156         ///
157         string print_pagerange_flag;
158         ///
159         string print_copies_flag;
160         ///
161         string print_collcopies_flag;
162         ///
163         string print_reverse_flag;
164         ///
165         string print_landscape_flag;
166         ///
167         string print_to_printer;
168         ///
169         bool print_adapt_output;
170         ///
171         string print_to_file;
172         ///
173         string print_file_extension;
174         ///
175         string print_extra_options;
176         ///
177         string print_spool_command;
178         ///
179         string print_spool_printerprefix;
180         ///
181         string print_paper_flag;
182         ///
183         string print_paper_dimension_flag;
184         ///
185         string custom_export_command;
186         ///
187         string custom_export_format;
188         ///
189         bool pdf_mode;
190         /// postscript interpreter (in general "gs", if it is installed)
191         string ps_command;
192         /// option for telling the dvi viewer about the paper size
193         string view_dvi_paper_option;
194         /// default paper size for local xdvi/dvips/ghostview/whatever
195         BufferParams::PAPER_SIZE default_papersize;
196         /// command to run chktex incl. options
197         string chktex_command;
198         ///
199         string document_path;
200         ///
201         string template_path;
202         ///
203         string tempdir_path;
204         ///
205         bool use_tempdir;
206         ///
207         bool auto_region_delete;
208         /// flag telling whether lastfiles should be checked for existance
209         bool auto_reset_options;
210         ///
211         bool check_lastfiles;
212         /// filename for lastfiles file
213         string lastfiles;
214         /// maximal number of lastfiles
215         unsigned int num_lastfiles;
216         /// shall a backup file be created
217         bool make_backup;
218         /// A directory for storing backup files
219         string backupdir_path;
220         /// Zoom factor for screen fonts
221         unsigned int zoom;
222         /// parameter for button_4 and button_5 (scrollwheel)
223         unsigned int wheel_jump;
224         /// Screen font sizes in points for each font size
225         float font_sizes[10];
226         /// Allow the use of scalable fonts? Default is yes.
227         bool use_scalable_fonts;
228         /// DPI of monitor
229         float dpi;
230         ///
231         string fontenc;
232         ///
233         string roman_font_name;
234         ///
235         string sans_font_name;
236         ///
237         string typewriter_font_name;
238         ///
239         string roman_font_foundry;
240         ///
241         string sans_font_foundry;
242         ///
243         string typewriter_font_foundry;
244         ///
245         string popup_bold_font;
246         ///
247         string popup_normal_font;
248         ///
249         string font_norm;
250         ///
251         enum FontEncoding {
252                 ///
253                 ISO_10646_1,
254                 ///
255                 ISO_8859_1,
256                 ///
257                 ISO_8859_3,
258                 ///
259                 ISO_8859_4,
260                 ///
261                 ISO_8859_6_8,
262                 ///
263                 ISO_8859_9,
264                 ///
265                 ISO_8859_15,
266                 ///
267                 OTHER_ENCODING
268         };
269         ///
270         FontEncoding font_norm_type;
271         ///
272         void set_font_norm_type();
273         ///
274         string popup_font_encoding;
275         ///
276         unsigned int autosave;
277         ///
278         string ascii_roff_command;
279         ///
280         unsigned int ascii_linelen;
281         /// use library instead of process
282         bool use_spell_lib;
283         /// Ispell command
284         string isp_command;
285         /// Accept compound words in spellchecker?
286         bool isp_accept_compound;
287         /// Pass input encoding switch to ispell?
288         bool isp_use_input_encoding;
289         /// Use alternate language?
290         bool isp_use_alt_lang;
291         /// Use personal dictionary?
292         bool isp_use_pers_dict;
293         /// Use escape chars?
294         bool isp_use_esc_chars;
295         /// Alternate language for ispell
296         string isp_alt_lang;
297         /// Alternate personal dictionary file for ispell
298         string isp_pers_dict;
299         /// Escape characters
300         string isp_esc_chars;
301         ///
302         bool use_kbmap;
303         ///
304         string primary_kbmap;
305         ///
306         string secondary_kbmap;
307         ///
308         string lyxpipes;
309         ///
310         string date_insert_format;
311         ///
312         string language_package;
313         ///
314         bool language_auto_begin;
315         ///
316         bool language_auto_end;
317         ///
318         string language_command_begin;
319         ///
320         string language_command_end;
321         ///
322         string language_command_local;
323         ///
324         bool language_global_options;
325         ///
326         bool language_use_babel;
327         ///
328         bool rtl_support;
329         ///
330         bool auto_number;
331         ///
332         bool mark_foreign_language;
333         /// Do we have to use a GUI?
334         bool use_gui;
335         ///
336         string default_language;
337         ///
338         bool cursor_follows_scrollbar;
339         ///
340         bool dialogs_iconify_with_main;
341         ///
342         int label_init_length;
343         ///
344         grfx::DisplayType display_graphics;
345         ///
346         bool show_banner;
347         ///
348         bool preview;
349         ///
350         bool preview_hashed_labels;
351         ///
352         float preview_scale_factor;
353         /// user name
354         string user_name;
355         /// user email
356         string user_email;
357
358 private:
359         /// Is a bind file already (or currently) read?
360         bool hasBindFile;
361         ///
362         int ReadBindFile(string const & name);
363 };
364
365 ///
366 extern LyXRC lyxrc;
367 ///
368 extern LyXRC system_lyxrc;
369 #endif