// -*- C++ -*-
/**
* \file FormPreferences.h
- * Copyright 1995-2002 the LyX Team
- * Copyright 1999-2001 Allan Rae
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Allan Rae, rae@lyx.org
- * \author Angus Leeming <leeming@lyx.org>
+ * \author Allan Rae
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
*/
#ifndef FORMPREFERENCES_H
#define FORMPREFERENCES_H
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include "FormBaseDeprecated.h"
-#include "Color.h" // NamedColor
+#include "FormBase.h"
#include "xforms_helpers.h" // XformColor
+#include "lyx_forms.h"
+
#include <boost/scoped_ptr.hpp>
-#include FORMS_H_LOCATION
-#include <utility> // pair
+class ControlPrefs;
-class Combox;
class Dialogs;
+class LyXRC;
class LyXView;
+class NamedColor;
class RGBColor;
+class FormColorpicker;
+
struct FD_preferences;
struct FD_preferences_colors;
struct FD_preferences_converters;
struct FD_preferences_interface;
struct FD_preferences_language;
struct FD_preferences_lnf_misc;
+struct FD_preferences_identity;
struct FD_preferences_inner_tab;
struct FD_preferences_outputs_misc;
struct FD_preferences_paths;
/** This class provides an XForms implementation of the FormPreferences Dialog.
- The preferences dialog allows users to set/save their preferences.
+ * The preferences dialog allows users to set/save their preferences.
*/
-class FormPreferences : public FormBaseBI {
+class FormPreferences : public FormCB<ControlPrefs, FormDB<FD_preferences> > {
public:
- ///
- FormPreferences(LyXView &, Dialogs &);
+ FormPreferences();
private:
- /// Pointer to the actual instantiation of the ButtonController.
- virtual xformsBC & bc();
/** Redraw the form (on receipt of a Signal indicating, for example,
that the xforms colours have been re-mapped). */
virtual void redraw();
virtual void update();
/// Hide the dialog.
virtual void hide();
- /// OK (Save) from dialog
- virtual void ok();
/// Apply from dialog
virtual void apply();
/// Filter the inputs -- return true if entries are valid
- virtual bool input(FL_OBJECT *, long);
+ virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
/// Build the dialog
virtual void build();
- /// Pointer to the actual instantiation of the xforms form.
- virtual FL_FORM * form() const;
/// control which feedback message is output
- string const getFeedback(FL_OBJECT *);
- ///
- void browse(FL_OBJECT * input,
- string const & title, string const & pattern,
- std::pair<string,string> const & dir1= std::make_pair(string(),string()),
- std::pair<string,string> const & dir2 = std::make_pair(string(),string()));
+ std::string const getFeedback(FL_OBJECT *);
- /// Real GUI implementation.
- boost::scoped_ptr<FD_preferences> dialog_;
/// Converters tabfolder
boost::scoped_ptr<FD_preferences_inner_tab> converters_tab_;
/// reLyX and other import/input stuff
public:
///
enum GuiColors {
- GUI_COLOR_CHOICE = FL_FREE_COL14,
- GUI_COLOR_HUE_DIAL = FL_FREE_COL15,
+ GUI_COLOR_CHOICE = FL_FREE_COL15,
GUI_COLOR_CURSOR = FL_FREE_COL16
};
///
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
void input(FL_OBJECT const * const);
///
///
void InputBrowserLyX() const;
///
- void InputHSV();
- ///
- void InputRGB();
- ///
void LoadBrowserLyX();
///
void Modify();
- ///
- void SwitchColorSpace() const;
- ///
- string const X11hexname(RGBColor const &) const;
///
FormPreferences & parent_;
///
boost::scoped_ptr<FD_preferences_colors> dialog_;
+ ///
+ boost::scoped_ptr<FormColorpicker> picker_;
/// A vector of LyX LColor GUI name and associated RGB color.
std::vector<NamedColor> lyxColorDB;
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
bool input(FL_OBJECT const * const);
///
///
bool Input();
///
- string const GetFrom() const;
+ std::string const GetFrom() const;
///
- string const GetTo() const;
+ std::string const GetTo() const;
///
FormPreferences & parent_;
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
bool input(FL_OBJECT const * const);
///
///
FD_preferences_inputs_misc const * dialog();
///
- void apply() const;
+ void apply(LyXRC & rc) const;
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
- void update();
+ void update(LyXRC const & rc);
private:
///
///
FD_preferences_interface const * dialog();
///
- void apply() const;
+ void apply(LyXRC & rc) const;
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
bool input(FL_OBJECT const * const);
///
- void update();
+ void update(LyXRC const & rc);
private:
///
///
FD_preferences_language const * dialog();
///
- void apply(); // not const because calls update()
+ void apply(LyXRC & rc); // not const because calls update()
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
bool input(FL_OBJECT const * const);
///
- void update();
- ///
- static void ComboCB(int, void *, Combox *);
+ void update(LyXRC const & rc);
private:
///
///
boost::scoped_ptr<FD_preferences_language> dialog_;
///
- boost::scoped_ptr<Combox> combo_default_lang;
- ///
- std::vector<string> lang_;
+ std::vector<std::string> lang_;
};
///
friend class Language;
///
FD_preferences_lnf_misc const * dialog();
///
- void apply() const;
+ void apply(LyXRC & rc) const;
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
- void update();
+ void update(LyXRC const & rc);
private:
///
///
friend class LnFmisc;
+ class Identity {
+ public:
+ ///
+ Identity(FormPreferences & p);
+ ///
+ FD_preferences_identity const * dialog();
+ ///
+ void apply(LyXRC & rc) const;
+ ///
+ void build();
+ ///
+ std::string const feedback(FL_OBJECT const * const) const;
+ ///
+ void update(LyXRC const & rc);
+
+ private:
+ ///
+ FormPreferences & parent_;
+ ///
+ boost::scoped_ptr<FD_preferences_identity> dialog_;
+ };
+ friend class Identity;
+
///
class OutputsMisc {
public:
///
FD_preferences_outputs_misc const * dialog();
///
- void apply() const;
+ void apply(LyXRC & rc) const;
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
- void update();
+ void update(LyXRC const & rc);
private:
///
///
FD_preferences_paths const * dialog();
///
- void apply();
+ void apply(LyXRC & rc);
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
bool input(FL_OBJECT const * const);
///
- void update();
+ void update(LyXRC const & rc);
private:
///
///
FD_preferences_printer const * dialog();
///
- void apply() const;
+ void apply(LyXRC & rc) const;
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
- void update();
+ void update(LyXRC const & rc);
private:
///
///
FD_preferences_screen_fonts const * dialog();
///
- void apply() const;
+ void apply(LyXRC & rc) const;
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
bool input();
///
- void update();
+ void update(LyXRC const & rc);
private:
///
///
FD_preferences_spelloptions const * dialog();
///
- void apply(); // not const because calls update()!
+ void apply(LyXRC & rc); // not const because calls update()!
///
void build();
///
- string const feedback(FL_OBJECT const * const) const;
+ std::string const feedback(FL_OBJECT const * const) const;
///
bool input(FL_OBJECT const * const);
///
- void update();
+ void update(LyXRC const & rc);
private:
///
///
LnFmisc lnf_misc_;
///
+ Identity identity_;
+ ///
OutputsMisc outputs_misc_;
///
Paths paths_;
///
RGBColor col;
};
- /// The ButtonController
- ButtonController<PreferencesPolicy, xformsBC> bc_;
};
-
-inline
-xformsBC & FormPreferences::bc()
-{
- return bc_;
-}
-
-#endif
+#endif // FORMPREFERENCES_H