Merge "Make radio buttons work with size negotiation, bug fixes." into tizen
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Thu, 25 Sep 2014 14:19:01 +0000 (07:19 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 25 Sep 2014 14:19:01 +0000 (07:19 -0700)
33 files changed:
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp [deleted file]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.h [deleted file]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard-event-notifier.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.h
automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp
base/dali-toolkit/internal/builder/builder-impl.cpp
base/dali-toolkit/internal/controls/buttons/button-impl.cpp
base/dali-toolkit/internal/controls/buttons/button-impl.h
base/dali-toolkit/internal/controls/buttons/push-button-impl.cpp
base/dali-toolkit/internal/controls/buttons/push-button-impl.h
base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-impl.h
base/dali-toolkit/internal/controls/text-view/relayout-utilities.cpp
base/dali-toolkit/internal/controls/text-view/text-processor-bidirectional-info.cpp
base/dali-toolkit/internal/controls/text-view/text-processor-bidirectional-info.h
base/dali-toolkit/internal/controls/text-view/text-view-character-processor.cpp
base/dali-toolkit/internal/controls/text-view/text-view-processor-types.h
base/dali-toolkit/internal/controls/text-view/text-view-word-processor.cpp
base/dali-toolkit/internal/factory/localized-control-factory-impl.cpp [deleted file]
base/dali-toolkit/internal/factory/localized-control-factory-impl.h [deleted file]
base/dali-toolkit/internal/file.list
base/dali-toolkit/internal/styling/style-manager-impl.cpp
base/dali-toolkit/public-api/factory/localized-control-factory.cpp [deleted file]
base/dali-toolkit/public-api/factory/localized-control-factory.h [deleted file]
base/dali-toolkit/public-api/file.list
build/tizen/dali-toolkit/Makefile.am
optional/dali-toolkit/dali-toolkit.h
optional/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp
optional/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp

index ff683d5..78b995d 100644 (file)
@@ -18,7 +18,6 @@ SET(TC_SOURCES
 # Append list of test harness files (Won't get parsed for test cases)
 LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
-   ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
index 60d94aa..c58d7f2 100644 (file)
@@ -56,7 +56,6 @@ SET(TC_SOURCES
 # Append list of test harness files (Won't get parsed for test cases)
 LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
-   ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp
index 52f8353..afe9242 100644 (file)
@@ -37,7 +37,6 @@ SET(TC_SOURCES
 # Append list of test harness files (Won't get parsed for test cases)
 LIST(APPEND TC_SOURCES
    dali-toolkit-test-utils/toolkit-accessibility-manager.cpp
-   dali-toolkit-test-utils/toolkit-adaptor.cpp
    dali-toolkit-test-utils/toolkit-application.cpp
    dali-toolkit-test-utils/toolkit-clipboard.cpp
    dali-toolkit-test-utils/toolkit-imf-manager.cpp
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
deleted file mode 100644 (file)
index 17bd210..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#define __DALI_ADAPTOR_H__
-#define __DALI_ACCESSIBILITY_MANAGER_H__
-#define __DALI_TIMER_H__
-#define __DALI_CLIPBOARD_H__
-#define __DALI_IMF_MANAGER_H__
-
-#include "toolkit-adaptor.h"
-#include <map>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
-
-namespace Dali
-{
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class TestRenderSurface : public RenderSurface
-{
-public:
-  TestRenderSurface(){}
-  virtual ~TestRenderSurface(){}
-  virtual SurfaceType GetType() { return RenderSurface::WINDOW; }
-  virtual Dali::Any GetSurface() { return Dali::Any(); }
-  virtual Dali::Any GetDisplay() { return Dali::Any(); }
-  virtual PositionSize GetPositionSize() const { return PositionSize(0, 0, 640, 480);}
-};
-
-typedef Dali::Rect<int> PositionSize;
-
-/**
- * Stub for the Adaptor
- */
-class Adaptor
-{
-public:
-
-  typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2;
-
-public:
-
-  Adaptor(ToolkitAdaptor& toolkitAdaptor);
-  ~Adaptor();
-
-public:
-
-  void Start();
-  void Pause();
-  void Resume();
-  void Stop();
-  bool AddIdle(boost::function<void(void)> callBack);
-  void FeedEvent(TouchPoint& point, int timeStamp);
-  bool MoveResize(const PositionSize& positionSize);
-  void SurfaceResized(const PositionSize& positionSize);
-  void ReplaceSurface(RenderSurface& surface);
-  void RenderSync();
-  RenderSurface& GetSurface();
-
-public: // static methods
-  static Adaptor& Get();
-  static bool IsAvailable();
-
-public:  // Signals
-
-  AdaptorSignalV2& SignalResize();
-
-  void EmitSignalResize()
-  {
-    mResizeSignal.Emit( *this );
-  }
-
-private:
-
-  // Undefined
-  Adaptor(const Adaptor&);
-  Adaptor& operator=(Adaptor&);
-
-  AdaptorSignalV2 mResizeSignal;
-  TestRenderSurface mRenderSurface;
-  ToolkitAdaptor& mToolkitAdaptor;
-};
-
-namespace
-{
-Adaptor* gAdaptor = NULL;
-
-}
-
-Adaptor::Adaptor(ToolkitAdaptor& toolkitAdaptor)
-: mToolkitAdaptor(toolkitAdaptor)
-{
-}
-
-Adaptor::~Adaptor()
-{
-
-}
-
-void Adaptor::Start()
-{
-  mToolkitAdaptor.mFunctionsCalled.Start = true;
-}
-
-void Adaptor::Pause()
-{
-  mToolkitAdaptor.mFunctionsCalled.Pause = true;
-}
-
-void Adaptor::Resume()
-{
-  mToolkitAdaptor.mFunctionsCalled.Resume = true;
-}
-
-void Adaptor::Stop()
-{
-  mToolkitAdaptor.mFunctionsCalled.Stop = true;
-}
-
-bool Adaptor::AddIdle(boost::function<void(void)> callBack)
-{
-  mToolkitAdaptor.mFunctionsCalled.AddIdle = true;
-  mToolkitAdaptor.mLastIdleAdded = callBack;
-  return true;
-}
-
-void Adaptor::FeedEvent(TouchPoint& point, int timeStamp)
-{
-  mToolkitAdaptor.mFunctionsCalled.FeedEvent = true;
-  mToolkitAdaptor.mLastTouchPointFed = point;
-  mToolkitAdaptor.mLastTimeStampFed = timeStamp;
-}
-
-bool Adaptor::MoveResize(const PositionSize& positionSize)
-{
-  mToolkitAdaptor.mFunctionsCalled.MoveResize = true;
-  mToolkitAdaptor.mLastSizeSet = positionSize;
-  return true;
-}
-
-void Adaptor::SurfaceResized(const PositionSize& positionSize)
-{
-  mToolkitAdaptor.mFunctionsCalled.SurfaceResized = true;
-  mToolkitAdaptor.mLastSizeSet = positionSize;
-}
-
-void Adaptor::ReplaceSurface(RenderSurface& surface)
-{
-  mToolkitAdaptor.mFunctionsCalled.ReplaceSurface = true;
-}
-
-void Adaptor::RenderSync()
-{
-  mToolkitAdaptor.mFunctionsCalled.RenderSync = true;
-}
-
-RenderSurface& Adaptor::GetSurface()
-{
-  mToolkitAdaptor.mFunctionsCalled.GetSurface = true;
-  return mRenderSurface;
-}
-
-Adaptor& Adaptor::Get()
-{
-  DALI_ASSERT_ALWAYS(gAdaptor);
-  gAdaptor->mToolkitAdaptor.mFunctionsCalled.Get = true;
-  return *gAdaptor;
-}
-
-bool Adaptor::IsAvailable()
-{
-  bool available(false);
-
-  if (gAdaptor)
-  {
-    gAdaptor->mToolkitAdaptor.mFunctionsCalled.IsAvailable = true;
-    available = true;
-  }
-
-  return available;
-}
-
-Adaptor::AdaptorSignalV2& Adaptor::SignalResize()
-{
-  mToolkitAdaptor.mFunctionsCalled.SignalResize = true;
-  return mResizeSignal;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ToolkitAdaptor::ToolkitAdaptor()
-: mLastTouchPointFed(0, TouchPoint::Down, 0.0f, 0.0f),
-  mLastTimeStampFed(0),
-  mStyleMonitor(StyleMonitor::Get()),
-  mAccessibilityManager(AccessibilityManager::Get()),
-  mImfManager(ImfManager::Get()),
-  mAdaptorStub(new Adaptor(*this))
-{
-  gAdaptor = mAdaptorStub;
-}
-
-ToolkitAdaptor::~ToolkitAdaptor()
-{
-  delete mAdaptorStub;
-  gAdaptor = NULL;
-}
-
-void ToolkitAdaptor::EmitSignalResize()
-{
-  mAdaptorStub->EmitSignalResize();
-}
-
-} // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.h
deleted file mode 100644 (file)
index 5d8473c..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-#ifndef __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
-#define __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
-// INTERNAL INCLUDES
-#include "toolkit-style-monitor.h"
-#include "toolkit-accessibility-manager.h"
-#include "toolkit-timer.h"
-#include "toolkit-imf-manager.h"
-#include "toolkit-clipboard-event-notifier.h"
-
-#include <dali/public-api/events/touch-point.h>
-#include <dali/public-api/math/rect.h>
-
-namespace Dali
-{
-
-class Adaptor;
-
-typedef Dali::Rect<int> PositionSize;
-
-/**
- * This creates a stubbed Adaptor so that internal Toolkit Adaptor calls work.
- * Furthermore, it provides an interface to see if certain methods were invoked.
- */
-class ToolkitAdaptor
-{
-public: // Construction & Destruction
-
-  ToolkitAdaptor();
-  ~ToolkitAdaptor();
-
-public: // Getters
-
-  boost::function<void(void)> GetLastIdleAdded() const
-  {
-    return mLastIdleAdded;
-  }
-
-  TouchPoint GetLastTouchPointFed() const
-  {
-    return mLastTouchPointFed;
-  }
-
-  int GetLastTimeStampFed() const
-  {
-    return mLastTimeStampFed;
-  }
-
-  PositionSize GetLastSizeSet() const
-  {
-    return mLastSizeSet;
-  }
-
-  StyleMonitor& GetToolkitStyleMonitor()
-  {
-    return mStyleMonitor;
-  }
-
-  AccessibilityManager& GetAccessibilityManager()
-  {
-    return mAccessibilityManager;
-  }
-
-  ToolkitClipboardEventNotifier& GetClipboardEventNotifier()
-  {
-    return mClipboardEventNotifier;
-  }
-
-public: // Signal Emissions
-
-  void EmitSignalResize();
-
-public: // TEST FUNCTIONS
-
-  // Enumeration of Adaptor methods
-  enum TestFuncEnum
-  {
-    StartType,
-    PauseType,
-    ResumeType,
-    StopType,
-    AddIdleType,
-    FeedEventType,
-    MoveResizeType,
-    SurfaceResizedType,
-    ReplaceSurfaceType,
-    RenderSyncType,
-    GetSurfaceType,
-    GetType,
-    IsAvailableType,
-    RegisterSingletonType,
-    GetSingletonType,
-    SignalResizeType,
-  };
-
-  void Reset()
-  {
-    mFunctionsCalled.Reset();
-  }
-
-  bool WasCalled(TestFuncEnum func)
-  {
-    switch(func)
-    {
-      case StartType:                             return mFunctionsCalled.Start;
-      case PauseType:                             return mFunctionsCalled.Pause;
-      case ResumeType:                            return mFunctionsCalled.Resume;
-      case StopType:                              return mFunctionsCalled.Stop;
-      case AddIdleType:                           return mFunctionsCalled.AddIdle;
-      case FeedEventType:                         return mFunctionsCalled.FeedEvent;
-      case MoveResizeType:                        return mFunctionsCalled.MoveResize;
-      case SurfaceResizedType:                    return mFunctionsCalled.SurfaceResized;
-      case ReplaceSurfaceType:                    return mFunctionsCalled.ReplaceSurface;
-      case RenderSyncType:                        return mFunctionsCalled.RenderSync;
-      case GetSurfaceType:                        return mFunctionsCalled.GetSurface;
-      case GetType:                               return mFunctionsCalled.Get;
-      case IsAvailableType:                       return mFunctionsCalled.IsAvailable;
-      case RegisterSingletonType:                 return mFunctionsCalled.RegisterSingleton;
-      case GetSingletonType:                      return mFunctionsCalled.GetSingleton;
-      case SignalResizeType:                      return mFunctionsCalled.SignalResize;
-    }
-    return false;
-  }
-
-  void ResetCallStatistics(TestFuncEnum func)
-  {
-    switch(func)
-    {
-      case StartType:                             mFunctionsCalled.Start = false; break;
-      case PauseType:                             mFunctionsCalled.Pause = false; break;
-      case ResumeType:                            mFunctionsCalled.Resume = false; break;
-      case StopType:                              mFunctionsCalled.Stop = false; break;
-      case AddIdleType:                           mFunctionsCalled.AddIdle = false; break;
-      case FeedEventType:                         mFunctionsCalled.FeedEvent = false; break;
-      case MoveResizeType:                        mFunctionsCalled.MoveResize = false; break;
-      case SurfaceResizedType:                    mFunctionsCalled.SurfaceResized = false; break;
-      case ReplaceSurfaceType:                    mFunctionsCalled.ReplaceSurface = false; break;
-      case RenderSyncType:                        mFunctionsCalled.RenderSync = false; break;
-      case GetSurfaceType:                        mFunctionsCalled.GetSurface = false; break;
-      case GetType:                               mFunctionsCalled.Get = false; break;
-      case IsAvailableType:                       mFunctionsCalled.IsAvailable = false; break;
-      case RegisterSingletonType:                 mFunctionsCalled.RegisterSingleton = false; break;
-      case GetSingletonType:                      mFunctionsCalled.GetSingleton = false; break;
-      case SignalResizeType:                      mFunctionsCalled.SignalResize = false; break;
-    }
-  }
-
-private:
-
-  struct TestFunctions
-  {
-    TestFunctions()
-    : Start(false),
-      Pause(false),
-      Resume(false),
-      Stop(false),
-      AddIdle(false),
-      FeedEvent(false),
-      MoveResize(false),
-      SurfaceResized(false),
-      ReplaceSurface(false),
-      RenderSync(false),
-      GetSurface(false),
-      Get(false),
-      IsAvailable(false),
-      RegisterSingleton(false),
-      GetSingleton(false),
-      SignalResize(false)
-    {
-    }
-
-    void Reset()
-    {
-      Start = false;
-      Pause = false;
-      Resume = false;
-      Stop = false;
-      AddIdle = false;
-      FeedEvent = false;
-      MoveResize = false;
-      SurfaceResized = false;
-      ReplaceSurface = false;
-      RenderSync = false;
-      GetSurface = false;
-      Get = false;
-      IsAvailable = false;
-      RegisterSingleton = false;
-      GetSingleton = false;
-      SignalResize = false;
-    }
-
-    bool Start;
-    bool Pause;
-    bool Resume;
-    bool Stop;
-    bool AddIdle;
-    bool FeedEvent;
-    bool MoveResize;
-    bool SurfaceResized;
-    bool ReplaceSurface;
-    bool RenderSync;
-    bool GetSurface;
-    bool Get;
-    bool IsAvailable;
-    bool RegisterSingleton;
-    bool GetSingleton;
-    bool SignalResize;
-  };
-
-  TestFunctions mFunctionsCalled;
-
-  // Last set information
-  boost::function<void(void)> mLastIdleAdded;
-  TouchPoint mLastTouchPointFed;
-  int mLastTimeStampFed;
-  PositionSize mLastSizeSet;
-
-  // Contains Test functions for the Style Monitor
-  StyleMonitor mStyleMonitor;
-
-  // Stub for AccessibilityManager
-  AccessibilityManager mAccessibilityManager;
-
-  // Stub for ClipboardEventNotifier
-  ToolkitClipboardEventNotifier mClipboardEventNotifier;
-
-  ImfManager mImfManager;
-
-  // The Adaptor Stub
-  Adaptor* mAdaptorStub;
-  friend class Adaptor;
-};
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_TOOLKIT_ADAPTOR_H__
index e4dc0cc..cf00a92 100644 (file)
 namespace Dali
 {
 
-namespace
-{
-ToolkitClipboardEventNotifier* gToolkitClipboardEventNotifier(NULL);
-} // unnamed namespace
-
 namespace Internal
 {
 
 namespace Adaptor
 {
 
-/**
- * Stub for the ClipboardEventNotifier
- */
-class ClipboardEventNotifier : public BaseObject
+class ClipboardEventNotifier : public Dali::BaseObject
 {
-public: // Creation & Destruction
+public:
+
+  typedef Dali::ClipboardEventNotifier::ClipboardEventSignalV2 ClipboardEventSignalV2;
 
+  // Creation
+  static Dali::ClipboardEventNotifier New();
   static Dali::ClipboardEventNotifier Get();
 
+  // Public API
+  const std::string& GetContent() const;
+  void SetContent( const std::string& content );
+  void ClearContent();
+  void EmitContentSelectedSignal();
+
+  // Signals
+  ClipboardEventSignalV2& ContentSelectedSignal()
+  {
+    return mContentSelectedSignalV2;
+  }
+
+private:
+  // Construction & Destruction
   ClipboardEventNotifier();
-  ClipboardEventNotifier(ToolkitClipboardEventNotifier *clipboardEventNotifier);
-  ~ClipboardEventNotifier();
+  virtual ~ClipboardEventNotifier();
+
+  // Undefined
+  ClipboardEventNotifier( const ClipboardEventNotifier& );
+  ClipboardEventNotifier& operator=( ClipboardEventNotifier& );
+
+private:
 
-public: // Signals
+  std::string mContent;    ///< The current selected content.
+  ClipboardEventSignalV2 mContentSelectedSignalV2;
 
-  Dali::ClipboardEventNotifier::ClipboardEventSignalV2& SignalContentSelected()
+  static Dali::ClipboardEventNotifier mToolkitClipboardEventNotifier;
+
+public:
+
+  // Helpers for public-api forwarding methods
+
+  inline static Internal::Adaptor::ClipboardEventNotifier& GetImplementation(Dali::ClipboardEventNotifier& detector)
   {
-    return mClipboardSignal;
+    DALI_ASSERT_ALWAYS( detector && "ClipboardEventNotifier handle is empty" );
+
+    BaseObject& handle = detector.GetBaseObject();
+
+    return static_cast<Internal::Adaptor::ClipboardEventNotifier&>(handle);
   }
 
-private:
+  inline static const Internal::Adaptor::ClipboardEventNotifier& GetImplementation(const Dali::ClipboardEventNotifier& detector)
+  {
+    DALI_ASSERT_ALWAYS( detector && "ClipboardEventNotifier handle is empty" );
+
+    const BaseObject& handle = detector.GetBaseObject();
 
-  ToolkitClipboardEventNotifier* mToolkitClipboardEventNotifier;
-  Dali::ClipboardEventNotifier::ClipboardEventSignalV2 mClipboardSignal;
+    return static_cast<const Internal::Adaptor::ClipboardEventNotifier&>(handle);
+  }
 
 };
 
+Dali::ClipboardEventNotifier ClipboardEventNotifier::mToolkitClipboardEventNotifier;
+
+Dali::ClipboardEventNotifier ClipboardEventNotifier::New()
+{
+  return Get();
+}
+
 Dali::ClipboardEventNotifier ClipboardEventNotifier::Get()
 {
-  return gToolkitClipboardEventNotifier->GetClipboardEventNotifier();
+  if ( !mToolkitClipboardEventNotifier )
+  {
+    mToolkitClipboardEventNotifier = Dali::ClipboardEventNotifier( new ClipboardEventNotifier );
+  }
+  return mToolkitClipboardEventNotifier;
 }
 
-ClipboardEventNotifier::ClipboardEventNotifier()
-: mToolkitClipboardEventNotifier(NULL)
+const std::string& ClipboardEventNotifier::GetContent() const
+{
+  return mContent;
+}
+
+void ClipboardEventNotifier::SetContent( const std::string& content )
 {
+  mContent = content;
 }
 
-ClipboardEventNotifier::ClipboardEventNotifier(ToolkitClipboardEventNotifier *clipboardEventNotifier)
-: mToolkitClipboardEventNotifier(clipboardEventNotifier)
+void ClipboardEventNotifier::ClearContent()
+{
+  mContent.clear();
+}
+
+void ClipboardEventNotifier::EmitContentSelectedSignal()
+{
+  if ( !mContentSelectedSignalV2.Empty() )
+  {
+    Dali::ClipboardEventNotifier handle( this );
+    mContentSelectedSignalV2.Emit( handle );
+  }
+}
+
+ClipboardEventNotifier::ClipboardEventNotifier()
+: mContent()
 {
 }
 
@@ -82,26 +142,53 @@ ClipboardEventNotifier::~ClipboardEventNotifier()
 }
 
 } // namespace Adaptor
-
 } // namespace Internal
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-ToolkitClipboardEventNotifier::ToolkitClipboardEventNotifier()
-: mClipboardEventNotifierStub(new Internal::Adaptor::ClipboardEventNotifier(this)),
-  mClipboardEventNotifier( mClipboardEventNotifierStub )
+const char* const ClipboardEventNotifier::SIGNAL_CONTENT_SELECTED( "content-selected" );
+
+ClipboardEventNotifier::ClipboardEventNotifier()
+{
+}
+
+ClipboardEventNotifier ClipboardEventNotifier::Get()
+{
+  return Internal::Adaptor::ClipboardEventNotifier::Get();
+}
+
+ClipboardEventNotifier::~ClipboardEventNotifier()
+{
+}
+
+const std::string& ClipboardEventNotifier::GetContent() const
+{
+  return Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).GetContent();
+}
+
+void ClipboardEventNotifier::SetContent( const std::string& content )
+{
+  Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).SetContent(content);
+}
+
+void ClipboardEventNotifier::ClearContent()
+{
+  Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).ClearContent();
+}
+
+void ClipboardEventNotifier::EmitContentSelectedSignal()
 {
-  gToolkitClipboardEventNotifier = this;
+  Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).EmitContentSelectedSignal();
 }
 
-ToolkitClipboardEventNotifier::~ToolkitClipboardEventNotifier()
+ClipboardEventNotifier::ClipboardEventSignalV2& ClipboardEventNotifier::ContentSelectedSignal()
 {
-  gToolkitClipboardEventNotifier = NULL;
+  return Internal::Adaptor::ClipboardEventNotifier::GetImplementation(*this).ContentSelectedSignal();
 }
 
-ClipboardEventNotifier ToolkitClipboardEventNotifier::GetClipboardEventNotifier()
+ClipboardEventNotifier::ClipboardEventNotifier( Internal::Adaptor::ClipboardEventNotifier* notifier )
+: BaseHandle( notifier )
 {
-  return mClipboardEventNotifier;
 }
 
 } // namespace Dali
index c7dcc08..adc4abc 100644 (file)
 #include <string>
 
 // PUBLIC INCLUDES
-#include <dali/public-api/adaptor-framework/clipboard-event-notifier.h>
+#define __DALI_CLIPBOARD_EVENT_NOTIFIER_H__
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal-v2.h>
+
 
 namespace Dali
 {
@@ -35,33 +38,24 @@ class ClipboardEventNotifier;
 }
 }
 
-/**
- * This creates a stubbed ClipboardEventNotifier so that internal Toolkit Adaptor calls work.
- */
-class ToolkitClipboardEventNotifier
+class ClipboardEventNotifier : public BaseHandle
 {
-public: // Constants
-
-public: // Construction & Destruction
-
-  ToolkitClipboardEventNotifier();
-  ~ToolkitClipboardEventNotifier();
-
-public: // Getters
-
-  ClipboardEventNotifier GetClipboardEventNotifier();
-
-public: // Signal Emissions
+public:
+  typedef SignalV2< void ( ClipboardEventNotifier& ) > ClipboardEventSignalV2;
+  static const char* const SIGNAL_CONTENT_SELECTED; ///< name "content-selected"
 
-  ClipboardEventNotifier::ClipboardEventSignalV2& SignalContentSelected();
+  ClipboardEventNotifier();
+  static ClipboardEventNotifier Get();
+  ~ClipboardEventNotifier();
 
-public: // TEST FUNCTIONS
+  const std::string& GetContent() const;
+  void SetContent( const std::string& content );
+  void ClearContent();
 
-private:
+  void EmitContentSelectedSignal();
+  ClipboardEventSignalV2& ContentSelectedSignal();
 
-  Internal::Adaptor::ClipboardEventNotifier* mClipboardEventNotifierStub;
-  friend class Internal::Adaptor::ClipboardEventNotifier;
-  ClipboardEventNotifier mClipboardEventNotifier; // Hold a handle ourselves.
+  ClipboardEventNotifier( Internal::Adaptor::ClipboardEventNotifier* notifier );
 };
 
 } // namespace Dali
