]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlCharacter.h
John's character.C patch (bug fix).
[lyx.git] / src / frontends / controllers / ControlCharacter.h
index 92a671fbf3e8bce2fc53ca72f7cee691e70575a0..b479886633e43986a87b0deee35948a28aa4a19e 100644 (file)
@@ -1,3 +1,4 @@
+// -*- C++ -*-
 /**
  * \file ControlCharacter.h
  * Copyright 2001 The LyX Team.
 #ifndef CONTROLCHARACTER_H
 #define CONTROLCHARACTER_H
 
+#include <boost/smart_ptr.hpp>
+
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-#include "ControlConnections.h"
-#include "lyxfont.h"
-#include "LColor.h"
+#include "ControlDialogs.h"
+#include "character.h"
 
 /** A controller for Character dialogs.
  */
-class ControlCharacter : public ControlConnectBD
+class ControlCharacter : public ControlDialog<ControlConnectBD>
 {
 public:
-       ///
-       enum FONT_STATE {
-               ///
-               IGNORE,
-               ///
-               EMPH_TOGGLE,
-               ///
-               UNDERBAR_TOGGLE,
-               ///
-               NOUN_TOGGLE,
-               ///
-               LATEX_TOGGLE,
-               ///
-               INHERIT
-       };
-       
-       ///
-       typedef std::pair<string, LyXFont::FONT_FAMILY> FamilyPair;
-       ///
-       typedef std::pair<string, LyXFont::FONT_SERIES> SeriesPair;
-       ///
-       typedef std::pair<string, LyXFont::FONT_SHAPE>  ShapePair;
-       ///
-       typedef std::pair<string, LyXFont::FONT_SIZE>   SizePair;
-       ///
-       typedef std::pair<string, FONT_STATE> BarPair;
-       ///
-       typedef std::pair<string, LColor::color> ColorPair;
-
        ///
        ControlCharacter(LyXView &, Dialogs &);
 
@@ -63,7 +36,7 @@ public:
        ///
        void setSize(LyXFont::FONT_SIZE);
        ///
-       void setBar(FONT_STATE);
+       void setBar(character::FONT_STATE);
        ///
        void setColor(LColor::color);
        ///
@@ -71,60 +44,33 @@ public:
        ///
        void setToggleAll(bool);
 
-protected:
-       /// Get changed parameters and Dispatch them to the kernel.
-       virtual void apply();
-       /// Show the dialog.
-       virtual void show();
-       /// Update the dialog.
-       virtual void update();
-       /// Hide the dialog.
-       virtual void hide();
-
-private:
-       LyXFont * font_;
-       bool toggleall_;
-};
-
-/// Helper functions
-std::vector<ControlCharacter::FamilyPair> const getFamilyData();
-///
-std::vector<ControlCharacter::SeriesPair> const getSeriesData();
-///
-std::vector<ControlCharacter::ShapePair>  const getShapeData();
-///
-std::vector<ControlCharacter::SizePair>   const getSizeData();
-///
-std::vector<ControlCharacter::BarPair>    const getBarData();
-///
-std::vector<ControlCharacter::ColorPair>  const getColorData();
-///
-std::vector<string> const getLanguageData();
-
-/** This class instantiates and makes available the GUI-specific
-    ButtonController and View.
- */
-template <class GUIview, class GUIbc>
-class GUICharacter : public ControlCharacter {
-public:
        ///
-       GUICharacter(LyXView &, Dialogs &);
+       LyXFont::FONT_FAMILY getFamily() const;
+       ///
+       LyXFont::FONT_SERIES getSeries() const;
+       ///
+       LyXFont::FONT_SHAPE getShape() const;
+       ///
+       LyXFont::FONT_SIZE getSize() const;
        ///
-       virtual ButtonControllerBase & bc() { return bc_; }
+       character::FONT_STATE getBar() const;
        ///
-       virtual ViewBase & view() { return view_; }
+       LColor::color getColor() const;
+       ///
+       string getLanguage() const;
+       ///
+       bool getToggleAll() const;
 
 private:
+       /// Get changed parameters and Dispatch them to the kernel.
+       virtual void apply();
+       /// set the params before show or update.
+       virtual void setParams();
+
        ///
-       ButtonController<NoRepeatedApplyReadOnlyPolicy, GUIbc> bc_;
+       boost::scoped_ptr<LyXFont> font_;
        ///
-       GUIview view_;
+       bool toggleall_;
 };
 
-template <class GUIview, class GUIbc>
-GUICharacter<GUIview, GUIbc>::GUICharacter(LyXView & lv, Dialogs & d)
-       : ControlCharacter(lv, d),
-         view_(*this)
-{}
-
 #endif // CONTROLCHARACTER_H