Match the arguments type in 'max' function
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view.cpp
index 9e8a9c7..471f371 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -190,7 +190,7 @@ FixedRuler::FixedRuler(float spacing)
 {
   if(fabsf(mSpacing) <= Math::MACHINE_EPSILON_1)
   {
-    DALI_LOG_ERROR( "Page spacing too small (%f).", double(spacing) );
+    DALI_LOG_ERROR( "Page spacing too small (%f).\n", double(spacing) );
     mSpacing = spacing >= 0.0f ? Math::MACHINE_EPSILON_1 : -Math::MACHINE_EPSILON_1;
   }
   mType = Fixed;
@@ -248,7 +248,7 @@ unsigned int FixedRuler::GetPageFromPosition(float position, bool wrap) const
     {
       position = WrapInDomain(position, mDomain.min, mDomain.max);
     }
-    page = floor((position - mDomain.min) / mSpacing + 0.5f);
+    page = std::max(static_cast<double>(0.0f), static_cast<double>(floor((position - mDomain.min) / mSpacing + 0.5f)));
 
     if(wrap)
     {
@@ -257,7 +257,7 @@ unsigned int FixedRuler::GetPageFromPosition(float position, bool wrap) const
       if(pagesPerVolume < 1u)
       {
         pagesPerVolume = 1u;
-        DALI_LOG_ERROR("Ruler domain(%f) is smaller than its spacing(%f).", mDomain.GetSize() * 1.0, mSpacing * 1.0 );
+        DALI_LOG_ERROR("Ruler domain(%f) is smaller than its spacing(%f).\n", mDomain.GetSize() * 1.0, mSpacing * 1.0 );
       }
       page %= pagesPerVolume;
     }
@@ -283,28 +283,6 @@ unsigned int FixedRuler::GetTotalPages() const
 // ScrollView
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-const std::string ScrollView::SCROLL_TIME_PROPERTY_NAME( "scroll-time" );
-const std::string ScrollView::SCROLL_POSITION_PROPERTY_NAME( "scroll-position" );
-const std::string ScrollView::SCROLL_PRE_POSITION_PROPERTY_NAME( "scroll-pre-position" );
-const std::string ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME( "scroll-overshoot-x" );
-const std::string ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME( "scroll-overshoot-y" );
-const std::string ScrollView::SCROLL_FINAL_PROPERTY_NAME( "scroll-final" );
-const std::string ScrollView::SCROLL_WRAP_PROPERTY_NAME( "scroll-wrap" );
-const std::string ScrollView::SCROLL_PANNING_PROPERTY_NAME( "scroll-panning" );
-const std::string ScrollView::SCROLL_SCROLLING_PROPERTY_NAME( "scroll-scrolling" );
-const std::string ScrollView::SCROLL_POSITION_DELTA_PROPERTY_NAME( "scroll-position-delta" );
-const std::string ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME( "scroll-start-page-position" );
-
-const float ScrollView::DEFAULT_SLOW_SNAP_ANIMATION_DURATION(0.5f);
-const float ScrollView::DEFAULT_FAST_SNAP_ANIMATION_DURATION(0.25f);
-const float ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f);
-const float ScrollView::DEFAULT_MAX_OVERSHOOT(100.0f);  // 100 pixels
-
-const float ScrollView::DEFAULT_AXIS_AUTO_LOCK_GRADIENT(0.36f);
-const float ScrollView::DEFAULT_FRICTION_COEFFICIENT(1.0f);
-const float ScrollView::DEFAULT_FLICK_SPEED_COEFFICIENT(1.0f);
-const float ScrollView::DEFAULT_MAX_FLICK_SPEED(3.0f);
-
 ScrollView::ScrollView()
 {
 }
@@ -508,53 +486,48 @@ void ScrollView::SetMaxFlickSpeed(float speed)
   GetImpl(*this).SetMaxFlickSpeed(speed);
 }
 
-Vector2 ScrollView::GetMouseWheelScrollDistanceStep() const
+Vector2 ScrollView::GetWheelScrollDistanceStep() const
 {
-  return GetImpl(*this).GetMouseWheelScrollDistanceStep();
+  return GetImpl(*this).GetWheelScrollDistanceStep();
 }
 
-void ScrollView::SetMouseWheelScrollDistanceStep(Vector2 step)
+void ScrollView::SetWheelScrollDistanceStep(Vector2 step)
 {
-  GetImpl(*this).SetMouseWheelScrollDistanceStep(step);
+  GetImpl(*this).SetWheelScrollDistanceStep(step);
 }
 
-Vector3 ScrollView::GetCurrentScrollPosition() const
+Vector2 ScrollView::GetCurrentScrollPosition() const
 {
   return GetImpl(*this).GetCurrentScrollPosition();
 }
 
-void ScrollView::SetScrollPosition(const Vector3& position)
-{
-  GetImpl(*this).SetScrollPosition(position);
-}
-
 unsigned int ScrollView::GetCurrentPage() const
 {
   return GetImpl(*this).GetCurrentPage();
 }
 
-void ScrollView::ScrollTo(const Vector3 &position)
+void ScrollView::ScrollTo(const Vector2 &position)
 {
   GetImpl(*this).ScrollTo(position);
 }
 
-void ScrollView::ScrollTo(const Vector3 &position, float duration)
+void ScrollView::ScrollTo(const Vector2 &position, float duration)
 {
   GetImpl(*this).ScrollTo(position, duration);
 }
 
-void ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha)
+void ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha)
 {
   GetImpl(*this).ScrollTo(position, duration, alpha);
 }
 
-void ScrollView::ScrollTo(const Vector3 &position, float duration,
+void ScrollView::ScrollTo(const Vector2 &position, float duration,
                           DirectionBias horizontalBias, DirectionBias verticalBias)
 {
   GetImpl(*this).ScrollTo(position, duration, horizontalBias, verticalBias);
 }
 
-void ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha,
+void ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha,
                           DirectionBias horizontalBias, DirectionBias verticalBias)
 {
   GetImpl(*this).ScrollTo(position, duration, alpha, horizontalBias, verticalBias);