index 7a090f5..e8e4466 100644 (file)
@@ -21,7 +21,6 @@
 // INTERNAL INCLUDES
 #include <dali-test-suite-utils.h>
 
-#include "toolkit-adaptor.h"
 #include "toolkit-orientation.h"
 
 namespace Dali
@@ -50,18 +49,12 @@ public:
     mCore = NULL;
   }
 
-  inline ToolkitAdaptor& GetAdaptor()
-  {
-    return mAdaptor;
-  }
-
   //ToolkitOrientation& GetOrientation()
   //{
   //return mOrientation;
   //}
 
 private:
-  ToolkitAdaptor mAdaptor;
   //ToolkitOrientation mOrientation;
 };
 
index 5d0e4ab..869f9a6 100644 (file)
@@ -21,6 +21,7 @@
 // Need to override adaptor classes for toolkit test harness, so include
 // test harness headers before dali headers.
 #include <dali-toolkit-test-suite-utils.h>
+#include "toolkit-style-monitor.h"
 
 #include <dali.h>
 #include <dali-toolkit/dali-toolkit.h>
@@ -656,7 +657,7 @@ int UtcDaliControlImplStyleChange(void)
   DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, false, TEST_LOCATION );
   StyleChange styleChange;
   styleChange.defaultFontChange = true;
