[cluttermm] Animatable: Whitespace corrections and some comments.



commit 62a23bfb9d8510b49a78e8cbf80609a05945695a
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Mar 19 10:40:39 2014 +0100

    Animatable: Whitespace corrections and some comments.
    
    And I worry that the VFUNCS using ValueBase& might cause problems.

 clutter/src/animatable.hg |   66 ++++++++++++++++++++++----------------------
 1 files changed, 33 insertions(+), 33 deletions(-)
---
diff --git a/clutter/src/animatable.hg b/clutter/src/animatable.hg
index c984f99..f89e579 100644
--- a/clutter/src/animatable.hg
+++ b/clutter/src/animatable.hg
@@ -42,44 +42,49 @@ class Animatable : public Glib::Interface
 public:
   //no constructor- virtual base class.
 
+  //TODO: Maybe we shouldn't bother wrapping this? It might not be useful and we have no GParamSpec wrapper:
   _WRAP_METHOD(GParamSpec* find_property(const Glib::ustring& property_name), 
clutter_animatable_find_property)
+
   _WRAP_METHOD(void get_initial_state_value(const Glib::ustring& property_name, Glib::ValueBase& value) 
const, clutter_animatable_get_initial_state, constversion)
   _WRAP_METHOD(void set_final_state_value(const Glib::ustring& property_name, const Glib::ValueBase& value), 
clutter_animatable_set_final_state)
   //_WRAP_METHOD(void interpolate_value(const Glib::ustring& property_name, Glib::RefPtr<Interval>& 
interval, double progress, Glib::ValueBase& value), clutter_animatable_interpolate_value)
 
   /**
-  * Gets the initial state of an animation
-  *
-  * @param property_name the name of the animatable property to retrieve
-  * @param value the value of the property.
-  */
+   * Gets the initial state of an animation
+   *
+   * @param property_name the name of the animatable property to retrieve
+   * @param value the value of the property.
+   */
   template <class ValueType>
   void get_initial_state(const Glib::ustring& property_name, ValueType& value) const;
 
   /**
-  * Sets the final state for an animation.
-  *
-  * @param property_name the name of the animatable property to set.
-  * @param gvalue a value of the appropriate type.
-  */
+   * Sets the final state for an animation.
+   *
+   * @param property_name the name of the animatable property to set.
+   * @param gvalue a value of the appropriate type.
+   */
   template <class ValueType>
-  void set_final_state(const Glib::ustring& property_name,
-            const ValueType& gvalue);
+  void set_final_state(const Glib::ustring& property_name, const ValueType& gvalue);
 
 
+  //TODO: Documentation
   template <class ValueType>
   bool interpolate(const Glib::ustring& property_name,
-            Glib::RefPtr<Interval>& interval,
-            double progress,
-            ValueType& gvalue);
+    Glib::RefPtr<Interval>& interval,
+    double progress,
+    ValueType& gvalue);
+
 protected:
 
+  //TODO: Maybe we shouldn't bother wrapping this? It might not be useful and we have no GParamSpec wrapper:
   _WRAP_VFUNC(GParamSpec* find_property(const Glib::ustring& property_name), find_property)
+
   _WRAP_VFUNC(void get_initial_state(const Glib::ustring& property_name, Glib::ValueBase& value), 
get_initial_state)
   _WRAP_VFUNC(void set_final_state(const Glib::ustring& property_name, const Glib::ValueBase& value), 
set_final_state)
+
   //TODO: this function doesn't wrap.  removed from build for the present.
   //_WRAP_VFUNC(bool interpolate_value(const Glib::ustring& property_name, Glib::RefPtr<Interval> interval, 
double progress, Glib::ValueBase& value), interpolate_value)
-
 };
 
 
@@ -94,8 +99,7 @@ void Animatable::get_initial_state(const Glib::ustring& property_name, ValueType
 }
 
 template <class ValueType>
-    void Animatable::set_final_state(const Glib::ustring& property_name,
-                    const ValueType& gvalue)
+void Animatable::set_final_state(const Glib::ustring& property_name, const ValueType& gvalue)
 {
   Glib::Value<ValueType> glibmm_g_value;
   glibmm_g_value.init(Glib::Value<ValueType>::value_type());
@@ -106,27 +110,23 @@ template <class ValueType>
 
 template <class ValueType>
 bool Animatable::interpolate(const Glib::ustring& property_name,
-            Glib::RefPtr<Interval>& interval,
-            double progress,
-            ValueType& gvalue)
+  Glib::RefPtr<Interval>& interval,
+  double progress,
+  ValueType& gvalue)
 {
-  //Need to cast away const:
-  ClutterAnimatable* animatable_ptr = const_cast<ClutterAnimatable*>(gobj());
-
   Glib::Value<ValueType> glibmm_g_value;
   glibmm_g_value.init(Glib::Value<ValueType>::value_type());
   glibmm_g_value.set(gvalue);
 
-  bool out = clutter_animatable_interpolate_value(
-        animatable_ptr,
-        property_name.c_str(),
-        interval->gobj(),
-        progress,
-        glibmm_g_value.gobj());
-
-    gvalue = glibmm_g_value.get();
-    return out;
+  const bool out = clutter_animatable_interpolate_value(
+    const_cast<ClutterAnimatable*>(gobj()),
+    property_name.c_str(),
+    interval->gobj(),
+    progress,
+    glibmm_g_value.gobj());
 
+  gvalue = glibmm_g_value.get();
+  return out;
 }
 
 } // namespace Clutter


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]