]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormPreferences.h
The Movers patch.
[lyx.git] / src / frontends / xforms / FormPreferences.h
index eb47395589937605beb710ce7e4c771bed40a9c7..8adb810ddcdcc2f94fdaa53351dacd3898d51c56 100644 (file)
@@ -1,46 +1,46 @@
 // -*- C++ -*-
 /**
  * \file FormPreferences.h
- * Copyright 1999-2001 Allan Rae
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
  * \author Allan Rae
  * \author Angus Leeming
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #ifndef FORMPREFERENCES_H
 #define FORMPREFERENCES_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
+#include "FormDialogView.h"
 
-#include "FormBase.h"
-#include "Color.h" // NamedColor
-#include "xforms_helpers.h" // XformColor
+#include "lyx_forms.h"
 
 #include <boost/scoped_ptr.hpp>
 
-#include FORMS_H_LOCATION
-#include <utility> // pair
+class Converters;
+class Formats;
+class Movers;
 
-class ControlPrefs;
-
-class Combox;
 class Dialogs;
+class LyXRC;
 class LyXView;
-class RGBColor;
+
+namespace lyx {
+namespace frontend {
+
+class ControlPrefs;
 struct FD_preferences;
 struct FD_preferences_colors;
 struct FD_preferences_converters;
+struct FD_preferences_copiers;
 struct FD_preferences_formats;
 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;
@@ -48,13 +48,18 @@ struct FD_preferences_printer;
 struct FD_preferences_screen_fonts;
 struct FD_preferences_spelloptions;
 
+class FormColorpicker;
+class NamedColor;
+class RGBColor;
+class XformsColor;
 
 /** 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 FormCB<ControlPrefs, FormDB<FD_preferences> > {
+class FormPreferences
+       : public FormController<ControlPrefs, FormView<FD_preferences> > {
 public:
-       FormPreferences();
+       FormPreferences(Dialog &);
 
 private:
        /** Redraw the form (on receipt of a Signal indicating, for example,
@@ -71,7 +76,7 @@ private:
        /// Build the dialog
        virtual void build();
        /// control which feedback message is output
-       string const getFeedback(FL_OBJECT *);
+       std::string const getFeedback(FL_OBJECT *);
 
        /// Converters tabfolder
        boost::scoped_ptr<FD_preferences_inner_tab> converters_tab_;
@@ -91,8 +96,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
                };
                ///
@@ -104,7 +108,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);
                ///
@@ -119,22 +123,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;
@@ -152,11 +150,9 @@ private:
                ///
                FD_preferences_converters const * dialog();
                ///
-               void apply() 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);
                ///
@@ -164,7 +160,7 @@ private:
                ///
                void UpdateBrowser();
                ///
-               void UpdateChoices() const;
+               void UpdateChoices();
 
        private:
                ///
@@ -176,9 +172,12 @@ private:
                ///
                bool Input();
                ///
-               string const GetFrom() const;
+               std::string const GetFrom();
                ///
-               string const GetTo() const;
+               std::string const GetTo();
+               ///
+               ::Converters & converters();
+               ::Formats & formats();
 
                ///
                FormPreferences & parent_;
@@ -188,6 +187,42 @@ private:
        ///
        friend class Converters;
 
+       ///
+       class Copiers {
+       public:
+               ///
+               Copiers(FormPreferences & p);
+               ///
+               FD_preferences_copiers const * dialog();
+               ///
+               void build();
+               ///
+               std::string const feedback(FL_OBJECT const * const) const;
+               ///
+               bool input(FL_OBJECT const * const);
+               ///
+               void update();
+
+       private:
+               ///
+               bool Add();
+               ///
+               bool Browser();
+               ///
+               bool Erase();
+               ///
+               bool Input();
+               ///
+               ::Movers & movers();
+
+               ///
+               FormPreferences & parent_;
+               ///
+               boost::scoped_ptr<FD_preferences_copiers> dialog_;
+       };
+       ///
+       friend class Copiers;
+
        ///
        class Formats {
        public:
@@ -196,11 +231,9 @@ private:
                ///
                FD_preferences_formats const * dialog();
                ///
-               void apply() 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);
                ///
@@ -217,6 +250,9 @@ private:
                bool erase();
                ///
                bool Input();
+               //
+               ::Converters & converters();
+               ::Formats & formats();
 
                ///
                FormPreferences & parent_;
@@ -238,7 +274,7 @@ private:
                ///
                void build();
                ///
-               string const feedback(FL_OBJECT const * const) const;
+               std::string const feedback(FL_OBJECT const * const) const;
                ///
                void update(LyXRC const & rc);
 
@@ -263,7 +299,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);
                ///
@@ -290,13 +326,11 @@ 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);
                ///
                void update(LyXRC const & rc);
-               ///
-               static void ComboCB(int, void *, Combox *);
 
        private:
                ///
@@ -304,9 +338,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;
@@ -323,7 +355,7 @@ private:
                ///
                void build();
                ///
-               string const feedback(FL_OBJECT const * const) const;
+               std::string const feedback(FL_OBJECT const * const) const;
                ///
                void update(LyXRC const & rc);
 
@@ -336,6 +368,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:
@@ -348,7 +403,7 @@ private:
                ///
                void build();
                ///
-               string const feedback(FL_OBJECT const * const) const;
+               std::string const feedback(FL_OBJECT const * const) const;
                ///
                void update(LyXRC const & rc);
 
@@ -373,7 +428,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);
                ///
@@ -400,7 +455,7 @@ private:
                ///
                void build();
                ///
-               string const feedback(FL_OBJECT const * const) const;
+               std::string const feedback(FL_OBJECT const * const) const;
                ///
                void update(LyXRC const & rc);
 
@@ -425,7 +480,7 @@ private:
                ///
                void build();
                ///
-               string const feedback(FL_OBJECT const * const) const;
+               std::string const feedback(FL_OBJECT const * const) const;
                ///
                bool input();
                ///
@@ -452,7 +507,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);
                ///
@@ -475,10 +530,14 @@ private:
        ///
        Converters converters_;
        ///
-       InputsMisc inputs_misc_;
+       Copiers copiers_;
        ///
        Formats formats_;
        ///
+       Identity identity_;
+       ///
+       InputsMisc inputs_misc_;
+       ///
        Interface interface_;
        ///
        Language language_;
@@ -494,24 +553,9 @@ private:
        ScreenFonts screen_fonts_;
        ///
        SpellOptions spelloptions_;
-
-       /** A couple of helper structs to enable colors to be sorted by name
-           and by color */
-       ///
-       struct SortColorsByName {
-               ///
-               int operator()(NamedColor const & a, NamedColor const & b) const
-                       { return (a.getname() < b.getname()); }
-       };
-       ///
-       struct SortColorsByColor {
-               ///
-               SortColorsByColor(RGBColor c) : col(c) {}
-               ///
-               int operator()(RGBColor const &, RGBColor const &) const;
-               ///
-               RGBColor col;
-       };
 };
 
+} // namespace frontend
+} // namespace lyx
+
 #endif // FORMPREFERENCES_H