-  Dali::StyleMonitor styleMonitor = application.GetAdaptor().GetToolkitStyleMonitor();
+  Dali::StyleMonitor styleMonitor = StyleMonitor::Get();
   styleMonitor.EmitStyleChangeSignal(styleChange);
 
   DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, true, TEST_LOCATION );
index ee8f8fc..3f134b6 100644 (file)
@@ -87,6 +87,7 @@ std::string ToString(const Rect<int>& value)
   return ss.str();
 }
 
+#if defined(DEBUG_ENABLED)
 
 std::string PropertyValueToString( const Property::Value& value )
 {
@@ -178,6 +179,7 @@ std::string PropertyValueToString( const Property::Value& value )
 
   return ret;
 }
+#endif // DEBUG_ENABLED
 
 /*
  * Recursively collects all stylesin a node (An array of style names).
index a4f1f90..90a741a 100644 (file)
@@ -234,13 +234,10 @@ void Button::OnTap(Actor actor, TapGesture tap)
   // Do nothing.
 }
 
-void Button::OnStageDisconnection()
+void Button::OnControlStageDisconnection()
 {
-  if( ButtonUp != mState )
-  {
-    OnTouchPointLeave(); // Notification for derived classes.
-    mState = ButtonUp;
-  }
+  OnButtonStageDisconnection(); // Notification for derived classes.
+  mState = ButtonUp;
 }
 
 void Button::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
index bb8b326..2c45d7f 100644 (file)
@@ -130,6 +130,12 @@ private:
    */
   virtual float OnAnimationTimeRequested() const;
 
+  /**
+   * This method is called when the button is removed from the stage.
+   * Could be reimplemented in subclasses to provide specific behaviour.
+   */
+  virtual void OnButtonStageDisconnection() { }
+
 public:
 
   /**
@@ -190,6 +196,12 @@ private: // From Control
    */
   virtual void OnControlSizeSet( const Vector3& targetSize );
 
+  /**
+   * Callback received when the button is disconnected from the stage.
+   * It resets the button status.
+   */
+  void OnControlStageDisconnection();
+
 private:
 
   /**
@@ -204,14 +216,6 @@ private:
 
 private:
 
-  /**
-   * Callback received when the button is disconected from the stage.
-   * It resets the button status.
-   */
-  void OnStageDisconnection();
-
-private:
-
   // Undefined
   Button( const Button& );
 
index 153c396..34245c2 100644 (file)
@@ -638,6 +638,25 @@ float PushButton::OnAnimationTimeRequested() const
   return GetPushButtonPainter( mPainter )->GetAnimationTime();
 }
 
+void PushButton::OnButtonStageDisconnection()
+{
+  if( ButtonDown == mState )
+  {
+    if( !mToggleButton )
+    {
+      Toolkit::PushButton handle( GetOwner() );
+
+      // Notifies the painter the button has been released.
+      GetPushButtonPainter( mPainter )->Released( handle );
+
+      if( mAutoRepeating )
+      {
+        mAutoRepeatingTimer.Reset();
+      }
+    }
+  }
+}
+
 PushButton::PushButton()
 : Button(),
   mAutoRepeating( false ),
index a3264ad..a021683 100644 (file)
@@ -316,6 +316,11 @@ protected: // From Button
    */
   virtual float OnAnimationTimeRequested() const;
 
+  /**
+   * This method is called when the button is removed from the stage.
+   */
+  virtual void OnButtonStageDisconnection();
+
 protected: // From Control
 
   /**
index 21d9840..9b17229 100644 (file)
@@ -86,36 +86,6 @@ enum SelectionState
   SelectionFinished                         ///< Finished selected section
 };
 
-/**
- * Whether the given style is the default style or not.
- * @param[in] style The given style.
- * @return \e true if the given style is the default. Otherwise it returns \e false.
- */
-bool IsDefaultStyle( const TextStyle& style )
-{
-  return DEFAULT_TEXT_STYLE == style;
-}
-
-/**
- * Whether the given styled text is using the default style or not.
- * @param[in] textArray The given text.
- * @return \e true if the given styled text is using the default style. Otherwise it returns \e false.
- */
-bool IsTextDefaultStyle( const Toolkit::MarkupProcessor::StyledTextArray& textArray )
-{
-  for( Toolkit::MarkupProcessor::StyledTextArray::const_iterator it = textArray.begin(), endIt = textArray.end(); it != endIt; ++it )
-  {
-    const TextStyle& style( (*it).mStyle );
-
-    if( !IsDefaultStyle( style ) )
-    {
-      return false;
-    }
-  }
-
-  return true;
-}
-
 std::size_t FindVisibleCharacterLeft( std::size_t cursorPosition, const Toolkit::TextView::CharacterLayoutInfoContainer& characterLayoutInfoTable )
 {
   for( Toolkit::TextView::CharacterLayoutInfoContainer::const_reverse_iterator it = characterLayoutInfoTable.rbegin() + characterLayoutInfoTable.size() - cursorPosition, endIt = characterLayoutInfoTable.rend();
@@ -130,7 +100,7 @@ std::size_t FindVisibleCharacterLeft( std::size_t cursorPosition, const Toolkit:
     --cursorPosition;
   }
 
-  return 0;
+  return 0u;
 }
 
 std::size_t FindVisibleCharacterRight( std::size_t cursorPosition, const Toolkit::TextView::CharacterLayoutInfoContainer& characterLayoutInfoTable  )
@@ -1072,13 +1042,10 @@ void TextInput::OnKeyInputFocusGained()
   mClipboard = Clipboard::Get(); // Store handle to clipboard
 
   // Now in edit mode we can accept string to paste from clipboard
-  if( Adaptor::IsAvailable() )
+  ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+  if ( notifier )
   {
-    ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
-    if ( notifier )
-    {
-      notifier.ContentSelectedSignal().Connect( this, &TextInput::OnClipboardTextSelected );
-    }
+    notifier.ContentSelectedSignal().Connect( this, &TextInput::OnClipboardTextSelected );
   }
 }
 
@@ -1122,19 +1089,16 @@ void TextInput::OnKeyInputFocusLost()
 
   mClipboard.Reset();
   // No longer in edit mode so do not want to receive string from clipboard
-  if( Adaptor::IsAvailable() )
+  ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+  if ( notifier )
   {
-    ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
-    if ( notifier )
-    {
-      notifier.ContentSelectedSignal().Disconnect( this, &TextInput::OnClipboardTextSelected );
-    }
-    Clipboard clipboard = Clipboard::Get();
+    notifier.ContentSelectedSignal().Disconnect( this, &TextInput::OnClipboardTextSelected );
+  }
 
-    if ( clipboard )
-    {
-      clipboard.HideClipboard();
-    }
+  Clipboard clipboard = Clipboard::Get();
+  if ( clipboard )
+  {
+    clipboard.HideClipboard();
   }
 }
 
