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