2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 The LyX Team.
10 * This file copyright 1999-2000
12 *======================================================*/
14 * FormPreferences Interface Class
17 #ifndef FORMPREFERENCES_H
18 #define FORMPREFERENCES_H
28 struct FD_form_colours;
29 struct FD_form_converters;
30 struct FD_form_formats;
31 struct FD_form_inputs_misc;
32 struct FD_form_interface;
33 struct FD_form_language;
34 struct FD_form_lnf_misc;
35 struct FD_form_outer_tab;
36 struct FD_form_outputs_misc;
38 struct FD_form_preferences;
39 struct FD_form_printer;
40 struct FD_form_screen_fonts;
41 struct FD_form_spellchecker;
44 /** This class provides an XForms implementation of the FormPreferences Dialog.
45 The preferences dialog allows users to set/save their preferences.
47 class FormPreferences : public FormBaseBI {
49 /// #FormPreferences x(LyXFunc ..., Dialogs ...);#
50 FormPreferences(LyXView *, Dialogs *);
54 static void ComboLanguageCB(int, void *, Combox *);
56 static void FeedbackCB(FL_OBJECT *, long);
58 void feedbackPost(FL_OBJECT *, int);
60 /// helper struct for Colours
65 RGB() : r(0), g(0), b(0) {}
66 RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
67 bool operator==(RGB const & o) const
68 { return( r == o.r && g == o.g && b == o.b ); }
69 bool operator!=(RGB const & o) const
70 { return( r != o.r || g != o.g || b != o.b ); }
74 /// Update the dialog.
75 virtual void update();
82 /// Filter the inputs -- return true if entries are valid
83 virtual bool input(FL_OBJECT *, long);
86 /// control which feedback message is output
87 void feedback( FL_OBJECT * );
89 virtual FL_FORM * form() const;
91 /** Folder specific apply functions.
95 void applyColours() const;
97 void applyConverters() const;
99 void applyFormats() const;
101 void applyInputsMisc() const;
103 void applyInterface() const;
105 void applyLanguage() const;
107 void applyLnFmisc() const;
109 void applyOutputsMisc() const;
111 void applyPaths(); // not const because calls updatePaths!
113 void applyPrinter() const;
115 void applyScreenFonts() const;
117 void applySpellChecker(); // not const because calls updateSpellChecker!
119 /** Folder specific build functions.
125 void buildConverters();
129 void buildInputsMisc();
131 void buildInterface();
133 void buildLanguage();
137 void buildOutputsMisc();
143 void buildScreenFonts();
145 void buildSpellchecker();
147 /** Folder specific feedback functions.
151 string feedbackColours(FL_OBJECT const * const) const;
153 string feedbackConverters(FL_OBJECT const * const) const;
155 string feedbackFormats( FL_OBJECT const * const ) const;
157 string feedbackInputsMisc(FL_OBJECT const * const) const;
159 string feedbackInterface(FL_OBJECT const * const) const;
161 string feedbackLanguage(FL_OBJECT const * const) const;
163 string feedbackLnFmisc(FL_OBJECT const * const) const;
165 string feedbackOutputsMisc(FL_OBJECT const * const) const;
167 string feedbackPaths(FL_OBJECT const * const) const;
169 string feedbackPrinter(FL_OBJECT const * const) const;
171 string feedbackScreenFonts(FL_OBJECT const * const) const;
173 string feedbackSpellChecker(FL_OBJECT const * const) const;
175 /** Folder specific input functions. Not all folders require one.
179 bool inputColours(FL_OBJECT const * const);
181 bool inputFormats( FL_OBJECT const * const );
183 bool inputLanguage(FL_OBJECT const * const);
185 bool inputPaths(FL_OBJECT const * const);
187 bool inputScreenFonts();
189 bool inputSpellChecker(FL_OBJECT const * const);
191 /** Folder specific update functions.
195 void updateColours();
197 void updateConverters();
199 void updateFormats();
201 void updateInputsMisc();
203 void updateInterface();
205 void updateLanguage();
207 void updateLnFmisc();
209 void updateOutputsMisc();
213 void updatePrinter();
215 void updateScreenFonts();
217 void updateSpellChecker();
219 /** Some helper functions for specific folders.
223 void LanguagesAdd( Combox & ) const;
225 bool ColoursLoadBrowser( string const & );
227 int ColoursSearchEntry(RGB const & ) const;
229 void ColoursUpdateBrowser( int );
231 void ColoursUpdateRGB();
234 bool WriteableDir( string const & ) const;
236 bool ReadableDir( string const & ) const;
238 bool WriteableFile( string const &, string const & = string() ) const;
240 /// The timer post handler.
241 void setPostHandler( FL_OBJECT * ) const;
243 /// Type definitions from the fdesign produced header file.
244 FD_form_preferences * build_preferences();
246 FD_form_outer_tab * build_outer_tab();
248 FD_form_colours * build_colours();
250 FD_form_converters * build_converters();
252 FD_form_formats * build_formats();
254 FD_form_inputs_misc * build_inputs_misc();
256 FD_form_interface * build_interface();
258 FD_form_language * build_language();
260 FD_form_lnf_misc * build_lnf_misc();
262 FD_form_outputs_misc * build_outputs_misc();
264 FD_form_paths * build_paths();
266 FD_form_printer * build_printer();
268 FD_form_screen_fonts * build_screen_fonts();
270 FD_form_spellchecker * build_spellchecker();
272 /// Real GUI implementation.
273 FD_form_preferences * dialog_;
274 /// Converters tabfolder
275 FD_form_outer_tab * converters_tab_;
276 /// reLyX and other import/input stuff
277 FD_form_outer_tab * inputs_tab_;
278 /// HCI configuration
279 FD_form_outer_tab * look_n_feel_tab_;
280 /// Outputs tabfolder
281 FD_form_outer_tab * outputs_tab_;
282 /// Spellchecker, language stuff, etc
283 FD_form_outer_tab * usage_tab_;
285 FD_form_converters * converters_;
287 FD_form_colours * colours_;
289 FD_form_formats * formats_;
291 FD_form_inputs_misc * inputs_misc_;
293 FD_form_interface * interface_;
295 FD_form_language * language_;
297 FD_form_lnf_misc * lnf_misc_;
299 FD_form_outputs_misc * outputs_misc_;
301 FD_form_paths * paths_;
303 FD_form_printer * printer_;
305 FD_form_screen_fonts * screen_fonts_;
307 FD_form_spellchecker * spellchecker_;
309 Combox * combo_default_lang;
311 Combox * combo_kbmap_1;
313 Combox * combo_kbmap_2;
315 FL_OBJECT * feedbackObj;