3 * \file FormPreferences.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
13 #ifndef FORMPREFERENCES_H
14 #define FORMPREFERENCES_H
18 #include "lyx_forms.h"
20 #include <boost/scoped_ptr.hpp>
25 class FormColorpicker;
32 struct FD_preferences;
33 struct FD_preferences_colors;
34 struct FD_preferences_converters;
35 struct FD_preferences_formats;
36 struct FD_preferences_inputs_misc;
37 struct FD_preferences_interface;
38 struct FD_preferences_language;
39 struct FD_preferences_lnf_misc;
40 struct FD_preferences_identity;
41 struct FD_preferences_inner_tab;
42 struct FD_preferences_outputs_misc;
43 struct FD_preferences_paths;
44 struct FD_preferences_printer;
45 struct FD_preferences_screen_fonts;
46 struct FD_preferences_spelloptions;
49 /** This class provides an XForms implementation of the FormPreferences Dialog.
50 * The preferences dialog allows users to set/save their preferences.
52 class FormPreferences : public FormCB<ControlPrefs, FormDB<FD_preferences> > {
57 /** Redraw the form (on receipt of a Signal indicating, for example,
58 that the xforms colours have been re-mapped). */
59 virtual void redraw();
60 /// Update the dialog.
61 virtual void update();
66 /// Filter the inputs -- return true if entries are valid
67 virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
70 /// control which feedback message is output
71 std::string const getFeedback(FL_OBJECT *);
73 /// Converters tabfolder
74 boost::scoped_ptr<FD_preferences_inner_tab> converters_tab_;
75 /// reLyX and other import/input stuff
76 boost::scoped_ptr<FD_preferences_inner_tab> inputs_tab_;
78 boost::scoped_ptr<FD_preferences_inner_tab> look_n_feel_tab_;
80 boost::scoped_ptr<FD_preferences_inner_tab> outputs_tab_;
81 /// Spellchecker, language stuff, etc
82 boost::scoped_ptr<FD_preferences_inner_tab> lang_opts_tab_;
84 /** Each tab folder is encapsulated in its own class.
91 GUI_COLOR_CHOICE = FL_FREE_COL15,
92 GUI_COLOR_CURSOR = FL_FREE_COL16
95 Colors(FormPreferences & p);
97 FD_preferences_colors const * dialog();
99 void apply(); // not const as modifies modifiedXformsPrefs.
103 std::string const feedback(FL_OBJECT const * const) const;
105 void input(FL_OBJECT const * const);
107 void update() { LoadBrowserLyX(); }
109 /// Flag whether Xforms colors have changed since last file save
110 bool modifiedXformsPrefs;
114 void AdjustVal(int, int, double) const;
116 void InputBrowserLyX() const;
118 void LoadBrowserLyX();
123 FormPreferences & parent_;
125 boost::scoped_ptr<FD_preferences_colors> dialog_;
127 boost::scoped_ptr<FormColorpicker> picker_;
129 /// A vector of LyX LColor GUI name and associated RGB color.
130 std::vector<NamedColor> lyxColorDB;
131 /// A vector of xforms color ID, RGB colors and associated name.
132 std::vector<XformsColor> xformsColorDB;
141 Converters(FormPreferences & p);
143 FD_preferences_converters const * dialog();
149 std::string const feedback(FL_OBJECT const * const) const;
151 bool input(FL_OBJECT const * const);
155 void UpdateBrowser();
157 void UpdateChoices() const;
169 std::string const GetFrom() const;
171 std::string const GetTo() const;
174 FormPreferences & parent_;
176 boost::scoped_ptr<FD_preferences_converters> dialog_;
179 friend class Converters;
185 Formats(FormPreferences & p);
187 FD_preferences_formats const * dialog();
193 std::string const feedback(FL_OBJECT const * const) const;
195 bool input(FL_OBJECT const * const);
205 void UpdateBrowser();
212 FormPreferences & parent_;
214 boost::scoped_ptr<FD_preferences_formats> dialog_;
217 friend class Formats;
223 InputsMisc(FormPreferences & p);
225 FD_preferences_inputs_misc const * dialog();
227 void apply(LyXRC & rc) const;
231 std::string const feedback(FL_OBJECT const * const) const;
233 void update(LyXRC const & rc);
237 FormPreferences & parent_;
239 boost::scoped_ptr<FD_preferences_inputs_misc> dialog_;
242 friend class InputsMisc;
248 Interface(FormPreferences & p);
250 FD_preferences_interface const * dialog();
252 void apply(LyXRC & rc) const;
256 std::string const feedback(FL_OBJECT const * const) const;
258 bool input(FL_OBJECT const * const);
260 void update(LyXRC const & rc);
264 FormPreferences & parent_;
266 boost::scoped_ptr<FD_preferences_interface> dialog_;
269 friend class Interface;
275 Language(FormPreferences & p);
277 FD_preferences_language const * dialog();
279 void apply(LyXRC & rc); // not const because calls update()
283 std::string const feedback(FL_OBJECT const * const) const;
285 bool input(FL_OBJECT const * const);
287 void update(LyXRC const & rc);
291 FormPreferences & parent_;
293 boost::scoped_ptr<FD_preferences_language> dialog_;
295 std::vector<std::string> lang_;
298 friend class Language;
304 LnFmisc(FormPreferences & p);
306 FD_preferences_lnf_misc const * dialog();
308 void apply(LyXRC & rc) const;
312 std::string const feedback(FL_OBJECT const * const) const;
314 void update(LyXRC const & rc);
318 FormPreferences & parent_;
320 boost::scoped_ptr<FD_preferences_lnf_misc> dialog_;
323 friend class LnFmisc;
328 Identity(FormPreferences & p);
330 FD_preferences_identity const * dialog();
332 void apply(LyXRC & rc) const;
336 std::string const feedback(FL_OBJECT const * const) const;
338 void update(LyXRC const & rc);
342 FormPreferences & parent_;
344 boost::scoped_ptr<FD_preferences_identity> dialog_;
346 friend class Identity;
352 OutputsMisc(FormPreferences & p);
354 FD_preferences_outputs_misc const * dialog();
356 void apply(LyXRC & rc) const;
360 std::string const feedback(FL_OBJECT const * const) const;
362 void update(LyXRC const & rc);
366 FormPreferences & parent_;
368 boost::scoped_ptr<FD_preferences_outputs_misc> dialog_;
371 friend class OutputsMisc;
377 Paths(FormPreferences & p);
379 FD_preferences_paths const * dialog();
381 void apply(LyXRC & rc);
385 std::string const feedback(FL_OBJECT const * const) const;
387 bool input(FL_OBJECT const * const);
389 void update(LyXRC const & rc);
393 FormPreferences & parent_;
395 boost::scoped_ptr<FD_preferences_paths> dialog_;
404 Printer(FormPreferences & p);
406 FD_preferences_printer const * dialog();
408 void apply(LyXRC & rc) const;
412 std::string const feedback(FL_OBJECT const * const) const;
414 void update(LyXRC const & rc);
418 FormPreferences & parent_;
420 boost::scoped_ptr<FD_preferences_printer> dialog_;
423 friend class Printer;
429 ScreenFonts(FormPreferences & p);
431 FD_preferences_screen_fonts const * dialog();
433 void apply(LyXRC & rc) const;
437 std::string const feedback(FL_OBJECT const * const) const;
441 void update(LyXRC const & rc);
445 FormPreferences & parent_;
447 boost::scoped_ptr<FD_preferences_screen_fonts> dialog_;
450 friend class ScreenFonts;
456 SpellOptions(FormPreferences & p);
458 FD_preferences_spelloptions const * dialog();
460 void apply(LyXRC & rc); // not const because calls update()!
464 std::string const feedback(FL_OBJECT const * const) const;
466 bool input(FL_OBJECT const * const);
468 void update(LyXRC const & rc);
472 FormPreferences & parent_;
474 boost::scoped_ptr<FD_preferences_spelloptions> dialog_;
477 friend class SpellOptions;
485 Converters converters_;
487 InputsMisc inputs_misc_;
491 Interface interface_;
499 OutputsMisc outputs_misc_;
505 ScreenFonts screen_fonts_;
507 SpellOptions spelloptions_;
510 #endif // FORMPREFERENCES_H