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"
19 #include "xforms_helpers.h"
21 #include <boost/scoped_ptr.hpp>
35 struct FD_preferences;
36 struct FD_preferences_colors;
37 struct FD_preferences_converters;
38 struct FD_preferences_copiers;
39 struct FD_preferences_formats;
40 struct FD_preferences_inputs_misc;
41 struct FD_preferences_interface;
42 struct FD_preferences_language;
43 struct FD_preferences_lnf_misc;
44 struct FD_preferences_identity;
45 struct FD_preferences_inner_tab;
46 struct FD_preferences_outputs_misc;
47 struct FD_preferences_paths;
48 struct FD_preferences_printer;
49 struct FD_preferences_screen_fonts;
50 struct FD_preferences_spelloptions;
52 class FormColorpicker;
55 /** This class provides an XForms implementation of the FormPreferences Dialog.
56 * The preferences dialog allows users to set/save their preferences.
59 : public FormController<ControlPrefs, FormView<FD_preferences> > {
61 FormPreferences(Dialog &);
64 /** Redraw the form (on receipt of a Signal indicating, for example,
65 that the xforms colours have been re-mapped). */
66 virtual void redraw();
67 /// Update the dialog.
68 virtual void update();
73 /// Filter the inputs -- return true if entries are valid
74 virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
77 /// control which feedback message is output
78 std::string const getFeedback(FL_OBJECT *);
80 /// Converters tabfolder
81 boost::scoped_ptr<FD_preferences_inner_tab> converters_tab_;
82 /// reLyX and other import/input stuff
83 boost::scoped_ptr<FD_preferences_inner_tab> inputs_tab_;
85 boost::scoped_ptr<FD_preferences_inner_tab> look_n_feel_tab_;
87 boost::scoped_ptr<FD_preferences_inner_tab> outputs_tab_;
88 /// Spellchecker, language stuff, etc
89 boost::scoped_ptr<FD_preferences_inner_tab> lang_opts_tab_;
91 /** Each tab folder is encapsulated in its own class.
98 GUI_COLOR_CHOICE = FL_FREE_COL15,
99 GUI_COLOR_CURSOR = FL_FREE_COL16
102 Colors(FormPreferences & p);
104 FD_preferences_colors const * dialog();
106 void apply(); // not const as modifies modifiedXformsPrefs.
110 std::string const feedback(FL_OBJECT const * const) const;
112 void input(FL_OBJECT const * const);
114 void update() { LoadBrowserLyX(); }
116 /// Flag whether Xforms colors have changed since last file save
117 bool modifiedXformsPrefs;
121 void AdjustVal(int, int, double) const;
123 void InputBrowserLyX() const;
125 void LoadBrowserLyX();
130 FormPreferences & parent_;
132 boost::scoped_ptr<FD_preferences_colors> dialog_;
134 boost::scoped_ptr<FormColorpicker> picker_;
136 /// A vector of LyX LColor GUI name and associated RGB color.
137 std::vector<NamedColor> lyxColorDB;
138 /// A vector of xforms color ID, RGB colors and associated name.
139 std::vector<XformsColor> xformsColorDB;
148 Converters(FormPreferences & p);
150 FD_preferences_converters const * dialog();
154 std::string const feedback(FL_OBJECT const * const) const;
156 bool input(FL_OBJECT const * const);
160 void UpdateBrowser();
162 void UpdateChoices();
174 std::string const GetFrom();
176 std::string const GetTo();
178 ::Converters & converters();
179 ::Formats & formats();
182 FormPreferences & parent_;
184 boost::scoped_ptr<FD_preferences_converters> dialog_;
187 friend class Converters;
193 Copiers(FormPreferences & p);
195 FD_preferences_copiers const * dialog();
199 std::string const feedback(FL_OBJECT const * const) const;
201 bool input(FL_OBJECT const * const);
218 FormPreferences & parent_;
220 boost::scoped_ptr<FD_preferences_copiers> dialog_;
223 friend class Copiers;
229 Formats(FormPreferences & p);
231 FD_preferences_formats const * dialog();
235 std::string const feedback(FL_OBJECT const * const) const;
237 bool input(FL_OBJECT const * const);
247 void UpdateBrowser();
253 ::Converters & converters();
254 ::Formats & formats();
257 FormPreferences & parent_;
259 boost::scoped_ptr<FD_preferences_formats> dialog_;
262 friend class Formats;
268 InputsMisc(FormPreferences & p);
270 FD_preferences_inputs_misc const * dialog();
272 void apply(LyXRC & rc) const;
276 std::string const feedback(FL_OBJECT const * const) const;
278 void update(LyXRC const & rc);
282 FormPreferences & parent_;
284 boost::scoped_ptr<FD_preferences_inputs_misc> dialog_;
287 friend class InputsMisc;
293 Interface(FormPreferences & p);
295 FD_preferences_interface const * dialog();
297 void apply(LyXRC & rc) const;
301 std::string const feedback(FL_OBJECT const * const) const;
303 bool input(FL_OBJECT const * const);
305 void update(LyXRC const & rc);
309 FormPreferences & parent_;
311 boost::scoped_ptr<FD_preferences_interface> dialog_;
314 friend class Interface;
320 Language(FormPreferences & p);
322 FD_preferences_language const * dialog();
324 void apply(LyXRC & rc); // not const because calls update()
328 std::string const feedback(FL_OBJECT const * const) const;
330 bool input(FL_OBJECT const * const);
332 void update(LyXRC const & rc);
336 FormPreferences & parent_;
338 boost::scoped_ptr<FD_preferences_language> dialog_;
340 std::vector<std::string> lang_;
343 friend class Language;
349 LnFmisc(FormPreferences & p);
351 FD_preferences_lnf_misc const * dialog();
353 void apply(LyXRC & rc) const;
357 std::string const feedback(FL_OBJECT const * const) const;
359 void update(LyXRC const & rc);
363 FormPreferences & parent_;
365 boost::scoped_ptr<FD_preferences_lnf_misc> dialog_;
368 friend class LnFmisc;
373 Identity(FormPreferences & p);
375 FD_preferences_identity const * dialog();
377 void apply(LyXRC & rc) const;
381 std::string const feedback(FL_OBJECT const * const) const;
383 void update(LyXRC const & rc);
387 FormPreferences & parent_;
389 boost::scoped_ptr<FD_preferences_identity> dialog_;
391 friend class Identity;
397 OutputsMisc(FormPreferences & p);
399 FD_preferences_outputs_misc const * dialog();
401 void apply(LyXRC & rc) const;
405 std::string const feedback(FL_OBJECT const * const) const;
407 void update(LyXRC const & rc);
411 FormPreferences & parent_;
413 boost::scoped_ptr<FD_preferences_outputs_misc> dialog_;
416 friend class OutputsMisc;
422 Paths(FormPreferences & p);
424 FD_preferences_paths const * dialog();
426 void apply(LyXRC & rc);
430 std::string const feedback(FL_OBJECT const * const) const;
432 bool input(FL_OBJECT const * const);
434 void update(LyXRC const & rc);
438 FormPreferences & parent_;
440 boost::scoped_ptr<FD_preferences_paths> dialog_;
449 Printer(FormPreferences & p);
451 FD_preferences_printer const * dialog();
453 void apply(LyXRC & rc) const;
457 std::string const feedback(FL_OBJECT const * const) const;
459 void update(LyXRC const & rc);
463 FormPreferences & parent_;
465 boost::scoped_ptr<FD_preferences_printer> dialog_;
468 friend class Printer;
474 ScreenFonts(FormPreferences & p);
476 FD_preferences_screen_fonts const * dialog();
478 void apply(LyXRC & rc) const;
482 std::string const feedback(FL_OBJECT const * const) const;
486 void update(LyXRC const & rc);
490 FormPreferences & parent_;
492 boost::scoped_ptr<FD_preferences_screen_fonts> dialog_;
495 friend class ScreenFonts;
501 SpellOptions(FormPreferences & p);
503 FD_preferences_spelloptions const * dialog();
505 void apply(LyXRC & rc); // not const because calls update()!
509 std::string const feedback(FL_OBJECT const * const) const;
511 bool input(FL_OBJECT const * const);
513 void update(LyXRC const & rc);
517 FormPreferences & parent_;
519 boost::scoped_ptr<FD_preferences_spelloptions> dialog_;
522 friend class SpellOptions;
530 Converters converters_;
538 InputsMisc inputs_misc_;
540 Interface interface_;
546 OutputsMisc outputs_misc_;
552 ScreenFonts screen_fonts_;
554 SpellOptions spelloptions_;
557 } // namespace frontend
560 #endif // FORMPREFERENCES_H