]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormPreferences.h
Tiny clean-ups.
[lyx.git] / src / frontends / xforms / FormPreferences.h
index 8635d362f6ff756c523eab19d46f1265cf7ddeb9..d9d76dfd4d1e9faf0cfb540d003e82e5d6ad2d05 100644 (file)
@@ -1,34 +1,34 @@
 // -*- 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, a.leeming@ic.ac.uk
+ * \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;
@@ -37,6 +37,7 @@ struct FD_preferences_inputs_misc;
 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;
@@ -46,16 +47,13 @@ struct FD_preferences_spelloptions;
 
 
 /** 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();
@@ -63,26 +61,15 @@ private:
        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
@@ -101,8 +88,7 @@ private:
        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
                };
                ///
@@ -114,7 +100,7 @@ private:
                ///
                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);
                ///
@@ -129,22 +115,16 @@ private:
                ///
                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;
@@ -166,7 +146,7 @@ private:
                ///
                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);
                ///
@@ -186,9 +166,9 @@ private:
                ///
                bool Input();
                ///
-               string const GetFrom() const;
+               std::string const GetFrom() const;
                ///
-               string const GetTo() const;
+               std::string const GetTo() const;
 
                ///
                FormPreferences & parent_;
@@ -210,7 +190,7 @@ private:
                ///
                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);
                ///
@@ -244,13 +224,13 @@ private:
                ///
                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:
                ///
@@ -269,15 +249,15 @@ 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:
                ///
@@ -296,17 +276,15 @@ 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:
                ///
@@ -314,9 +292,7 @@ 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;
@@ -329,13 +305,13 @@ private:
                ///
                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:
                ///
@@ -346,6 +322,29 @@ 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:
@@ -354,13 +353,13 @@ private:
                ///
                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:
                ///
@@ -379,15 +378,15 @@ 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:
                ///
@@ -406,13 +405,13 @@ 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:
                ///
@@ -431,15 +430,15 @@ 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:
                ///
@@ -458,15 +457,15 @@ 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:
                ///
@@ -495,6 +494,8 @@ private:
        ///
        LnFmisc lnf_misc_;
        ///
+       Identity identity_;
+       ///
        OutputsMisc outputs_misc_;
        ///
        Paths paths_;
@@ -522,15 +523,6 @@ private:
                ///
                RGBColor col;
        };
-       /// The ButtonController
-       ButtonController<PreferencesPolicy, xformsBC> bc_;
 };
 
-
-inline
-xformsBC & FormPreferences::bc()
-{
-       return bc_;
-}
-
-#endif
+#endif // FORMPREFERENCES_H