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