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