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