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
16 #include "FormDialogView.h"
18 #include "lyx_forms.h"
20 #include <boost/scoped_ptr.hpp>
33 struct FD_preferences;
34 struct FD_preferences_colors;
35 struct FD_preferences_converters;
36 struct FD_preferences_formats;
37 struct FD_preferences_inputs_misc;
38 struct FD_preferences_interface;
39 struct FD_preferences_language;
40 struct FD_preferences_lnf_misc;
41 struct FD_preferences_identity;
42 struct FD_preferences_inner_tab;
43 struct FD_preferences_outputs_misc;
44 struct FD_preferences_paths;
45 struct FD_preferences_printer;
46 struct FD_preferences_screen_fonts;
47 struct FD_preferences_spelloptions;
49 class FormColorpicker;
54 /** This class provides an XForms implementation of the FormPreferences Dialog.
55 * The preferences dialog allows users to set/save their preferences.
58 : public FormController<ControlPrefs, FormView<FD_preferences> > {
60 FormPreferences(Dialog &);
63 /** Redraw the form (on receipt of a Signal indicating, for example,
64 that the xforms colours have been re-mapped). */
65 virtual void redraw();
66 /// Update the dialog.
67 virtual void update();
72 /// Filter the inputs -- return true if entries are valid
73 virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
76 /// control which feedback message is output
77 std::string const getFeedback(FL_OBJECT *);
79 /// Converters tabfolder
80 boost::scoped_ptr<FD_preferences_inner_tab> converters_tab_;
81 /// reLyX and other import/input stuff
82 boost::scoped_ptr<FD_preferences_inner_tab> inputs_tab_;
84 boost::scoped_ptr<FD_preferences_inner_tab> look_n_feel_tab_;
86 boost::scoped_ptr<FD_preferences_inner_tab> outputs_tab_;
87 /// Spellchecker, language stuff, etc
88 boost::scoped_ptr<FD_preferences_inner_tab> lang_opts_tab_;
90 /** Each tab folder is encapsulated in its own class.
97 GUI_COLOR_CHOICE = FL_FREE_COL15,
98 GUI_COLOR_CURSOR = FL_FREE_COL16
101 Colors(FormPreferences & p);
103 FD_preferences_colors const * dialog();
105 void apply(); // not const as modifies modifiedXformsPrefs.
109 std::string const feedback(FL_OBJECT const * const) const;
111 void input(FL_OBJECT const * const);
113 void update() { LoadBrowserLyX(); }
115 /// Flag whether Xforms colors have changed since last file save
116 bool modifiedXformsPrefs;
120 void AdjustVal(int, int, double) const;
122 void InputBrowserLyX() const;
124 void LoadBrowserLyX();
129 FormPreferences & parent_;
131 boost::scoped_ptr<FD_preferences_colors> dialog_;
133 boost::scoped_ptr<FormColorpicker> picker_;
135 /// A vector of LyX LColor GUI name and associated RGB color.
136 std::vector<NamedColor> lyxColorDB;
137 /// A vector of xforms color ID, RGB colors and associated name.
138 std::vector<XformsColor> xformsColorDB;
147 Converters(FormPreferences & p);
149 FD_preferences_converters const * dialog();
153 std::string const feedback(FL_OBJECT const * const) const;
155 bool input(FL_OBJECT const * const);
159 void UpdateBrowser();
161 void UpdateChoices();
173 std::string const GetFrom();
175 std::string const GetTo();
177 ::Converters & converters();
178 ::Formats & formats();
181 FormPreferences & parent_;
183 boost::scoped_ptr<FD_preferences_converters> dialog_;
186 friend class Converters;
192 Formats(FormPreferences & p);
194 FD_preferences_formats const * dialog();
198 std::string const feedback(FL_OBJECT const * const) const;
200 bool input(FL_OBJECT const * const);
210 void UpdateBrowser();
216 ::Converters & converters();
217 ::Formats & formats();
220 FormPreferences & parent_;
222 boost::scoped_ptr<FD_preferences_formats> dialog_;
225 friend class Formats;
231 InputsMisc(FormPreferences & p);
233 FD_preferences_inputs_misc const * dialog();
235 void apply(LyXRC & rc) const;
239 std::string const feedback(FL_OBJECT const * const) const;
241 void update(LyXRC const & rc);
245 FormPreferences & parent_;
247 boost::scoped_ptr<FD_preferences_inputs_misc> dialog_;
250 friend class InputsMisc;
256 Interface(FormPreferences & p);
258 FD_preferences_interface const * dialog();
260 void apply(LyXRC & rc) const;
264 std::string const feedback(FL_OBJECT const * const) const;
266 bool input(FL_OBJECT const * const);
268 void update(LyXRC const & rc);
272 FormPreferences & parent_;
274 boost::scoped_ptr<FD_preferences_interface> dialog_;
277 friend class Interface;
283 Language(FormPreferences & p);
285 FD_preferences_language const * dialog();
287 void apply(LyXRC & rc); // not const because calls update()
291 std::string const feedback(FL_OBJECT const * const) const;
293 bool input(FL_OBJECT const * const);
295 void update(LyXRC const & rc);
299 FormPreferences & parent_;
301 boost::scoped_ptr<FD_preferences_language> dialog_;
303 std::vector<std::string> lang_;
306 friend class Language;
312 LnFmisc(FormPreferences & p);
314 FD_preferences_lnf_misc const * dialog();
316 void apply(LyXRC & rc) const;
320 std::string const feedback(FL_OBJECT const * const) const;
322 void update(LyXRC const & rc);
326 FormPreferences & parent_;
328 boost::scoped_ptr<FD_preferences_lnf_misc> dialog_;
331 friend class LnFmisc;
336 Identity(FormPreferences & p);
338 FD_preferences_identity const * dialog();
340 void apply(LyXRC & rc) const;
344 std::string const feedback(FL_OBJECT const * const) const;
346 void update(LyXRC const & rc);
350 FormPreferences & parent_;
352 boost::scoped_ptr<FD_preferences_identity> dialog_;
354 friend class Identity;
360 OutputsMisc(FormPreferences & p);
362 FD_preferences_outputs_misc const * dialog();
364 void apply(LyXRC & rc) const;
368 std::string const feedback(FL_OBJECT const * const) const;
370 void update(LyXRC const & rc);
374 FormPreferences & parent_;
376 boost::scoped_ptr<FD_preferences_outputs_misc> dialog_;
379 friend class OutputsMisc;
385 Paths(FormPreferences & p);
387 FD_preferences_paths const * dialog();
389 void apply(LyXRC & rc);
393 std::string const feedback(FL_OBJECT const * const) const;
395 bool input(FL_OBJECT const * const);
397 void update(LyXRC const & rc);
401 FormPreferences & parent_;
403 boost::scoped_ptr<FD_preferences_paths> dialog_;
412 Printer(FormPreferences & p);
414 FD_preferences_printer const * dialog();
416 void apply(LyXRC & rc) const;
420 std::string const feedback(FL_OBJECT const * const) const;
422 void update(LyXRC const & rc);
426 FormPreferences & parent_;
428 boost::scoped_ptr<FD_preferences_printer> dialog_;
431 friend class Printer;
437 ScreenFonts(FormPreferences & p);
439 FD_preferences_screen_fonts const * dialog();
441 void apply(LyXRC & rc) const;
445 std::string const feedback(FL_OBJECT const * const) const;
449 void update(LyXRC const & rc);
453 FormPreferences & parent_;
455 boost::scoped_ptr<FD_preferences_screen_fonts> dialog_;
458 friend class ScreenFonts;
464 SpellOptions(FormPreferences & p);
466 FD_preferences_spelloptions const * dialog();
468 void apply(LyXRC & rc); // not const because calls update()!
472 std::string const feedback(FL_OBJECT const * const) const;
474 bool input(FL_OBJECT const * const);
476 void update(LyXRC const & rc);
480 FormPreferences & parent_;
482 boost::scoped_ptr<FD_preferences_spelloptions> dialog_;
485 friend class SpellOptions;
493 Converters converters_;
495 InputsMisc inputs_misc_;
499 Interface interface_;
507 OutputsMisc outputs_misc_;
513 ScreenFonts screen_fonts_;
515 SpellOptions spelloptions_;
518 } // namespace frontend
521 #endif // FORMPREFERENCES_H