@@ -1887,7 +1851,7 @@ void TextInput::OnTextViewScrolled( Toolkit::TextView textView, Vector2 scrollPo
   // Updates the cursor and grab handle position and visibility.
   if( mGrabHandle || mCursor )
   {
-    cursorSize.height = GetRowRectFromCharacterPosition( GetVisualPosition( mCursorPosition ) ).height;
+    cursorSize.height = GetRowRectFromCharacterPosition( mCursorPosition ).height;
     const Vector3 cursorPosition = GetActualPositionFromCharacterPosition(mCursorPosition);
 
     mIsCursorInScrollArea = mIsGrabHandleInScrollArea = IsPositionInsideBoundaries( cursorPosition, cursorSize, controlSize );
@@ -1937,7 +1901,7 @@ void TextInput::ScrollTextViewToMakeCursorVisible( const Vector3& cursorPosition
 {
   // Scroll the text to make the cursor visible.
   const Size cursorSize( CURSOR_THICKNESS,
-                         GetRowRectFromCharacterPosition( GetVisualPosition( mCursorPosition ) ).height );
+                         GetRowRectFromCharacterPosition( mCursorPosition ).height );
 
   // Need to scroll the text to make the cursor visible and to cover the whole text-input area.
 
@@ -2884,13 +2848,15 @@ void TextInput::AdvanceCursor(bool reverse, std::size_t places)
   }
 }
 
-void TextInput::DrawCursor(const std::size_t nthChar)
+void TextInput::DrawCursor()
 {
+  const Size rowRect = GetRowRectFromCharacterPosition( mCursorPosition );
+
   // Get height of cursor and set its size
   Size size( CURSOR_THICKNESS, 0.0f );
   if( !mTextLayoutInfo.mCharacterLayoutInfoTable.empty() )
   {
-    size.height = GetRowRectFromCharacterPosition( GetVisualPosition( mCursorPosition ) ).height;
+    size.height = rowRect.height;
   }
   else
   {
@@ -2905,7 +2871,7 @@ void TextInput::DrawCursor(const std::size_t nthChar)
 
   DALI_ASSERT_DEBUG( mCursorPosition <= mTextLayoutInfo.mCharacterLayoutInfoTable.size() );
 
-  if ( ( mCursorPosition <= mTextLayoutInfo.mCharacterLayoutInfoTable.size() ) )
+  if( ( mCursorPosition <= mTextLayoutInfo.mCharacterLayoutInfoTable.size() ) )
   {
     Vector3 altPosition;    // Alternate (i.e. opposite direction) cursor position.
     bool altPositionValid;  // Alternate cursor validity flag.
@@ -2914,7 +2880,7 @@ void TextInput::DrawCursor(const std::size_t nthChar)
 
     SetAltCursorEnabled( altPositionValid );
 
-    if(!altPositionValid)
+    if( !altPositionValid )
     {
       mCursor.SetPosition( position + UI_OFFSET );
     }
@@ -2922,13 +2888,12 @@ void TextInput::DrawCursor(const std::size_t nthChar)
     {
       size.height *= 0.5f;
       mCursor.SetSize(size);
-      mCursor.SetPosition( position + UI_OFFSET - Vector3(0.0f, directionRTL ? 0.0f : size.height, 0.0f) );
+      mCursor.SetPosition( position + UI_OFFSET - Vector3( 0.0f, directionRTL ? 0.0f : size.height, 0.0f ) );
 
       // TODO: change this cursor pos, to be the one where the cursor is sourced from.
-      Size rowSize = GetRowRectFromCharacterPosition( GetVisualPosition( mCursorPosition ) );
-      size.height = rowSize.height * 0.5f;
+      size.height = rowRect.height * 0.5f;
       mCursorRTL.SetSize(size);
-      mCursorRTL.SetPosition( altPosition + UI_OFFSET - Vector3(0.0f, directionRTL ? size.height : 0.0f, 0.0f) );
+      mCursorRTL.SetPosition( altPosition + UI_OFFSET - Vector3( 0.0f, directionRTL ? size.height : 0.0f, 0.0f ) );
     }
 
     if( IsScrollEnabled() )
@@ -3006,14 +2971,26 @@ Vector3 TextInput::MoveGrabHandle( const Vector2& displacement )
     std::size_t newCursorPosition = 0;
     ReturnClosestIndex( mActualGrabHandlePosition.GetVectorXY(), newCursorPosition );
 
-    actualHandlePosition = GetActualPositionFromCharacterPosition( newCursorPosition );
+    Vector3 altPosition;    // Alternate (i.e. opposite direction) cursor position.
+    bool altPositionValid;  // Alternate cursor validity flag.
+    bool directionRTL;      // Need to know direction of primary cursor (in case we have 2 cursors and need to show them differently)
+    actualHandlePosition = GetActualPositionFromCharacterPosition( newCursorPosition, directionRTL, altPosition, altPositionValid );
+
+    if( altPositionValid )
+    {
+      // Check which of the positions is the closest.
+      if( fabsf( altPosition.x - mActualGrabHandlePosition.x ) < fabsf( actualHandlePosition.x - mActualGrabHandlePosition.x ) )
+      {
+        actualHandlePosition = altPosition;
+      }
+    }
 
     bool handleVisible = true;
 
     if( IsScrollEnabled() )
     {
       const Vector3 controlSize = GetControlSize();
-      const Size cursorSize = GetRowRectFromCharacterPosition( GetVisualPosition( newCursorPosition ) );
+      const Size cursorSize = GetRowRectFromCharacterPosition( newCursorPosition );
       // Scrolls the text if the handle is not in a visible position
       handleVisible = IsPositionInsideBoundaries( actualHandlePosition,
                                                   cursorSize,
@@ -3306,7 +3283,7 @@ Vector3 TextInput::MoveSelectionHandle( SelectionHandleId handleId, const Vector
     {
       mCurrentSelectionId = handleId;
 
-      cursorSize.height = GetRowRectFromCharacterPosition( GetVisualPosition( newHandlePosition ) ).height;
+      cursorSize.height = GetRowRectFromCharacterPosition( newHandlePosition ).height;
       // Restricts the movement of the grab handle inside the boundaries of the text-input.
       handleVisible = IsPositionInsideBoundaries( actualHandlePosition,
                                                   cursorSize,
@@ -3377,7 +3354,6 @@ Vector3 TextInput::MoveSelectionHandle( SelectionHandleId handleId, const Vector
 
 void TextInput::SetSelectionHandlePosition(SelectionHandleId handleId)
 {
-
   const std::size_t selectionHandlePosition = ( handleId == HandleOne ) ? mSelectionHandleOnePosition : mSelectionHandleTwoPosition;
   ImageActor selectionHandleActor = ( handleId == HandleOne ) ? mSelectionHandleOne : mSelectionHandleTwo;
 
@@ -3390,7 +3366,7 @@ void TextInput::SetSelectionHandlePosition(SelectionHandleId handleId)
     if( IsScrollEnabled() )
     {
       const Size cursorSize( CURSOR_THICKNESS,
-                             GetRowRectFromCharacterPosition( GetVisualPosition( selectionHandlePosition ) ).height );
+                             GetRowRectFromCharacterPosition( selectionHandlePosition ).height );
       selectionHandleActor.SetVisible( IsPositionInsideBoundaries( actualHandlePosition,
                                                                    cursorSize,
                                                                    GetControlSize() ) );
@@ -3398,15 +3374,6 @@ void TextInput::SetSelectionHandlePosition(SelectionHandleId handleId)
   }
 }
 
-std::size_t TextInput::GetVisualPosition(std::size_t logicalPosition) const
-{
-  // Note: we're allowing caller to request a logical position of size (i.e. end of string)
-  // For now the visual position of end of logical string will be end of visual string.
-  DALI_ASSERT_DEBUG( logicalPosition <= mTextLayoutInfo.mCharacterLogicalToVisualMap.size() );
-
-  return logicalPosition != mTextLayoutInfo.mCharacterLogicalToVisualMap.size() ? mTextLayoutInfo.mCharacterLogicalToVisualMap[logicalPosition] : mTextLayoutInfo.mCharacterLogicalToVisualMap.size();
-}
-
 void TextInput::GetVisualTextSelection(std::vector<bool>& selectedVisualText, std::size_t startSelection, std::size_t endSelection)
 {
   std::vector<int>::iterator it = mTextLayoutInfo.mCharacterLogicalToVisualMap.begin();
@@ -3931,15 +3898,16 @@ bool TextInput::ReturnClosestIndex(const Vector2& source, std::size_t& closestIn
     }
     else
     {
-      std::vector<Toolkit::TextView::CharacterLayoutInfo>::const_iterator it = matchedCharacters.begin();
-      std::vector<Toolkit::TextView::CharacterLayoutInfo>::const_iterator endIt = matchedCharacters.end();
+      // 2 Iterate through matching list of y positions and find closest matching X position.
 
       bool matched( false );
 
-      // 2 Iterate through matching list of y positions and find closest matching X position.
-      for( ; it != endIt; ++it )
+      // Traverse the characters in the visual order. VCC TODO: check for more than one line.
+      std::size_t visualIndex = 0u;
+      const std::size_t matchedCharactersSize = matchedCharacters.size();
+      for( ; visualIndex < matchedCharactersSize; ++visualIndex )
       {
-        const Toolkit::TextView::CharacterLayoutInfo& info( *it );
+        const Toolkit::TextView::CharacterLayoutInfo& info( *( matchedCharacters.begin() + mTextLayoutInfo.mCharacterVisualToLogicalMap[visualIndex] ) );
 
         if( info.mIsVisible )
         {
@@ -3960,16 +3928,15 @@ bool TextInput::ReturnClosestIndex(const Vector2& source, std::size_t& closestIn
         }
       }
 
-      if( it == endIt )
+      if( visualIndex == matchedCharactersSize )
       {
         rightToLeftChar = lastRightToLeftChar;
       }
 
-      std::size_t matchCharacterIndex = it - matchedCharacters.begin();
-      closestIndex = lineOffset + matchCharacterIndex;
+      closestIndex = lineOffset + visualIndex;
 
       mClosestCursorPositionEOL = false; // reset
-      if ( it == endIt && !matched )
+      if( ( visualIndex == matchedCharactersSize ) && !matched )
       {
         mClosestCursorPositionEOL = true; // Reached end of matched characters in closest line but no match so cursor should be after last character.
       }
@@ -4108,104 +4075,132 @@ Vector3 TextInput::PositionCursorAfterWordWrap( std::size_t characterPosition )
   /* Word wrap occurs automatically in TextView when the exceed policy moves a word to the next line when not enough space on current.
      A newline character is not inserted in this case */
 
-  DALI_ASSERT_DEBUG( !(characterPosition <= 0 ));
-
   Vector3 cursorPosition;
 
-  Toolkit::TextView::CharacterLayoutInfo currentCharInfo;
+  Toolkit::TextView::CharacterLayoutInfo currentCharInfo = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition ];
 
-  if ( characterPosition == mTextLayoutInfo.mCharacterLayoutInfoTable.size() )
-  {
-    // end character so use
-    currentCharInfo = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition - 1 ];
-    cursorPosition = Vector3(currentCharInfo.mPosition.x + currentCharInfo.mSize.width, currentCharInfo.mPosition.y, currentCharInfo.mPosition.z) ;
-  }
-  else
-  {
-    currentCharInfo = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition ];
-  }
+  bool noWrap = true;
 
-  Toolkit::TextView::CharacterLayoutInfo previousCharInfo = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition - 1];
-
-  // If previous character on a different line then use current characters position
-  if ( fabsf( (currentCharInfo.mPosition.y - currentCharInfo.mDescender )  - ( previousCharInfo.mPosition.y - previousCharInfo.mDescender) ) > Math::MACHINE_EPSILON_1000 )
+  if( characterPosition > 0u )
   {
-    if ( mClosestCursorPositionEOL )
-    {
-      cursorPosition = Vector3(previousCharInfo.mPosition.x + previousCharInfo.mSize.width, previousCharInfo.mPosition.y, previousCharInfo.mPosition.z) ;
-    }
-    else
+    Toolkit::TextView::CharacterLayoutInfo previousCharInfo = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition - 1u ];
+
+    // If previous character on a different line then use current characters position
+    if( fabsf( (currentCharInfo.mPosition.y - currentCharInfo.mDescender )  - ( previousCharInfo.mPosition.y - previousCharInfo.mDescender) ) > Math::MACHINE_EPSILON_1000 )
     {
-      cursorPosition = Vector3(currentCharInfo.mPosition);
+      // VCC TODO: PositionCursorAfterWordWrap currently doesn't work for multiline. Need to check this branch.
+      if ( mClosestCursorPositionEOL )
+      {
+        cursorPosition = Vector3( previousCharInfo.mPosition.x + previousCharInfo.mSize.width, previousCharInfo.mPosition.y, previousCharInfo.mPosition.z ) ;
+      }
+      else
+      {
+        cursorPosition = Vector3( currentCharInfo.mPosition );
+      }
+
+      noWrap = false;
     }
   }
-  else
+
+  if( noWrap )
   {
-    // Previous character is on same line so use position of previous character plus it's width.
-    cursorPosition = Vector3(previousCharInfo.mPosition.x + previousCharInfo.mSize.width, previousCharInfo.mPosition.y, previousCharInfo.mPosition.z) ;
+    // If the character is left to right, the position is the character's position plus its width.
+    const float ltrOffset = !currentCharInfo.mIsRightToLeftCharacter ? currentCharInfo.mSize.width : 0.f;
+
+    cursorPosition.x = currentCharInfo.mPosition.x  + ltrOffset;
+    cursorPosition.y = currentCharInfo.mPosition.y;
   }
 
   return cursorPosition;
 }
 
-Vector3 TextInput::GetActualPositionFromCharacterPosition(std::size_t characterPosition) const
+Vector3 TextInput::GetActualPositionFromCharacterPosition( std::size_t characterPosition ) const
 {
-  bool direction(false);
+  bool direction = false;
   Vector3 alternatePosition;
-  bool alternatePositionValid(false);
+  bool alternatePositionValid = false;
 
   return GetActualPositionFromCharacterPosition( characterPosition, direction, alternatePosition, alternatePositionValid );
 }
 
-Vector3 TextInput::GetActualPositionFromCharacterPosition(std::size_t characterPosition, bool& directionRTL, Vector3& alternatePosition, bool& alternatePositionValid ) const
+Vector3 TextInput::GetActualPositionFromCharacterPosition( std::size_t characterPosition, bool& directionRTL, Vector3& alternatePosition, bool& alternatePositionValid ) const
 {
+  DALI_ASSERT_DEBUG( ( mTextLayoutInfo.mCharacterLayoutInfoTable.size() == mTextLayoutInfo.mCharacterLogicalToVisualMap.size() ) &&
+                     ( mTextLayoutInfo.mCharacterLayoutInfoTable.size() == mTextLayoutInfo.mCharacterVisualToLogicalMap.size() ) &&
+                     "TextInput::GetActualPositionFromCharacterPosition. All layout tables must have the same size." );
+
   Vector3 cursorPosition( 0.f, 0.f, 0.f );
 
   alternatePositionValid = false;
   directionRTL = false;
 
-  if( !mTextLayoutInfo.mCharacterLayoutInfoTable.empty() && !mTextLayoutInfo.mCharacterLogicalToVisualMap.empty() )
+  if( !mTextLayoutInfo.mCharacterLayoutInfoTable.empty() )
   {
-    std::size_t visualCharacterPosition;
+    if( characterPosition == 0u )
+    {
+      // When the cursor position is at the beginning, it should be at the start of the current character.
+      // If the current character is LTR, then the start is on the right side of the glyph.
+      // If the current character is RTL, then the start is on the left side of the glyph.
+
+      if( !( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() ) ).mIsVisible )
+      {
+         characterPosition = FindVisibleCharacter( Right, 0u );
+      }
 
-    // When cursor is not at beginning, consider possibility of
-    // showing 2 cursors. (whereas at beginning we only ever show one cursor)
-    if(characterPosition > 0)
+      const Toolkit::TextView::CharacterLayoutInfo& info = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition ];
+      const float rtlOffset = info.mIsRightToLeftCharacter ? info.mSize.width : 0.0f;
+
+      cursorPosition.x = info.mPosition.x + rtlOffset;
+      cursorPosition.y = info.mPosition.y;
+      directionRTL = info.mIsRightToLeftCharacter;
+    }
+    else if( characterPosition > 0u )
     {
+      // Get the direction of the paragraph.
+      const std::size_t startCharacterPosition = GetRowStartFromCharacterPosition( characterPosition );
+      const bool isParagraphRightToLeft = ( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + startCharacterPosition ) ).mIsRightToLeftCharacter;
+
+      // When cursor is not at beginning, consider possibility of
+      // showing 2 cursors. (whereas at beginning we only ever show one cursor)
+
       // Cursor position should be the end of the last character.
       // If the last character is LTR, then the end is on the right side of the glyph.
       // If the last character is RTL, then the end is on the left side of the glyph.
-      visualCharacterPosition = mTextLayoutInfo.mCharacterLogicalToVisualMap[ characterPosition - 1 ];
 
-      if( !( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + visualCharacterPosition ) ).mIsVisible )
+      --characterPosition;
+
+      if( !( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + characterPosition ) ).mIsVisible )
       {
-        visualCharacterPosition = FindVisibleCharacter( Left, visualCharacterPosition );
+        characterPosition = FindVisibleCharacter( Left, characterPosition );
       }
 
-      Toolkit::TextView::CharacterLayoutInfo info = mTextLayoutInfo.mCharacterLayoutInfoTable[ visualCharacterPosition ];
-      if( ( visualCharacterPosition > 0 ) && info.mIsNewParagraphChar && !IsScrollEnabled() )
+      Toolkit::TextView::CharacterLayoutInfo info = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition ];
+      if( ( characterPosition > 0u ) && info.mIsNewParagraphChar && !IsScrollEnabled() )
       {
+        // VCC TODO : check for a new paragraph character.
+
         // Prevents the cursor to exceed the boundary if the last visible character is a 'new line character' and the scroll is not enabled.
         const Vector3& size = GetControlSize();
 
         if( info.mPosition.y + info.mSize.height - mDisplayedTextView.GetLineHeightOffset() > size.height )
         {
-          --visualCharacterPosition;
+          --characterPosition;
         }
-        info = mTextLayoutInfo.mCharacterLayoutInfoTable[ visualCharacterPosition ];
+        info = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition ];
       }
 
-      if(!info.mIsNewParagraphChar)
+      if( !info.mIsNewParagraphChar )
       {
         cursorPosition = PositionCursorAfterWordWrap( characterPosition ); // Get position of cursor/handles taking in account auto word wrap.
       }
       else
       {
+        // VCC TODO : check for a new paragraph character.
+
         // When cursor points to first character on new line, position cursor at the start of this glyph.
-        if(characterPosition < mTextLayoutInfo.mCharacterLogicalToVisualMap.size())
+        if( characterPosition < mTextLayoutInfo.mCharacterLayoutInfoTable.size() )
         {
-          std::size_t visualCharacterNextPosition = mTextLayoutInfo.mCharacterLogicalToVisualMap[ characterPosition ];
-          const Toolkit::TextView::CharacterLayoutInfo& infoNext = mTextLayoutInfo.mCharacterLayoutInfoTable[ visualCharacterNextPosition ];
+          const Toolkit::TextView::CharacterLayoutInfo& infoNext = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterPosition ];
           const float start( infoNext.mIsRightToLeftCharacter ? infoNext.mSize.width : 0.0f );
 
           cursorPosition.x = infoNext.mPosition.x + start;
@@ -4217,12 +4212,12 @@ Vector3 TextInput::GetActualPositionFromCharacterPosition(std::size_t characterP
           // cursor where the new line starts based on the line-justification position.
           cursorPosition.x = GetLineJustificationPosition();
 
-          if(characterPosition == mTextLayoutInfo.mCharacterLogicalToVisualMap.size())
+          if( characterPosition == mTextLayoutInfo.mCharacterLogicalToVisualMap.size() )
           {
             // If this is after the last character, then we can assume that the new cursor
             // should be exactly one row below the current row.
 
-            const Size rowRect(GetRowRectFromCharacterPosition(characterPosition - 1));
+            const Size rowRect = GetRowRectFromCharacterPosition( characterPosition - 1u );
             cursorPosition.y = info.mPosition.y + rowRect.height;
           }
           else
@@ -4230,7 +4225,7 @@ Vector3 TextInput::GetActualPositionFromCharacterPosition(std::size_t characterP
             // If this is not after last character, then we can use this row's height.
             // should be exactly one row below the current row.
 
-            const Size rowRect(GetRowRectFromCharacterPosition(characterPosition));
+            const Size rowRect = GetRowRectFromCharacterPosition( characterPosition );
             cursorPosition.y = info.mPosition.y + rowRect.height;
           }
         }
@@ -4238,104 +4233,87 @@ Vector3 TextInput::GetActualPositionFromCharacterPosition(std::size_t characterP
 
       directionRTL = info.mIsRightToLeftCharacter;
 
-      // 1. When the cursor is neither at the beginning or the end,
-      // we can show multiple cursors under situations when the cursor is
-      // between RTL and LTR text...
-      if(characterPosition != mTextLayoutInfo.mCharacterLogicalToVisualMap.size())
+      if( 1u < mTextLayoutInfo.mCharacterLayoutInfoTable.size() )
       {
-        std::size_t visualCharacterAltPosition = mTextLayoutInfo.mCharacterLogicalToVisualMap[characterPosition]; // VCC TODO: find why in the previous patch it was a -1 here.
+        // 1. When the cursor is neither at the beginning or the end,
+        // we can show multiple cursors under situations when the cursor is
+        // between RTL and LTR text...
+        if( characterPosition + 1u < mTextLayoutInfo.mCharacterLayoutInfoTable.size() )
+        {
+          std::size_t characterAltPosition = characterPosition + 1u;
 
-        DALI_ASSERT_ALWAYS(visualCharacterAltPosition < mTextLayoutInfo.mCharacterLayoutInfoTable.size());
-        const Toolkit::TextView::CharacterLayoutInfo& infoAlt = mTextLayoutInfo.mCharacterLayoutInfoTable[ visualCharacterAltPosition ];
+          const Toolkit::TextView::CharacterLayoutInfo& infoAlt = mTextLayoutInfo.mCharacterLayoutInfoTable[ characterAltPosition ];
 
-        if(!info.mIsRightToLeftCharacter && infoAlt.mIsRightToLeftCharacter)
-        {
-          // Stuation occurs when cursor is at the end of English text (LTR) and beginning of Arabic (RTL)
-          // Text:     [...LTR...]|[...RTL...]
-          // Cursor pos:          ^
-          // Alternate cursor pos:            ^
-          // In which case we need to display an alternate cursor for the RTL text.
-
-          alternatePosition.x = infoAlt.mPosition.x + infoAlt.mSize.width;
-          alternatePosition.y = infoAlt.mPosition.y;
-          alternatePositionValid = true;
+          if(!info.mIsRightToLeftCharacter && infoAlt.mIsRightToLeftCharacter)
+          {
+            // Stuation occurs when cursor is at the end of English text (LTR) and beginning of Arabic (RTL)
+            // Text:     [...LTR...]|[...RTL...]
+            // Cursor pos:          ^
+            // Alternate cursor pos:            ^
+            // In which case we need to display an alternate cursor for the RTL text.
+
+            alternatePosition.x = infoAlt.mPosition.x + infoAlt.mSize.width;
+            alternatePosition.y = infoAlt.mPosition.y;
+            alternatePositionValid = true;
+          }
+          else if(info.mIsRightToLeftCharacter && !infoAlt.mIsRightToLeftCharacter)
+          {
+            // Situation occurs when cursor is at end of the Arabic text (LTR) and beginning of English (RTL)
+            // Text:           |[...RTL...] [...LTR....]
+            // Cursor pos:     ^
+            // Alternate cursor pos:       ^
+            // In which case we need to display an alternate cursor for the RTL text.
+
+            alternatePosition.x = infoAlt.mPosition.x;
+            alternatePosition.y = infoAlt.mPosition.y;
+            alternatePositionValid = true;
+          }
         }
-        else if(info.mIsRightToLeftCharacter && !infoAlt.mIsRightToLeftCharacter)
+        else
         {
-          // Situation occurs when cursor is at end of the Arabic text (LTR) and beginning of English (RTL)
-          // Text:           |[...RTL...] [...LTR....]
-          // Cursor pos:     ^
-          // Alternate cursor pos:       ^
-          // In which case we need to display an alternate cursor for the RTL text.
-
-          alternatePosition.x = infoAlt.mPosition.x;
-          alternatePosition.y = infoAlt.mPosition.y;
-          alternatePositionValid = true;
-        }
-      }
-      else
-      {
-        // 2. When the cursor is at the end of the text,
-        // and we have multi-directional text,
-        // we can also consider showing mulitple cursors.
-        // The rule here is:
-        // If first and last characters on row are different
-        // Directions, then two cursors need to be displayed.
-
-        // Get first logical glyph on row
-        std::size_t startCharacterPosition = GetRowStartFromCharacterPosition( characterPosition - 1 );
+          // 2. When the cursor is at the end of the text,
+          // and we have multi-directional text,
+          // we can also consider showing mulitple cursors.
+          // The rule here is:
+          // If first and last characters on row are different
+          // Directions, then two cursors need to be displayed.
+
+          if( info.mIsRightToLeftCharacter != isParagraphRightToLeft )
+          {
+            // The last character's direction is differernt than the first one of current paragraph.
 
-        std::size_t visualCharacterStartPosition = mTextLayoutInfo.mCharacterLogicalToVisualMap[ startCharacterPosition ];
-        const Toolkit::TextView::CharacterLayoutInfo& infoStart= mTextLayoutInfo.mCharacterLayoutInfoTable[ visualCharacterStartPosition ];
+            // Get first
+            const Toolkit::TextView::CharacterLayoutInfo& infoStart= mTextLayoutInfo.mCharacterLayoutInfoTable[ GetFirstCharacterWithSameDirection( characterPosition ) ];
 
-        if(info.mIsRightToLeftCharacter && !infoStart.mIsRightToLeftCharacter)
-        {
-          // For text Starting as LTR and ending as RTL. End cursor position is as follows:
-          // Text:     [...LTR...]|[...RTL...]
-          // Cursor pos:          ^
-          // Alternate cursor pos:            ^
-          // In which case we need to display an alternate cursor for the RTL text, this cursor
-          // should be at the end of the given line.
-
-          const Toolkit::TextView::CharacterLayoutInfo& infoAlt = mTextLayoutInfo.mCharacterLayoutInfoTable[ mTextLayoutInfo.mCharacterLayoutInfoTable.size() - 1 ];
-          alternatePosition.x = infoAlt.mPosition.x + infoAlt.mSize.width;
-          alternatePosition.y = infoAlt.mPosition.y;
-          alternatePositionValid = true;
-        }
-        else if(!info.mIsRightToLeftCharacter && infoStart.mIsRightToLeftCharacter) // starting RTL
-        {
-          // For text Starting as RTL and ending as LTR. End cursor position is as follows:
-          // Text:           |[...RTL...] [...LTR....]
-          // Cursor pos:     ^
-          // Alternate cursor pos:       ^
-          // In which case we need to display an alternate cursor for the RTL text.
-
-          const Toolkit::TextView::CharacterLayoutInfo& infoAlt = mTextLayoutInfo.mCharacterLayoutInfoTable[ startCharacterPosition ];
-          alternatePosition.x = infoAlt.mPosition.x;
-          alternatePosition.y = infoAlt.mPosition.y;
-          alternatePositionValid = true;
+            if(info.mIsRightToLeftCharacter)
+            {
+              // For text Starting as LTR and ending as RTL. End cursor position is as follows:
+              // Text:     [...LTR...]|[...RTL...]
+              // Cursor pos:          ^
+              // Alternate cursor pos:            ^
+              // In which case we need to display an alternate cursor for the RTL text, this cursor
+              // should be at the end of the given line.
+
+              alternatePosition.x = infoStart.mPosition.x + infoStart.mSize.width;
+              alternatePosition.y = infoStart.mPosition.y;
+              alternatePositionValid = true;
+            }
+            else if(!info.mIsRightToLeftCharacter) // starting RTL
+            {
+              // For text Starting as RTL and ending as LTR. End cursor position is as follows:
+              // Text:           |[...RTL...] [...LTR....]
+              // Cursor pos:     ^
+              // Alternate cursor pos:       ^
+              // In which case we need to display an alternate cursor for the RTL text.
+
+              alternatePosition.x = infoStart.mPosition.x;
+              alternatePosition.y = infoStart.mPosition.y;
+              alternatePositionValid = true;
+            }
+          }
         }
       }
     } // characterPosition > 0
-    else if(characterPosition == 0)
-    {
-      // When the cursor position is at the beginning, it should be at the start of the current character.
-      // If the current character is LTR, then the start is on the right side of the glyph.
-      // If the current character is RTL, then the start is on the left side of the glyph.
-      visualCharacterPosition = mTextLayoutInfo.mCharacterLogicalToVisualMap[ characterPosition ];
-
-      if( !( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + visualCharacterPosition ) ).mIsVisible )
-      {
-         visualCharacterPosition = FindVisibleCharacter( Right, visualCharacterPosition );
-      }
-
-      const Toolkit::TextView::CharacterLayoutInfo& info = mTextLayoutInfo.mCharacterLayoutInfoTable[ visualCharacterPosition ];
-      const float start(info.mIsRightToLeftCharacter ? info.mSize.width : 0.0f);
-
-      cursorPosition.x = info.mPosition.x + start;
-      cursorPosition.y = info.mPosition.y;
-      directionRTL = info.mIsRightToLeftCharacter;
-    }
   }
   else
   {
@@ -4388,14 +4366,30 @@ Vector3 TextInput::GetActualPositionFromCharacterPosition(std::size_t characterP
   return cursorPosition;
 }
 
-std::size_t TextInput::GetRowStartFromCharacterPosition(std::size_t logicalPosition) const
+std::size_t TextInput::GetRowStartFromCharacterPosition( std::size_t logicalPosition ) const
 {
   // scan string from current position to beginning of current line to note direction of line
-  while(logicalPosition)
+  while( logicalPosition )
   {
     logicalPosition--;
-    std::size_t visualPosition = GetVisualPosition(logicalPosition);
-    if(mTextLayoutInfo.mCharacterLayoutInfoTable[visualPosition].mIsNewParagraphChar)
+    if( mTextLayoutInfo.mCharacterLayoutInfoTable[logicalPosition].mIsNewParagraphChar )
+    {
+      logicalPosition++;
+      break;
+    }
+  }
+
+  return logicalPosition;
+}
+
+std::size_t TextInput::GetFirstCharacterWithSameDirection( std::size_t logicalPosition ) const
+{
+  const bool isRightToLeft = mTextLayoutInfo.mCharacterLayoutInfoTable[logicalPosition].mIsRightToLeftCharacter;
+
+  while( logicalPosition )
+  {
+    logicalPosition--;
+    if( isRightToLeft != mTextLayoutInfo.mCharacterLayoutInfoTable[logicalPosition].mIsRightToLeftCharacter )
     {
       logicalPosition++;
       break;
@@ -4412,7 +4406,7 @@ Size TextInput::GetRowRectFromCharacterPosition(std::size_t characterPosition) c
   return GetRowRectFromCharacterPosition( characterPosition, min, max );
 }
 
-Size TextInput::GetRowRectFromCharacterPosition(std::size_t characterPosition, Vector2& min, Vector2& max) const
+Size TextInput::GetRowRectFromCharacterPosition( std::size_t characterPosition, Vector2& min, Vector2& max ) const
 {
   // if we have no text content, then return position 0,0 with width 0, and height the same as cursor height.
   if( mTextLayoutInfo.mCharacterLayoutInfoTable.empty() )
@@ -4422,85 +4416,55 @@ Size TextInput::GetRowRectFromCharacterPosition(std::size_t characterPosition, V
     return max;
   }
 
-  // TODO: This info should be readily available from text-view, we should not have to search hard for it.
-  Toolkit::TextView::CharacterLayoutInfoContainer::const_iterator begin = mTextLayoutInfo.mCharacterLayoutInfoTable.begin();
-  Toolkit::TextView::CharacterLayoutInfoContainer::const_iterator end = mTextLayoutInfo.mCharacterLayoutInfoTable.end();
-
-  // If cursor is pointing to end of line, then start from last character.
-  characterPosition = std::min( characterPosition, static_cast<std::size_t>(mTextLayoutInfo.mCharacterLayoutInfoTable.size() - 1) );
+  DALI_ASSERT_DEBUG( characterPosition <= mTextLayoutInfo.mCharacterLayoutInfoTable.size() );
 
-  Toolkit::TextView::CharacterLayoutInfoContainer::const_iterator it = mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + characterPosition;
+  // Initializes the min and max position.
+  const std::size_t initialPosition = ( characterPosition == mTextLayoutInfo.mCharacterLayoutInfoTable.size() ) ? characterPosition - 1u : characterPosition;
+  min = ( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + initialPosition ) ).mPosition.GetVectorXY();
+  max = min;
 
-  // 0. Find first a visible character. Draw a cursor beyound text-input bounds is not wanted.
-  if( !it->mIsVisible )
+  bool found = false;
+  // 1) Find the line where the character is laid-out.
+  for( Toolkit::TextView::LineLayoutInfoContainer::const_iterator lineIt = mTextLayoutInfo.mLines.begin(), lineEndIt = mTextLayoutInfo.mLines.end();
+         !found && ( lineIt != mTextLayoutInfo.mLines.end() );
+       ++lineIt )
   {
-    characterPosition = FindVisibleCharacter( Left, characterPosition );
-    it = mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + characterPosition;
-  }
+    const Toolkit::TextView::LineLayoutInfo& lineInfo( *lineIt );
 
-  // Scan characters left and right of cursor, stopping when end of line/string reached or
-  // y position greater than threshold of reference line.
+    // Index within the whole text to the last character of the current line.
+    std::size_t lastCharacterOfLine = 0u;
 
-  // 1. scan left until we reach the beginning or a different line.
-  Toolkit::TextView::CharacterLayoutInfoContainer::const_iterator validCharIt = it;
-  float referenceLine = it->mPosition.y - CHARACTER_THRESHOLD;
-  // min-x position is the left-most char's left (x)
-  // max-x position is the right-most char's right (x)
-  // min-y position is the minimum of all character's top (y)
-  // max-y position is the maximum of all character's bottom (y+height)
-  min.y = validCharIt->mPosition.y;
-  max.y = validCharIt->mPosition.y + validCharIt->mSize.y;
-
-  while(true)
-  {
-    validCharIt = it;
-    min.y = std::min(min.y, validCharIt->mPosition.y);
-    max.y = std::max(max.y, validCharIt->mPosition.y + validCharIt->mSize.y);
-
-    if(it == begin)
+    Toolkit::TextView::LineLayoutInfoContainer::const_iterator lineNextIt = lineIt + 1u;
+    if( lineNextIt != lineEndIt )
     {
-      break;
+      lastCharacterOfLine = (*lineNextIt).mCharacterGlobalIndex - 1u;
     }
-
-    --it;
-
-    if( (it->mPosition.y < referenceLine) ||
-        (it->mIsNewParagraphChar) ||
-        (!it->mIsVisible) )
+    else
     {
-      break;
+      lastCharacterOfLine = mTextLayoutInfo.mCharacterLayoutInfoTable.size() - 1u;
     }
-  }
-
-  // info refers to the first character on this line.
-  min.x = validCharIt->mPosition.x;
-
-  // 2. scan right until we reach end or a different line
-  it = mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + characterPosition;
-  referenceLine = it->mPosition.y + CHARACTER_THRESHOLD;
 
-  while(it != end)
-  {
-    if( (it->mPosition.y > referenceLine) ||
-        (it->mIsNewParagraphChar) ||
-        (!it->mIsVisible) )
+    // Check if the given chracter position is within the line.
+    if( ( lineInfo.mCharacterGlobalIndex <= initialPosition ) && ( initialPosition <= lastCharacterOfLine ) )
     {
-      break;
-    }
+      // 2) Get the row rect of all laid-out characters on the line.
 
-    validCharIt = it;
-    min.y = std::min(min.y, validCharIt->mPosition.y);
-    max.y = std::max(max.y, validCharIt->mPosition.y + validCharIt->mSize.y);
-
-    ++it;
-  }
+      // Need to scan all characters of the line because they are in the logical position.
+      for( Toolkit::TextView::CharacterLayoutInfoContainer::const_iterator it = mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + lineInfo.mCharacterGlobalIndex,
+             endIt = mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + lastCharacterOfLine + 1u;
+           it != endIt;
+           ++it )
+      {
+        const Toolkit::TextView::CharacterLayoutInfo& characterInfo( *it );
 
-  DALI_ASSERT_DEBUG ( validCharIt != end  && "validCharIt invalid")
+        min.x = std::min( min.x, characterInfo.mPosition.x );
+        min.y = std::min( min.y, characterInfo.mPosition.y );
+        max.x = std::max( max.x, characterInfo.mPosition.x + characterInfo.mSize.width );
+        max.y = std::max( max.y, characterInfo.mPosition.y + characterInfo.mSize.height );
+      }
 
-  if ( validCharIt != end )
-  {
-    // info refers to the last character on this line.
-    max.x = validCharIt->mPosition.x + validCharIt->mSize.x;
+      found = true;
+    }
   }
 
   return Size( max.x - min.x, max.y - min.y );
@@ -4867,9 +4831,10 @@ void TextInput::UpdateLineHeight()
   }
 }
 
-std::size_t TextInput::FindVisibleCharacter( const FindVisibleCharacterDirection direction , const std::size_t cursorPosition ) const
+std::size_t TextInput::FindVisibleCharacter( FindVisibleCharacterDirection direction , std::size_t cursorPosition ) const
 {
-  std::size_t position = 0;
+  // VCC check if we need do this in the visual order ...
+  std::size_t position = 0u;
 
   const std::size_t tableSize = mTextLayoutInfo.mCharacterLayoutInfoTable.size();
 
@@ -4879,7 +4844,7 @@ std::size_t TextInput::FindVisibleCharacter( const FindVisibleCharacterDirection
     {
       position = FindVisibleCharacterLeft( cursorPosition, mTextLayoutInfo.mCharacterLayoutInfoTable );
 
-      if( !( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + ( tableSize == position ? position - 1 : position ) ) ).mIsVisible )
+      if( !( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + ( tableSize == position ? position - 1u : position ) ) ).mIsVisible )
       {
         position = FindVisibleCharacterRight( cursorPosition, mTextLayoutInfo.mCharacterLayoutInfoTable );
       }
@@ -4888,7 +4853,7 @@ std::size_t TextInput::FindVisibleCharacter( const FindVisibleCharacterDirection
     case Right:
     {
       position = FindVisibleCharacterRight( cursorPosition, mTextLayoutInfo.mCharacterLayoutInfoTable );
-      if( !( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + ( tableSize == position ? position - 1 : position ) ) ).mIsVisible )
+      if( !( *( mTextLayoutInfo.mCharacterLayoutInfoTable.begin() + ( tableSize == position ? position - 1u : position ) ) ).mIsVisible )
       {
         position = FindVisibleCharacterLeft( cursorPosition, mTextLayoutInfo.mCharacterLayoutInfoTable );
       }
@@ -4896,7 +4861,7 @@ std::size_t TextInput::FindVisibleCharacter( const FindVisibleCharacterDirection
     }
     case ByEnd:
     {
-      position = FindVisibleCharacterLeft( 0, mTextLayoutInfo.mCharacterLayoutInfoTable );
+      position = FindVisibleCharacterLeft( 0u, mTextLayoutInfo.mCharacterLayoutInfoTable );
       break;
     }
     default:
index c9e3b18..a410205 100644 (file)
@@ -880,9 +880,8 @@ public:  // Public to allow internal testing.
 
   /**
    * Draw a cursor / caret at position where new text should appear
-   * @param[in] nthChar the position along the text string in which new text should appear.
    */
-  void DrawCursor(const std::size_t nthChar = 0);
+  void DrawCursor();
 
   /**
    * Sets cursor visibility
@@ -1017,15 +1016,6 @@ public:  // Public to allow internal testing.
   void SetSelectionHandlePosition(SelectionHandleId handleId);
 
   /**
-   * Gets the visual position of a logical position.
-   * @note This is preferred over directly accessing the Map, as it resolves visual
-   * positions outside of the character map range.
-   * @param[in] logicalPosition The logical position
-   * @return Visual position is returned.
-   */
-  std::size_t GetVisualPosition(std::size_t logicalPosition) const;
-
-  /**
    * Gets a table of the visual text positions which has a flag
    * for each Character. The flag is either true (character selected)
    * or false (character deselected)
@@ -1154,6 +1144,15 @@ public:  // Public to allow internal testing.
   std::size_t GetRowStartFromCharacterPosition(std::size_t logicalPosition) const;
 
   /**
+   * Retrieves the first character of a group of characters with the same direction.
+   *
+   * @param[in] logicalPosition Index to a character.
+   *
+   * @return Index to the character.
+   */
+  std::size_t GetFirstCharacterWithSameDirection( std::size_t logicalPosition ) const;
+
+  /**
    * Retrieve the dimensions of this row of text that the character resides on.
    * @param[in] characterPosition the position in the 'string' of characters.
    * @return The size of the rectangle representing this row
index 23c943c..b172976 100644 (file)
@@ -384,9 +384,13 @@ void SetCharacter( const TextViewProcessor::WordLayoutInfoContainer& wordsLayout
  *
  * Uses the visual to logical conversion table to order the text, styles and character's layout (metrics).
  *
+ * @param[in] characterGlobalIndex Index within the whole text of the first character of the paragraph.
  * @param[in,out] rtlParagraph Layout info for the paragraph with rtl text.
+ * @param[in,out] relayoutData The text-view's data structures.
  */
-void ReorderLayout( TextViewProcessor::ParagraphLayoutInfo& paragraph )
+void ReorderLayout( std::size_t characterGlobalIndex,
+                    TextViewProcessor::ParagraphLayoutInfo& paragraph,
+                    TextView::RelayoutData& relayoutData )
 {
   // Clear any previous right to left layout.
   if( NULL != paragraph.mRightToLeftLayout )
@@ -446,12 +450,20 @@ void ReorderLayout( TextViewProcessor::ParagraphLayoutInfo& paragraph )
     }
 
     // Sets the new 'x' position for each character.
+    // Updates the text-view's layout info table with the new position of the character.
     float xPosition = 0.f;
-    for( TextViewProcessor::CharacterLayoutInfoContainer::iterator it = characters.begin(), endIt = characters.end(); it != endIt; ++it )
+    std::size_t index = 0u;
+    for( TextViewProcessor::CharacterLayoutInfoContainer::iterator it = characters.begin(), endIt = characters.end(); it != endIt; ++it, ++index )
     {
       TextViewProcessor::CharacterLayoutInfo& character( *it );
 
+      // Set the 'x' position.
       character.mPosition.x = xPosition;
+
+      // Update layout info table.
+      relayoutData.mCharacterLayoutInfoTable[characterGlobalIndex + info->mVisualToLogicalMap[index]].mPosition = character.mPosition;
+
+      // Update the position for the next character.
       xPosition += character.mSize.width;
     }
 
@@ -461,7 +473,7 @@ void ReorderLayout( TextViewProcessor::ParagraphLayoutInfo& paragraph )
     TextProcessor::SplitInWords( info->mText, positions );
 
     // Sets the characters into the words they belong to.
-    for( Vector<size_t>::ConstIterator it = positions.Begin(), endIt = positions.End(); it != endIt; ++it )
+    for( Vector<std::size_t>::ConstIterator it = positions.Begin(), endIt = positions.End(); it != endIt; ++it )
     {
       const std::size_t position = *it;
 
@@ -525,6 +537,47 @@ void CreateBidirectionalInfoForLines( TextView::RelayoutData& relayoutData,
   // Clear previously created bidirectional info.
   paragraph.ClearBidirectionalInfo();
 
+  // For each character, it sets the character's direction.
+
+  // Initialize the paragraph direction. Used to set the direction of weak characters.
+  const bool isParagraphRightToLeft = paragraph.mBidirectionalParagraphInfo->IsRightToLeftParagraph();
+  bool isPreviousRightToLeft = isParagraphRightToLeft;
+
+  for( std::size_t index = 0u; index < paragraph.mNumberOfCharacters; ++index )
+  {
+    // Get the character's layout information (the one is shared with text-input)
+    Toolkit::TextView::CharacterLayoutInfo& info = *( relayoutData.mCharacterLayoutInfoTable.begin() + ( characterGlobalIndex + index ) );
+
+    // Gets the character's direction.
+    const Character::CharacterDirection direction = paragraph.mText[index].GetCharacterDirection();
+    if( Character::RightToLeft == direction )
+    {
+      info.mIsRightToLeftCharacter = true;
+    }
+    else if( Character::Neutral == direction )
+    {
+      // For neutral characters it check's the next and previous directions.
+      // If they are equals set that direction. If they are not, sets the paragraph direction.
+      // If there is no next, sets the previous direction.
+
+      // Check next character's direction.
+      bool isNextRightToLeft = isPreviousRightToLeft;
+      if( index < paragraph.mNumberOfCharacters - 1u )
+      {
+        const Character::CharacterDirection nextDirection = paragraph.mText[index + 1u].GetCharacterDirection();
+        isNextRightToLeft = Character::RightToLeft == nextDirection;
+      }
+
+      info.mIsRightToLeftCharacter = isPreviousRightToLeft == isNextRightToLeft ? isPreviousRightToLeft : isParagraphRightToLeft;
+    }
+    else
+    {
+      info.mIsRightToLeftCharacter = false;
+    }
+
+    isPreviousRightToLeft = info.mIsRightToLeftCharacter;
+  }
+
   std::size_t characterParagraphIndex = 0u;   // Index to the character (within the paragraph).
   for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = paragraph.mWordsLayoutInfo.begin(), wordEndIt = paragraph.mWordsLayoutInfo.end();
        wordIt != wordEndIt;
@@ -597,6 +650,9 @@ void ReorderRightToLeftLayout( TextView::RelayoutData& relayoutData )
     {
       // There is right to left text in this paragraph.
 
+      // Stores the current global character index as is needed in both functions.
+      const std::size_t currentGlobalIndex = characterGlobalIndex;
+
       // Creates the bidirectional info needed to reorder each line of the paragraph.
       CreateBidirectionalInfoForLines( relayoutData,
                                        paragraph,
@@ -604,7 +660,7 @@ void ReorderRightToLeftLayout( TextView::RelayoutData& relayoutData )
                                        lineLayoutInfoIndex );
 
       // Reorder each line of the paragraph
-      ReorderLayout( paragraph );
+      ReorderLayout( currentGlobalIndex, paragraph, relayoutData );
     }
     else
     {
@@ -856,7 +912,8 @@ void UpdateAlignment( const TextView::LayoutParameters& layoutParameters,
         // Updates the size and position table for text-input with the alignment offset.
         Vector3 positionOffset( characterLayoutInfo.mPosition );
 
-        std::vector<Toolkit::TextView::CharacterLayoutInfo>::iterator infoTableIt = relayoutData.mCharacterLayoutInfoTable.begin() + characterGlobalIndex;
+        // Update layout info table.
+        std::vector<Toolkit::TextView::CharacterLayoutInfo>::iterator infoTableIt = relayoutData.mCharacterLayoutInfoTable.begin() + relayoutData.mCharacterVisualToLogicalMap[characterGlobalIndex];
         Toolkit::TextView::CharacterLayoutInfo& characterTableInfo( *infoTableIt );
 
         characterTableInfo.mPosition.x = positionOffset.x + characterLayoutInfo.mOffset.x;
@@ -937,7 +994,7 @@ void UpdateLayoutInfoTable( Vector4& minMaxXY,
                                                                                characterLayoutInfo.mSize.height * relayoutData.mShrinkFactor ),
                                                                          positionOffset,
                                                                          ( TextViewProcessor::ParagraphSeparator == wordLayoutInfo.mType ),
-                                                                         characterLayoutInfo.mIsRightToLeft, // whether the character is right to left.
+                                                                         false, // whether the character is right to left. The value is set in a next step in the CreateBidirectionalInfoForLines function
                                                                          true,  // whether the character is visible.
                                                                          descender );
 
@@ -1627,7 +1684,7 @@ void UpdateVisibilityForFade( const TextView::LayoutParameters& layoutParameters
                                     relayoutData );
 
         // Updates the visibility for text-input..
-        std::vector<Toolkit::TextView::CharacterLayoutInfo>::iterator it = relayoutData.mCharacterLayoutInfoTable.begin() + infoTableCharacterIndex;
+        std::vector<Toolkit::TextView::CharacterLayoutInfo>::iterator it = relayoutData.mCharacterLayoutInfoTable.begin() + relayoutData.mCharacterVisualToLogicalMap[infoTableCharacterIndex];
 
         Toolkit::TextView::CharacterLayoutInfo& characterLayoutTableInfo( *it );
 
@@ -1643,6 +1700,8 @@ void UpdateVisibilityForEllipsize( const TextView::LayoutParameters& layoutParam
                                    const TextView::VisualParameters& visualParameters,
                                    TextView::RelayoutData& relayoutData )
 {
+  // TODO check ellipsis with rtl text.
+
   // Traverses the lines and checks which ones doesn't fit in the text-view's boundary.
   for( Toolkit::TextView::LineLayoutInfoContainer::const_iterator lineInfoIt = relayoutData.mLines.begin(), endLineInfoIt = relayoutData.mLines.end();
        lineInfoIt != endLineInfoIt;
@@ -1934,6 +1993,8 @@ void UpdateTextActorInfoForParagraph( const TextView::VisualParameters& visualPa
                                       std::size_t& lineLayoutInfoIndex,
                                       bool createGlyphActors )
 {
+  // TODO: Check if there is text-actor created only with white spaces. Check first in RTL text.
+
   CurrentTextActorInfo currentTextActorInfo;
   currentTextActorInfo.characterLayout = NULL;
 
index 8131b47..d6b4146 100644 (file)
@@ -63,6 +63,30 @@ BidirectionalParagraphInfo& BidirectionalParagraphInfo::operator=( const Bidirec
   return *this;
 }
 
+bool BidirectionalParagraphInfo::IsRightToLeftParagraph() const
+{
+  bool isRightToLeft = false;
+
+  switch( mDirection )
+  {
+    case FRIBIDI_PAR_LTR:  // Left-To-Right paragraph.
+    case FRIBIDI_PAR_ON:   // DirectiOn-Neutral paragraph.
+    case FRIBIDI_PAR_WLTR: // Weak Left To Right paragraph.
+    {
+      isRightToLeft = false;
+      break;
+    }
+    case FRIBIDI_PAR_RTL:  // Right-To-Left paragraph.
+    case FRIBIDI_PAR_WRTL: // Weak Right To Left paragraph.
+    {
+      isRightToLeft = true;
+      break;
+    }
+  }
+
+  return isRightToLeft;
+}
+
 BidirectionalLineInfo::BidirectionalLineInfo()
 : mCharacterParagraphIndex(),
   mNumberOfCharacters(),
index 77d6ee9..1ed24cd 100644 (file)
@@ -64,6 +64,12 @@ struct BidirectionalParagraphInfo
    */
   BidirectionalParagraphInfo& operator=( const BidirectionalParagraphInfo& info );
 
+
+  /**
+   * @return Whether the paragraph is right to left.
+   */
+  bool IsRightToLeftParagraph() const;
+
   FriBidiParType               mDirection;            ///< The paragraph direction.
   std::vector<FriBidiCharType> mCharactersTypeBuffer; ///< Character type buffer.
   std::vector<FriBidiLevel>    mLevelsBuffer;         ///< Levels buffer.
index a3a8ced..ddcf00f 100644 (file)
@@ -78,8 +78,7 @@ CharacterLayoutInfo::CharacterLayoutInfo()
   mIsVisible( true ),
   mSetText( false ),
   mSetStyle( false ),
-  mIsColorGlyph( false ),
-  mIsRightToLeft( false )
+  mIsColorGlyph( false )
 {
 }
 
@@ -103,8 +102,7 @@ CharacterLayoutInfo::CharacterLayoutInfo( const CharacterLayoutInfo& character )
   mIsVisible( character.mIsVisible ),
   mSetText( character.mSetText ),
   mSetStyle( character.mSetStyle ),
-  mIsColorGlyph( character.mIsColorGlyph ),
-  mIsRightToLeft( character.mIsRightToLeft )
+  mIsColorGlyph( character.mIsColorGlyph )
 {
 }
 
@@ -149,7 +147,6 @@ CharacterLayoutInfo& CharacterLayoutInfo::operator=( const CharacterLayoutInfo&
   mSetText = character.mSetText;
   mSetStyle = character.mSetStyle;
   mIsColorGlyph = character.mIsColorGlyph;
-  mIsRightToLeft = character.mIsRightToLeft;
 
   return *this;
 }
index 8cb689b..15005cc 100644 (file)
@@ -161,25 +161,24 @@ struct CharacterLayoutInfo
   CharacterLayoutInfo& operator=( const CharacterLayoutInfo& character );
 
   // Metrics of the glyph.
-  Size        mSize;                ///< Height of the font and advance (the horizontal distance from the origin of the current character and the next one).
-  float       mBearing;             ///< Vertical distance from the baseline to the top of the glyph's boundary box.
-  float       mAscender;            ///< Distance from the base line to the top of the line.
-  float       mUnderlineThickness;  ///< The underline's thickness.
-  float       mUnderlinePosition;   ///< The underline's position.
+  Size        mSize;               ///< Height of the font and advance (the horizontal distance from the origin of the current character and the next one).
+  float       mBearing;            ///< Vertical distance from the baseline to the top of the glyph's boundary box.
+  float       mAscender;           ///< Distance from the base line to the top of the line.
+  float       mUnderlineThickness; ///< The underline's thickness.
+  float       mUnderlinePosition;  ///< The underline's position.
 
   // Position and alignment offset. It depends on the lay-out.
-  Vector3     mPosition;            ///< Position within the text-view
-  Vector2     mOffset;              ///< Alignment and justification offset.
-
-  RenderableActor mGlyphActor;      ///< Handle to a text-actor.
-  float           mColorAlpha;      ///< Alpha component for the initial text color when text is faded.
-  GradientInfo*   mGradientInfo;    ///< Stores gradient info.
-
-  bool            mIsVisible:1;     ///< Whether the text-actor is visible.
-  bool            mSetText:1;       ///< Whether a new text needs to be set in the text-actor.
-  bool            mSetStyle:1;      ///< Whether a new style needs to be set in the text-actor.
-  bool            mIsColorGlyph:1;  ///< Whether this character is an emoticon.
-  bool            mIsRightToLeft:1; ///< Whether this character is right to left.
+  Vector3     mPosition;           ///< Position within the text-view
+  Vector2     mOffset;             ///< Alignment and justification offset.
+
+  RenderableActor mGlyphActor;     ///< Handle to a text-actor.
+  float           mColorAlpha;     ///< Alpha component for the initial text color when text is faded.
+  GradientInfo*   mGradientInfo;   ///< Stores gradient info.
+
+  bool            mIsVisible:1;    ///< Whether the text-actor is visible.
+  bool            mSetText:1;      ///< Whether a new text needs to be set in the text-actor.
+  bool            mSetStyle:1;     ///< Whether a new style needs to be set in the text-actor.
+  bool            mIsColorGlyph:1; ///< Whether this character is an emoticon.
 };
 typedef std::vector<CharacterLayoutInfo> CharacterLayoutInfoContainer;
 
index eba4f52..800a96b 100644 (file)
@@ -113,11 +113,6 @@ void CreateWordTextInfo( const Text& paragraph,
       ChooseFontFamilyName( character, *textStyle );
     }
 
-    // Checks whether the charcter is right to left.
-    const Character::CharacterDirection direction = character.GetCharacterDirection();
-    characterLayoutInfo.mIsRightToLeft = ( ( direction == Character::RightToLeft ) ||
-                                           ( direction == Character::RightToLeftWeak ) );
-
     // Gets the metrics of the font.
     const Font font = Font::New( FontParameters( textStyle->GetFontName(), textStyle->GetFontStyle(), textStyle->GetFontPointSize() ) );
     const Font::Metrics metrics = font.GetMetrics( character );
diff --git a/base/dali-toolkit/internal/factory/localized-control-factory-impl.cpp b/base/dali-toolkit/internal/factory/localized-control-factory-impl.cpp
deleted file mode 100644 (file)
index da07f2f..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "localized-control-factory-impl.h"
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali/integration-api/debug.h>
-
-// EXTERNAL INCLUDES
-#include <libintl.h>
-
-using std::string;
-using namespace Dali;
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace // unnamed namespace
-{
-
-
-}
-
-LocalizedControlFactory::LocalizedControlFactory()
-: mObjectEntries(),
-  mSignalsConnected( false )
-{
-}
-
-LocalizedControlFactory::~LocalizedControlFactory()
-{
-}
-
-Dali::Toolkit::TextView LocalizedControlFactory::CreateLocalizedTextView( const std::string& textID, const std::string& textDomain, const std::string& textViewTheme )
-{
-  if( !mSignalsConnected )
-  {
-    Stage::GetCurrent().GetObjectRegistry().ObjectDestroyedSignal().Connect( this, &LocalizedControlFactory::OnObjectDestruction );
-    Adaptor::Get().LanguageChangedSignal().Connect( this, &LocalizedControlFactory::OnLanguageChanged );
-    mSignalsConnected = true;
-  }
-
-  const string& localizedText = dgettext(textDomain.c_str(), textID.c_str());
-  Dali::Toolkit::TextView textView = Dali::Toolkit::TextView::New();
-  textView.SetText(localizedText);
-
-  LocalisedStringInfo info(textID, textDomain, textViewTheme);
-
-  mObjectEntries[textView.GetObjectPtr()] = info;
-
-  return textView;
-}
-
-void LocalizedControlFactory::OnObjectDestruction( const Dali::RefObject* objectPointer )
-{
-  if(!mObjectEntries.empty())
-  {
-    //Needs optimization. All the destructed objects are currently checked for existence in entries.
-    mObjectEntries.erase(objectPointer);
-  }
-}
-
-void LocalizedControlFactory::OnLanguageChanged( Dali::Adaptor& adaptor)
-{
-  if(!mObjectEntries.empty())
-  {
-    ObjectEntriesIterator iter = mObjectEntries.begin();
-    ObjectEntriesIterator iterEnd = mObjectEntries.end();
-    while(iter != iterEnd)
-    {
-      RefObject* refObjectPtr = const_cast<RefObject*> (iter->first);
-      BaseHandle handle(static_cast<BaseObject*>(refObjectPtr));
-      LocalisedStringInfo info = iter->second;
-
-      const string& localizedText = dgettext(info.textDomain.c_str(), info.textID.c_str());
-
-      Toolkit::TextView textView =  Dali::Toolkit::TextView::DownCast( handle );
-
-      if(textView)
-      {
-        textView.SetText( localizedText );
-      }
-      else
-      {
-        DALI_ASSERT_ALWAYS(false && "Corrupt TextView internal pointer in entries!");
-      }
-
-      ++iter;
-    }
-  }
-}
-
-
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/base/dali-toolkit/internal/factory/localized-control-factory-impl.h b/base/dali-toolkit/internal/factory/localized-control-factory-impl.h
deleted file mode 100644 (file)
index ac49226..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_LOCALIZED_CONTROL_FACTORY_H__
-#define __DALI_TOOLKIT_INTERNAL_LOCALIZED_CONTROL_FACTORY_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-#include <set>
-
-// INTERNAL INCLUDES
-#include <dali/dali.h>
-#include <dali-toolkit/public-api/factory/localized-control-factory.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-/**
- * @copydoc Toolkit::LocalizedControlFactory
- */
-class LocalizedControlFactory : public Dali::BaseObject, public ConnectionTracker
-{
-public:
-
-  /**
-   * Structure used to store/retrieve localisation info.
-   */
-  struct LocalisedStringInfo
-  {
-    LocalisedStringInfo()
-    {
-    }
-
-    LocalisedStringInfo(std::string id, std::string domain, std::string theme)
-    : textID(id),
-      textDomain(domain),
-      textViewTheme(theme)
-    {
-
-    }
-
-    std::string textID;
-    std::string textDomain;
-    std::string textViewTheme;
-  };
-
-  typedef std::map< const Dali::RefObject*, LocalisedStringInfo > ObjectEntriesContainer;
-  typedef ObjectEntriesContainer::iterator ObjectEntriesIterator;
-  typedef ObjectEntriesContainer::const_iterator ObjectEntriesConstIterator;
-
-  /**
-   * Construct a new LocalizedControlFactory.
-   */
-  LocalizedControlFactory();
-
-  /**
-   * @copydoc Toolkit::LocalizedControlFactory::CreateLocalizedTextView
-   */
-  Dali::Toolkit::TextView CreateLocalizedTextView( const std::string& textID, const std::string& textDomain, const std::string& textViewTheme );
-
-protected:
-
-  /**
-   * Destructor
-   */
-  virtual ~LocalizedControlFactory();
-
-private:
-
-  /**
-   * Callback for Object destructed signal.
-   * @param objectPointer Pointer to a RefObject
-   */
-  void OnObjectDestruction( const Dali::RefObject* objectPointer );
-
-  /**
-   * Callback for language changed signal.
-   * @param adaptor Reference to a Dali::Adaptor instance
-   */
-  void OnLanguageChanged( Dali::Adaptor& adaptor);
-
-private:
-
-  // Undefined
-  LocalizedControlFactory(const LocalizedControlFactory&);
-  LocalizedControlFactory& operator=(const LocalizedControlFactory& rhs);
-
-private:
-
-  ObjectEntriesContainer mObjectEntries;
-  bool mSignalsConnected:1;
-
-};
-
-} // namespace Internal
-
-inline Internal::LocalizedControlFactory& GetImpl(Dali::Toolkit::LocalizedControlFactory& obj)
-{
-  DALI_ASSERT_ALWAYS(obj);
-
-  Dali::BaseObject& handle = obj.GetBaseObject();
-
-  return static_cast<Internal::LocalizedControlFactory&>(handle);
-}
-
-inline const Internal::LocalizedControlFactory& GetImpl(const Dali::Toolkit::LocalizedControlFactory& obj)
-{
-  DALI_ASSERT_ALWAYS(obj);
-
-  const Dali::BaseObject& handle = obj.GetBaseObject();
-
-  return static_cast<const Internal::LocalizedControlFactory&>(handle);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_LOCALIZED_CONTROL_FACTORY_H__
index f2331cc..5e8af9c 100644 (file)
@@ -55,7 +55,6 @@ toolkit_base_src_files = \
    $(toolkit_base_src_dir)/controls/text-view/text-view-processor-dbg.cpp  \
    $(toolkit_base_src_dir)/controls/text-view/text-view-processor-helper-functions.cpp  \
    $(toolkit_base_src_dir)/controls/text-view/text-view-word-processor.cpp  \
-   $(toolkit_base_src_dir)/factory/localized-control-factory-impl.cpp \
    $(toolkit_base_src_dir)/focus-manager/focus-manager-impl.cpp \
    $(toolkit_base_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \
    $(toolkit_base_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp \
index 57be231..acf1ced 100644 (file)
@@ -116,9 +116,10 @@ StyleManager::StyleManager()
 
   RequestDefaultTheme();
 
-  if( Adaptor::IsAvailable() )
+  StyleMonitor styleMonitor( StyleMonitor::Get() );
+  if( styleMonitor )
   {
-    StyleMonitor::Get().StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange );
+    styleMonitor.StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange );
   }
 }
 
diff --git a/base/dali-toolkit/public-api/factory/localized-control-factory.cpp b/base/dali-toolkit/public-api/factory/localized-control-factory.cpp
deleted file mode 100644 (file)
index d8999c1..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-
-#include <dali-toolkit/public-api/factory/localized-control-factory.h>
-
-// EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
-
-#include <dali-toolkit/internal/factory/localized-control-factory-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-Dali::Toolkit::TextView LocalizedControlFactory::CreateLocalizedTextView( const std::string& textID, const std::string& textDomain, const std::string& textViewTheme )
-{
-  LocalizedControlFactory factory = Get();
-  return GetImpl(factory).CreateLocalizedTextView(textID, textDomain, textViewTheme);
-}
-
-LocalizedControlFactory::LocalizedControlFactory()
-{
-}
-
-LocalizedControlFactory::~LocalizedControlFactory()
-{
-}
-
-LocalizedControlFactory LocalizedControlFactory::Get()
-{
-  LocalizedControlFactory factory;
-
-  // Check whether the focus factory is already created
-  SingletonService singletonService( SingletonService::Get() );
-  if ( singletonService )
-  {
-    Dali::BaseHandle handle = singletonService.GetSingleton(typeid(LocalizedControlFactory));
-    if(handle)
-    {
-      // If so, downcast the handle of singleton to focus factory
-      factory = LocalizedControlFactory(dynamic_cast<Internal::LocalizedControlFactory*>(handle.GetObjectPtr()));
-    }
-
-    if(!factory)
-    {
-      // If not, create the focus factory and register it as a singleton
-      factory = LocalizedControlFactory(new Internal::LocalizedControlFactory());
-      singletonService.Register(typeid(factory), factory);
-    }
-  }
-
-  return factory;
-}
-
-LocalizedControlFactory::LocalizedControlFactory(Internal::LocalizedControlFactory *impl)
-  : BaseHandle(impl)
-{
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/base/dali-toolkit/public-api/factory/localized-control-factory.h b/base/dali-toolkit/public-api/factory/localized-control-factory.h
deleted file mode 100644 (file)
index 6276550..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_H__
-#define __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/text-view/text-view.h>
-
-namespace Dali DALI_IMPORT_API
-{
-
-namespace Toolkit
-{
-
-namespace Internal DALI_INTERNAL
-{
-class LocalizedControlFactory;
-}
-
-/**
- * @brief This class provides functionality for creating controls which have localized text.
- *
- * This class keeps track of objects created using its factory methods, and updates them
- * when the system language changes.
- *
- * Warning: If the developer calls SetText on the object to overwrite the managed TextView,
- * then it leads to an inconsistent state where the object will be overwritten with the
- * localized text when language/locale changes.
- */
-
-class LocalizedControlFactory : public BaseHandle
-{
-public:
-
-  /**
-   * @brief Creates a localized TextView, which is automatically updated when the locale or language changes.
-   *
-   * @pre The LocalizedControlFactory has been initialized.
-   *
-   * @param textID The id of the localized text with which a platform request (gettext) for localized text can be made.
-   * @param textDomain The text domain for the localized text. Eg "sys_string"
-   * @param textViewTheme A string containing style info about various properties of TextView for different
-   *        locale/language.
-   * @return handle to a new localized TextView
-   */
-  static Dali::Toolkit::TextView CreateLocalizedTextView( const std::string& textID, const std::string& textDomain = "sys_string", const std::string& textViewTheme = "{}" );
-
-
-private:
-
-  /**
-   * @brief Create a LocalizedControlFactory handle; this can be initialised with LocalizedControlFactory::New().
-   *
-   * Calling member functions with an uninitialised handle is not allowed.
-   */
-  LocalizedControlFactory();
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~LocalizedControlFactory();
-
-  /**
-   * @brief Get the singleton of LocalizedControlFactory object.
-   *
-   * @return A handle to the LocalizedControlFactory control.
-   */
-  static LocalizedControlFactory Get();
-
-  /**
-   * @brief Allows the creation of this Control from an Internal::LocalizedControlFactory pointer.
-   *
-   * @param[in]  impl  A pointer to the internal LocalizedControlFactory.
-   */
-  LocalizedControlFactory(Internal::LocalizedControlFactory *impl);
-}; // class LocalizedControlFactory
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_LOCALIZED_CONTROL_FACTORY_H__
index e46991d..d497cea 100755 (executable)
@@ -43,7 +43,6 @@ public_api_base_src_files = \
   $(public_api_base_src_dir)/controls/table-view/table-view.cpp \
   $(public_api_base_src_dir)/controls/text-input/text-input.cpp \
   $(public_api_base_src_dir)/controls/text-view/text-view.cpp \
-  $(public_api_base_src_dir)/factory/localized-control-factory.cpp \
   $(public_api_base_src_dir)/focus-manager/focus-manager.cpp \
   $(public_api_base_src_dir)/focus-manager/keyboard-focus-manager.cpp \
   $(public_api_base_src_dir)/focus-manager/keyinput-focus-manager.cpp \
@@ -126,9 +125,6 @@ public_api_base_text_input_header_files = \
 public_api_base_text_view_header_files = \
   $(public_api_base_src_dir)/controls/text-view/text-view.h
 
-public_api_base_factory_header_files = \
-  $(public_api_base_src_dir)/factory/localized-control-factory.h
-
 public_api_base_focus_manager_header_files = \
   $(public_api_base_src_dir)/focus-manager/keyinput-focus-manager.h \
   $(public_api_base_src_dir)/focus-manager/focus-manager.h \
index 3168719..86111b2 100644 (file)
@@ -137,7 +137,6 @@ publicapibasescrollview_HEADERS = $(public_api_base_scroll_view_header_files)
 publicapibasetableview_HEADERS = $(public_api_base_table_view_header_files)
 publicapibasetextview_HEADERS = $(public_api_base_text_view_header_files)
 publicapibasetextinput_HEADERS = $(public_api_base_text_input_header_files)
-publicapibasefactory_HEADERS = $(public_api_base_factory_header_files)
 publicapibasefocusmanager_HEADERS = $(public_api_base_focus_manager_header_files)
 publicapibasemarkupprocessor_HEADERS = $(public_api_base_markup_processor_header_files)
 publicapibaseshadereffects_HEADERS = $(public_api_base_shader_effects_header_files)
index 2c838cd..45d1566 100644 (file)
@@ -46,7 +46,6 @@
 #include <dali-toolkit/public-api/controls/text-input/text-input.h>
 #include <dali-toolkit/public-api/controls/text-view/text-view.h>
 #include <dali-toolkit/public-api/enums.h>
-#include <dali-toolkit/public-api/factory/localized-control-factory.h>
 #include <dali-toolkit/public-api/focus-manager/focus-manager.h>
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
 #include <dali-toolkit/public-api/markup-processor/markup-processor.h>
index b9b9946..14ff051 100644 (file)
@@ -292,11 +292,6 @@ unsigned int genRandom(unsigned int& seed, unsigned int offset)
   return seed;
 }
 
-float genRandomFloat(unsigned int& seed, unsigned int offset)
-{
-  return static_cast<float>(genRandom(seed, offset)) / 0xffffffff;
-}
-
 float genRandomFloat(unsigned int& seed, unsigned int offset, float min, float max)
 {
   const float f = static_cast<float>(genRandom(seed, offset)) / 0xffffffff;
index 9783240..3e23a8a 100644 (file)
@@ -115,22 +115,6 @@ struct RenderTaskViewportSizeConstraint
   }
 };
 
-/**
- * Returns relative border (0.0f...1.0f x 0.0f...1.0f)
- * from an absolute pixel specified border.
- * @param[in] absolute A border using absolute pixel coordinates
- * @param[in] width The width of the texture
- * @param[in] height The height of the texture.
- * @return A border relative to the size of the Image texture dimensions.
- */
-Vector4 GetRelativeBorder(Vector4 absolute, float width, float height)
-{
-  return Vector4( absolute.x / width,
-                  absolute.y / height,
-                  absolute.z / width,
-                  absolute.w / height);
-}
-
 }
 
 namespace Dali