Merge remote-tracking branch 'origin/tizen' into new_text 88/35888/3
authorPaul Wisbey <p.wisbey@samsung.com>
Wed, 25 Feb 2015 13:33:11 +0000 (13:33 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Wed, 25 Feb 2015 14:21:46 +0000 (14:21 +0000)
Conflicts:
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-handles-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-popup-impl.h
dali-toolkit/internal/controls/text-input/text-input-popup-new-impl.h
dali-toolkit/internal/controls/text-input/textview-character-positions-impl.h
dali-toolkit/internal/controls/text-view/split-by-char-policies.cpp
dali-toolkit/internal/controls/text-view/text-view-impl.cpp
dali-toolkit/internal/controls/text-view/text-view-processor-dbg.cpp
dali-toolkit/public-api/controls/text-input/text-input.cpp
dali-toolkit/public-api/controls/text-input/text-input.h
dali-toolkit/public-api/controls/text-view/text-view.cpp
dali-toolkit/public-api/controls/text-view/text-view.h

Change-Id: Icce105492c4770040956a99aa871bbda03f0da4c

21 files changed:
1  2 
automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp
automated-tests/src/dali-toolkit/utc-Dali-RadioButton.cpp
dali-toolkit/dali-toolkit.h
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.h
dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp
dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h
dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.h
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/relayout-controller-impl.cpp
dali-toolkit/internal/controls/relayout-controller.cpp
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/public-api/controls/popup/popup.cpp
dali-toolkit/public-api/controls/popup/popup.h
dali-toolkit/public-api/file.list
dali-toolkit/public-api/text/decorator/text-decorator.cpp
dali-toolkit/public-api/text/decorator/text-decorator.h
dali-toolkit/public-api/text/shaper.cpp
packaging/dali-toolkit.spec

Simple merge
  // EXTERNAL INCLUDES
  #include <dali/public-api/events/touch-event.h>
  #include <dali/public-api/object/type-registry.h>
 -#include <dali-toolkit/public-api/controls/text-view/text-view.h>
+ #include <dali/public-api/actors/image-actor.h>
+ #include <dali/public-api/scripting/scripting.h>
+ // INTERNAL INCLUDES
  
  namespace Dali
  {
@@@ -108,9 -232,233 +231,229 @@@ float Button::GetAnimationTime() cons
    return OnAnimationTimeRequested();
  }
  
 -  Toolkit::TextView textView = Toolkit::TextView::New( label );
 -  textView.SetWidthExceedPolicy( Toolkit::TextView::ShrinkToFit ); // Make sure our text always fits inside the button
 -  SetLabel( textView );
 -
+ void Button::SetLabel( const std::string& label )
+ {
+   RelayoutRequest();
+ }
+ void Button::SetLabel( Actor label )
+ {
+   Toolkit::Button handle( GetOwner() );
+   mPainter->SetLabel( handle, label );
+ }
+ Actor Button::GetLabel() const
+ {
+   return mLabel;
+ }
+ Actor& Button::GetLabel()
+ {
+   return mLabel;
+ }
+ void Button::SetButtonImage( Image image )
+ {
+   SetButtonImage( ImageActor::New( image ) );
+ }
+ void Button::SetButtonImage( Actor image )
+ {
+   Toolkit::Button handle( GetOwner() );
+   mPainter->SetButtonImage( handle, image );
+ }
+ Actor Button::GetButtonImage() const
+ {
+   return mButtonImage;
+ }
+ Actor& Button::GetButtonImage()
+ {
+   return mButtonImage;
+ }
+ void Button::SetSelectedImage( Image image )
+ {
+   SetSelectedImage( ImageActor::New( image ) );
+ }
+ void Button::SetSelectedImage( Actor image )
+ {
+   Toolkit::Button handle( GetOwner() );
+   mPainter->SetSelectedImage( handle, image );
+ }
+ Actor Button::GetSelectedImage() const
+ {
+   return mSelectedImage;
+ }
+ Actor& Button::GetSelectedImage()
+ {
+   return mSelectedImage;
+ }
+ void Button::SetBackgroundImage( Image image )
+ {
+   SetBackgroundImage( ImageActor::New( image ) );
+ }
+ void Button::SetBackgroundImage( Actor image )
+ {
+   Toolkit::Button handle( GetOwner() );
+   mPainter->SetBackgroundImage( handle, image );
+ }
+ Actor Button::GetBackgroundImage() const
+ {
+   return mBackgroundImage;
+ }
+ Actor& Button::GetBackgroundImage()
+ {
+   return mBackgroundImage;
+ }
+ void Button::SetDisabledImage( Image image )
+ {
+   SetDisabledImage( ImageActor::New( image ) );
+ }
+ void Button::SetDisabledImage( Actor image )
+ {
+   Toolkit::Button handle( GetOwner() );
+   mPainter->SetDisabledImage( handle, image );
+ }
+ Actor Button::GetDisabledImage() const
+ {
+   return mDisabledImage;
+ }
+ Actor& Button::GetDisabledImage()
+ {
+   return mDisabledImage;
+ }
+ void Button::SetDisabledSelectedImage( Image image )
+ {
+   SetDisabledSelectedImage( ImageActor::New( image ) );
+ }
+ void Button::SetDisabledSelectedImage( Actor image )
+ {
+   Toolkit::Button handle( GetOwner() );
+   mPainter->SetDisabledSelectedImage( handle, image );
+ }
+ Actor Button::GetDisabledSelectedImage() const
+ {
+   return mDisabledSelectedImage;
+ }
+ Actor& Button::GetDisabledSelectedImage()
+ {
+   return mDisabledSelectedImage;
+ }
+ void Button::SetDisabledBackgroundImage( Image image )
+ {
+   SetDisabledBackgroundImage( ImageActor::New( image ) );
+ }
+ void Button::SetDisabledBackgroundImage( Actor image )
+ {
+   Toolkit::Button handle( GetOwner() );
+   mPainter->SetDisabledBackgroundImage( handle, image );
+ }
+ Actor Button::GetDisabledBackgroundImage() const
+ {
+   return mDisabledBackgroundImage;
+ }
+ Actor& Button::GetDisabledBackgroundImage()
+ {
+   return mDisabledBackgroundImage;
+ }
+ Actor& Button::GetFadeOutButtonImage()
+ {
+   return mFadeOutButtonImage;
+ }
+ Actor& Button::GetFadeOutSelectedImage()
+ {
+   return mFadeOutSelectedImage;
+ }
+ Actor& Button::GetFadeOutBackgroundImage()
+ {
+   return mFadeOutBackgroundImage;
+ }
+ bool Button::DoAction( BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes )
+ {
+   bool ret = false;
+   Dali::BaseHandle handle( object );
+   Toolkit::Button button = Toolkit::Button::DownCast( handle );
+   DALI_ASSERT_ALWAYS( button );
+   if( 0 == strcmp( actionName.c_str(), ACTION_BUTTON_CLICK ) )
+   {
+     GetImplementation( button ).DoClickAction( attributes );
+     ret = true;
+   }
+   return ret;
+ }
+ void Button::DoClickAction( const PropertyValueContainer& attributes )
+ {
+   // Prevents the button signals from doing a recursive loop by sending an action
+   // and re-emitting the signals.
+   if( !mClickActionPerforming )
+   {
+     mClickActionPerforming = true;
+     OnButtonDown();
+     mState = ButtonDown;
+     OnButtonUp();
+     mClickActionPerforming = false;
+   }
+ }
  void Button::OnAnimationTimeSet( float animationTime )
  {
-   // nothing to do.
+   mPainter->SetAnimationTime( animationTime );
+ }
+ float Button::OnAnimationTimeRequested() const
+ {
+   return mPainter->GetAnimationTime();
+ }
+ void Button::OnButtonStageDisconnection()
+ {
+   if( ButtonDown == mState )
+   {
+     if( !mTogglableButton )
+     {
+       Toolkit::Button handle( GetOwner() );
+       // Notifies the painter the button has been released.
+       mPainter->Released( handle );
+       if( mAutoRepeating )
+       {
+         mAutoRepeatingTimer.Reset();
+       }
+     }
+   }
  }
  
  void Button::OnButtonDown()
   *
   */
  
+ // INTERNAL INCLUDES
+ #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
  #include <dali-toolkit/public-api/controls/table-view/table-view.h>
 -#include <dali-toolkit/public-api/controls/text-view/text-view.h>
  #include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
  #include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
- #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
  
  namespace Dali
  {
@@@ -18,7 -18,9 +18,8 @@@
   *
   */
  
+ // INTERNAL INCLUDES
  #include <dali-toolkit/public-api/controls/table-view/table-view.h>
 -#include <dali-toolkit/public-api/controls/text-view/text-view.h>
  #include <dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h>
  #include <dali-toolkit/internal/controls/navigation-frame/navigation-bar.h>
  #include <dali-toolkit/public-api/controls/navigation-frame/page.h>
  
  // INTERNAL INCLUDES
  
+ #include "relayout-controller-impl.h"
  #include "dali-toolkit/public-api/controls/control.h"
  #include "dali-toolkit/public-api/controls/control-impl.h"
 -#include "dali-toolkit/public-api/controls/text-view/text-view.h"
  
  namespace Dali
  {
index 5799da0,0000000..79a6545
mode 100644,000000..100644
--- /dev/null
@@@ -1,301 -1,0 +1,298 @@@
- #include <dali/public-api/images/image.h>
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * 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/internal/controls/text-controls/text-field-impl.h>
 +
 +// EXTERNAL INCLUDES
-         Image image = Image::New( value.Get< std::string >() );
-         //ResourceImage image = ResourceImage::New( value.Get< std::string >() );
++#include <dali/public-api/images/resource-image.h>
 +#include <dali/public-api/object/type-registry.h>
 +#include <dali/integration-api/debug.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/text/layouts/layout-engine.h>
 +#include <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h> // TODO - Get from RendererFactory
 +
 +using namespace Dali::Toolkit::Text;
 +
 +namespace
 +{
 +
 +} // namespace
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +const Property::Index TextField::PROPERTY_PLACEHOLDER_TEXT(       Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX );
 +const Property::Index TextField::PROPERTY_TEXT(                   Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 1 );
 +const Property::Index TextField::PROPERTY_CURSOR_IMAGE(           Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 2 );
 +const Property::Index TextField::PROPERTY_PRIMARY_CURSOR_COLOR(   Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 3 );
 +const Property::Index TextField::PROPERTY_SECONDARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 4 );
 +const Property::Index TextField::PROPERTY_ENABLE_CURSOR_BLINK(    Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 5 );
 +const Property::Index TextField::PROPERTY_CURSOR_BLINK_INTERVAL(  Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 6 );
 +const Property::Index TextField::PROPERTY_CURSOR_BLINK_DURATION(  Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 7 );
 +
 +namespace Internal
 +{
 +
 +namespace
 +{
 +
 +// Type registration
 +BaseHandle Create()
 +{
 +  return Toolkit::TextField::New();
 +}
 +
 +TypeRegistration mType( typeid(Toolkit::TextField), typeid(Toolkit::Control), Create );
 +
 +PropertyRegistration property1( mType, "placeholder-text",       Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT,       Property::STRING,  &TextField::SetProperty, &TextField::GetProperty );
 +PropertyRegistration property2( mType, "text",                   Toolkit::TextField::PROPERTY_TEXT,                   Property::STRING,  &TextField::SetProperty, &TextField::GetProperty );
 +PropertyRegistration property3( mType, "cursor-image",           Toolkit::TextField::PROPERTY_CURSOR_IMAGE,           Property::STRING,  &TextField::SetProperty, &TextField::GetProperty );
 +PropertyRegistration property4( mType, "primary-cursor-color",   Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR,   Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty );
 +PropertyRegistration property5( mType, "secondary-cursor-color", Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty );
 +PropertyRegistration property6( mType, "enable-cursor-blink",    Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK,    Property::BOOLEAN, &TextField::SetProperty, &TextField::GetProperty );
 +PropertyRegistration property7( mType, "cursor-blink-interval",  Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL,  Property::FLOAT,   &TextField::SetProperty, &TextField::GetProperty );
 +PropertyRegistration property8( mType, "cursor-blink-duration",  Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION,  Property::FLOAT,   &TextField::SetProperty, &TextField::GetProperty );
 +
 +} // namespace
 +
 +Toolkit::TextField TextField::New()
 +{
 +  // Create the implementation, temporarily owned by this handle on stack
 +  IntrusivePtr< TextField > impl = new TextField();
 +
 +  // Pass ownership to CustomActor handle
 +  Toolkit::TextField handle( *impl );
 +
 +  // Second-phase init of the implementation
 +  // This can only be done after the CustomActor connection has been made...
 +  impl->Initialize();
 +
 +  return handle;
 +}
 +
 +void TextField::SetRenderer( Text::RendererPtr renderer )
 +{
 +  mRenderer = renderer;
 +}
 +
 +void TextField::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 +{
 +  Toolkit::TextField textField = Toolkit::TextField::DownCast( Dali::BaseHandle( object ) );
 +
 +  if( textField )
 +  {
 +    TextField& impl( GetImpl( textField ) );
 +
 +    switch( index )
 +    {
 +      case Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT:
 +      {
 +        if( impl.mController )
 +        {
 +          //impl.mController->SetPlaceholderText( value.Get< std::string >() ); TODO
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_TEXT:
 +      {
 +        if( impl.mController )
 +        {
 +          impl.mController->SetText( value.Get< std::string >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_CURSOR_IMAGE:
 +      {
-           Image image = impl.mDecorator->GetCursorImage();
-           //ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetCursorImage() );
++        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetCursorImage( image );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetColor( PRIMARY_CURSOR, value.Get< Vector4 >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetColor( SECONDARY_CURSOR, value.Get< Vector4 >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK:
 +      {
 +        if( impl.mController )
 +        {
 +          //impl.mController->SetEnableCursorBlink( value.Get< bool >() ); TODO
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetCursorBlinkInterval( value.Get< float >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetCursorBlinkDuration( value.Get< float >() );
 +        }
 +        break;
 +      }
 +    }
 +  }
 +}
 +
 +Property::Value TextField::GetProperty( BaseObject* object, Property::Index index )
 +{
 +  Property::Value value;
 +
 +  Toolkit::TextField textField = Toolkit::TextField::DownCast( Dali::BaseHandle( object ) );
 +
 +  if( textField )
 +  {
 +    TextField& impl( GetImpl( textField ) );
 +
 +    switch( index )
 +    {
 +      case Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT:
 +      {
 +        DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_TEXT:
 +      {
 +        DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_CURSOR_IMAGE:
 +      {
 +        if( impl.mDecorator )
 +        {
-             value = image.GetFilename();
-             //value = image.GetUrl();
++          ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetCursorImage() );
 +          if( image )
 +          {
++            value = image.GetUrl();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetColor( PRIMARY_CURSOR );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetColor( SECONDARY_CURSOR );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK:
 +      {
 +        //value = impl.mController->GetEnableCursorBlink(); TODO
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetCursorBlinkInterval();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetCursorBlinkDuration();
 +        }
 +        break;
 +      }
 +    }
 +  }
 +
 +  return value;
 +}
 +
 +void TextField::OnInitialize()
 +{
 +  mDecorator = Text::Decorator::New( *this );
 +
 +  mController = Text::Controller::New();
 +  mController->GetLayoutEngine().SetLayout( LayoutEngine::SINGLE_LINE_BOX );
 +  //mController->EnableTextInput( mDecorator ); TODO
 +}
 +
 +void TextField::OnRelayout( const Vector2& size, ActorSizeContainer& container )
 +{
 +  if( mController->Relayout( size ) )
 +  {
 +    if( !mRenderer )
 +    {
 +      // TODO - Get from RendererFactory
 +      mRenderer = Dali::Toolkit::Text::BasicRenderer::New();
 +    }
 +
 +    if( mRenderer )
 +    {
 +      Actor renderableActor = mRenderer->Render( mController->GetView() );
 +
 +      if( renderableActor )
 +      {
 +        Self().Add( renderableActor );
 +      }
 +    }
 +  }
 +}
 +
 +TextField::TextField()
 +: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) )
 +{
 +}
 +
 +TextField::~TextField()
 +{
 +}
 +
 +} // namespace Internal
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
@@@ -50,7 -50,8 +50,8 @@@ public_api_src_files = 
    $(public_api_src_dir)/controls/slider/slider.cpp \
    $(public_api_src_dir)/controls/super-blur-view/super-blur-view.cpp \
    $(public_api_src_dir)/controls/table-view/table-view.cpp \
 -  $(public_api_src_dir)/controls/text-input/text-input.cpp \
 -  $(public_api_src_dir)/controls/text-view/text-view.cpp \
 +  $(public_api_src_dir)/controls/text-controls/text-label.cpp \
++  $(public_api_src_dir)/controls/text-controls/text-field.cpp \
    $(public_api_src_dir)/controls/tool-bar/tool-bar.cpp \
    $(public_api_src_dir)/controls/bloom-view/bloom-view.cpp \
    $(public_api_src_dir)/controls/cluster/cluster-style.cpp \
@@@ -219,44 -206,6 +221,45 @@@ public_api_super_blur_view_header_file
  public_api_table_view_header_files = \
    $(public_api_src_dir)/controls/table-view/table-view.h
  
-   $(public_api_src_dir)/controls/text-controls/text-label.h
 +public_api_text_controls_header_files = \
++  $(public_api_src_dir)/controls/text-controls/text-label.h \
++  $(public_api_src_dir)/controls/text-controls/text-field.h
 +
 +public_api_text_header_files = \
 +  $(public_api_src_dir)/text/bidirectional-line-info-run.h \
 +  $(public_api_src_dir)/text/bidirectional-paragraph-info-run.h \
 +  $(public_api_src_dir)/text/bidirectional-support.h \
 +  $(public_api_src_dir)/text/character-run.h \
 +  $(public_api_src_dir)/text/character-set-conversion.h \
 +  $(public_api_src_dir)/text/font-run.h \
 +  $(public_api_src_dir)/text/line-run.h \
 +  $(public_api_src_dir)/text/logical-model.h \
 +  $(public_api_src_dir)/text/multi-language-support.h \
 +  $(public_api_src_dir)/text/script.h \
 +  $(public_api_src_dir)/text/script-run.h \
 +  $(public_api_src_dir)/text/segmentation.h \
 +  $(public_api_src_dir)/text/shaper.h \
 +  $(public_api_src_dir)/text/text-controller.h \
 +  $(public_api_src_dir)/text/text-definitions.h \
 +  $(public_api_src_dir)/text/text-view.h \
 +  $(public_api_src_dir)/text/text-view-interface.h \
 +  $(public_api_src_dir)/text/visual-model.h
 +
 +public_api_text_decorator_header_files = \
 +  $(public_api_src_dir)/text/decorator/text-decorator.h
 +
 +public_api_text_layouts_header_files = \
 +  $(public_api_src_dir)/text/layouts/layout-engine.h
 +
 +public_api_text_rendering_header_files = \
 +  $(public_api_src_dir)/text/rendering/text-renderer.h
 +
 +public_api_text_rendering_basic_header_files = \
 +  $(public_api_src_dir)/text/rendering/basic/text-basic-renderer.h
 +
 +public_api_text_rendering_shaders_header_files = \
 +  $(public_api_src_dir)/text/rendering/shaders/text-basic-shader.h
 +
  public_api_text_input_header_files = \
    $(public_api_src_dir)/controls/text-input/text-input.h
  
index 23a2da8,0000000..2dc5e72
mode 100644,000000..100644
--- /dev/null
@@@ -1,179 -1,0 +1,179 @@@
-   Impl(Internal::Control& parent)
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * 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/text/decorator/text-decorator.h>
 +
 +// EXTERNAL INCLUDES
 +#include <dali/public-api/common/constants.h>
 +#include <dali/public-api/images/image.h>
 +#include <dali/public-api/math/vector2.h>
 +#include <dali/public-api/math/vector4.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Text
 +{
 +
 +struct Decorator::Impl
 +{
 +  struct CursorImpl
 +  {
 +    CursorImpl()
 +    : x(0.0f),
 +      y(0.0f),
 +      height(0.0f),
 +      color(Dali::Color::WHITE)
 +    {
 +    }
 +
 +    float x;
 +    float y;
 +    float height;
 +
 +    Vector4 color;
 +  };
 +
- Decorator::Decorator(Internal::Control& parent)
++  Impl(Dali::Toolkit::Internal::Control& parent)
 +  : mParent(parent),
 +    mActiveCursor(ACTIVE_CURSOR_NONE),
 +    mCursorBlinkInterval(0.5f),
 +    mCursorBlinkDuration(0.0f)
 +  {
 +  }
 +
 +  void Relayout( const Vector2& size )
 +  {
 +    // TODO
 +  }
 +
 +  Internal::Control& mParent;
 +
 +  unsigned int mActiveCursor;
 +
 +  CursorImpl mCursor[CURSOR_COUNT];
 +
 +  Image mCursorImage;
 +
 +  float mCursorBlinkInterval;
 +  float mCursorBlinkDuration;
 +};
 +
 +DecoratorPtr Decorator::New(Internal::Control& parent)
 +{
 +  return DecoratorPtr( new Decorator(parent) );
 +}
 +
 +void Decorator::Relayout( const Vector2& size )
 +{
 +  mImpl->Relayout( size );
 +}
 +
 +void Decorator::SetActiveCursor( ActiveCursor activeCursor )
 +{
 +  mImpl->mActiveCursor = activeCursor;
 +}
 +
 +unsigned int Decorator::GetActiveCursor() const
 +{
 +  return mImpl->mActiveCursor;
 +}
 +
 +void Decorator::SetPosition( Cursor cursor, float x, float y, float height )
 +{
 +  mImpl->mCursor[cursor].x = x;
 +  mImpl->mCursor[cursor].y = y;
 +  mImpl->mCursor[cursor].height = height;
 +}
 +
 +void Decorator::GetPosition( Cursor cursor, float& x, float& y, float& height ) const
 +{
 +  x = mImpl->mCursor[cursor].x;
 +  y = mImpl->mCursor[cursor].y;
 +  height = mImpl->mCursor[cursor].height;
 +}
 +
 +void Decorator::SetCursorImage( Dali::Image image )
 +{
 +  mImpl->mCursorImage = image;
 +}
 +
 +Dali::Image Decorator::GetCursorImage() const
 +{
 +  return mImpl->mCursorImage;
 +}
 +
 +void Decorator::SetColor( Cursor cursor, const Dali::Vector4& color )
 +{
 +  mImpl->mCursor[cursor].color = color;
 +}
 +
 +const Dali::Vector4& Decorator::GetColor( Cursor cursor ) const
 +{
 +  return mImpl->mCursor[cursor].color;
 +}
 +
 +void Decorator::StartCursorBlink()
 +{
 +  // TODO
 +}
 +
 +void Decorator::StopCursorBlink()
 +{
 +  // TODO
 +}
 +
 +void Decorator::SetCursorBlinkInterval( float seconds )
 +{
 +  mImpl->mCursorBlinkInterval = seconds;
 +}
 +
 +float Decorator::GetCursorBlinkInterval() const
 +{
 +  return mImpl->mCursorBlinkInterval;
 +}
 +
 +void Decorator::SetCursorBlinkDuration( float seconds )
 +{
 +  mImpl->mCursorBlinkDuration = seconds;
 +}
 +
 +float Decorator::GetCursorBlinkDuration() const
 +{
 +  return mImpl->mCursorBlinkDuration;
 +}
 +
 +Decorator::~Decorator()
 +{
 +  delete mImpl;
 +}
 +
++Decorator::Decorator(Dali::Toolkit::Internal::Control& parent)
 +: mImpl( NULL )
 +{
 +  mImpl = new Decorator::Impl(parent);
 +}
 +
 +} // namespace Text
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
index e3501b1,0000000..d2d1feb
mode 100644,000000..100644
--- /dev/null
@@@ -1,222 -1,0 +1,222 @@@
-   static DecoratorPtr New( Internal::Control& parent );
 +#ifndef __DALI_TOOLKIT_TEXT_DECORATOR_H__
 +#define __DALI_TOOLKIT_TEXT_DECORATOR_H__
 +
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * 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 <dali/public-api/common/intrusive-ptr.h>
 +#include <dali/public-api/object/ref-object.h>
 +
 +namespace Dali
 +{
 +
 +class Image;
 +class Vector2;
 +class Vector4;
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal
 +{
 +class Control;
 +}
 +
 +namespace Text
 +{
 +
 +class Decorator;
 +typedef IntrusivePtr<Decorator> DecoratorPtr;
 +
 +// Used to set the cursor positions etc.
 +enum Cursor
 +{
 +  PRIMARY_CURSOR,   ///< The primary cursor for bidirectional text (or the regular cursor for single-direction text)
 +  SECONDARY_CURSOR, ///< The secondary cursor for bidirectional text
 +  CURSOR_COUNT
 +};
 +
 +// Determines which of the cursors are active (if any).
 +enum ActiveCursor
 +{
 +  ACTIVE_CURSOR_NONE,    ///< Neither primary nor secondary cursor are active
 +  ACTIVE_CURSOR_PRIMARY, ///< Primary cursor is active (only)
 +  ACTIVE_CURSOR_BOTH     ///< Both primary and secondary cursor are active
 +};
 +
 +/**
 + * @brief A Text Decorator is used to display cursors, handles, selection highlights and pop-ups.
 + *
 + * The decorator is responsible for clipping decorations which are positioned outside of the parent area.
 + * In some cases the decorations will be moved or flipped around, to maintain visibility on-screen.
 + */
 +class Decorator : public RefObject
 +{
 +public:
 +
 +  /**
 +   * @brief Create a new instance of a Decorator.
 +   *
 +   * @param[in] parent Decorations will be added to this parent control.
 +   * @return A pointer to a new Decorator.
 +   */
-   Decorator(Internal::Control& parent);
++  static DecoratorPtr New( Dali::Toolkit::Internal::Control& parent );
 +
 +  /**
 +   * @brief The decorator waits until a relayout before creating actors etc.
 +   *
 +   * @param[in] size The size of the parent control after size-negotiation.
 +   */
 +  void Relayout( const Dali::Vector2& size );
 +
 +  /**
 +   * @brief Sets which of the cursors are active.
 +   *
 +   * @note Cursor will only be visible if within the parent area.
 +   * @param[in] activeCursor Which of the cursors should be active (if any).
 +   */
 +  void SetActiveCursor( ActiveCursor activeCursor );
 +
 +  /**
 +   * @brief Sets whether a cursor should be visible.
 +   *
 +   * @return  Which of the cursors are active (if any).
 +   */
 +  unsigned int GetActiveCursor() const;
 +
 +  /**
 +   * @brief Sets the position of a cursor.
 +   *
 +   * @param[in] cursor The cursor to set.
 +   * @param[in] x The x position relative to the top-left of the parent control.
 +   * @param[in] y The y position relative to the top-left of the parent control.
 +   * @param[in] height The logical height of the cursor.
 +   */
 +  void SetPosition( Cursor cursor, float x, float y, float height );
 +
 +  /**
 +   * @brief Retrieves the position of a cursor.
 +   *
 +   * @param[in] cursor The cursor to get.
 +   * @param[out] x The x position relative to the top-left of the parent control.
 +   * @param[out] y The y position relative to the top-left of the parent control.
 +   * @param[out] height The logical height of the cursor.
 +   */
 +  void GetPosition( Cursor cursor, float& x, float& y, float& height ) const;
 +
 +  /**
 +   * @brief Sets the image for a cursor.
 +   *
 +   * @param[in] image The image to use.
 +   */
 +  void SetCursorImage( Dali::Image image );
 +
 +  /**
 +   * @brief Retrieves the image for a cursor.
 +   *
 +   * @return The cursor image.
 +   */
 +  Dali::Image GetCursorImage() const;
 +
 +  /**
 +   * @brief Sets the color for a cursor.
 +   *
 +   * @param[in] cursor Whether this color is for the primary or secondary cursor.
 +   * @param[in] color The color to use.
 +   */
 +  void SetColor( Cursor cursor, const Dali::Vector4& color );
 +
 +  /**
 +   * @brief Retrieves the color for a cursor.
 +   *
 +   * @param[in] cursor Whether this color is for the primary or secondary cursor.
 +   * @return The cursor color.
 +   */
 +  const Dali::Vector4& GetColor( Cursor cursor ) const;
 +
 +  /**
 +   * @brief Start blinking the cursor; see also SetCursorBlinkDuration().
 +   */
 +  void StartCursorBlink();
 +
 +  /**
 +   * @brief Stop blinking the cursor.
 +   */
 +  void StopCursorBlink();
 +
 +  /**
 +   * @brief Set the interval between cursor blinks.
 +   *
 +   * @param[in] seconds The interval in seconds.
 +   */
 +  void SetCursorBlinkInterval( float seconds );
 +
 +  /**
 +   * @brief Retrieves the blink-interval for a cursor.
 +   *
 +   * @return The cursor blink-interval.
 +   */
 +  float GetCursorBlinkInterval() const;
 +
 +  /**
 +   * @brief The cursor will stop blinking after this duration.
 +   *
 +   * @param[in] seconds The duration in seconds.
 +   */
 +  void SetCursorBlinkDuration( float seconds );
 +
 +  /**
 +   * @brief Retrieves the blink-duration for a cursor.
 +   *
 +   * @return The cursor blink-duration.
 +   */
 +  float GetCursorBlinkDuration() const;
 +
 +protected:
 +
 +  /**
 +   * @brief A reference counted object may only be deleted by calling Unreference().
 +   */
 +  virtual ~Decorator();
 +
 +private:
 +
 +  /**
 +   * @brief Private constructor.
 +   * @param[in] parent Decorations will be added to this parent control.
 +   */
++  Decorator(Dali::Toolkit::Internal::Control& parent);
 +
 +  // Undefined
 +  Decorator( const Decorator& handle );
 +
 +  // Undefined
 +  Decorator& operator=( const Decorator& handle );
 +
 +private:
 +
 +  struct Impl;
 +  Impl* mImpl;
 +};
 +} // namespace Text
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
 +
 +#endif // __DALI_TOOLKIT_TEXT_DECORATOR_H__
index 54444ac,0000000..7ef076f
mode 100644,000000..100644
--- /dev/null
@@@ -1,180 -1,0 +1,181 @@@
-   const Length numberOfScriptRuns = scripts.Count();
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * 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/text/shaper.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali/public-api/text-abstraction/shaping.h>
 +#include <dali-toolkit/public-api/text/font-run.h>
 +#include <dali-toolkit/public-api/text/logical-model.h>
 +#include <dali-toolkit/public-api/text/script-run.h>
 +#include <dali-toolkit/public-api/text/visual-model.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Text
 +{
 +
 +CharacterIndex min( CharacterIndex index0,
 +                    CharacterIndex index1 )
 +{
 +  return ( index0 < index1 ) ? index0 : index1;
 +}
 +
 +void ShapeText( const Vector<Character>& text,
 +                const Vector<LineBreakInfo>& lineBreakInfo,
 +                const Vector<ScriptRun>& scripts,
 +                const Vector<FontRun>& fonts,
 +                Vector<GlyphInfo>& glyphs,
 +                Vector<CharacterIndex>& characterIndices,
 +                Vector<Length>& charactersPerGlyph )
 +{
 +  const Length numberOfCharacters = text.Count();
 +
 +  if( 0u == numberOfCharacters )
 +  {
 +    // Nothing to do if there are no characters.
 +    return;
 +  }
 +
++#ifdef DEBUG_ENABLED
 +  const Length numberOfFontRuns = fonts.Count();
++  const Length numberOfScriptRuns = scripts.Count();
++#endif
 +
 +  DALI_ASSERT_DEBUG( ( 0u != numberOfFontRuns ) &&
 +                     ( numberOfCharacters == fonts[numberOfFontRuns - 1u].characterRun.characterIndex + fonts[numberOfFontRuns - 1u].characterRun.numberOfCharacters ) &&
 +                     "Toolkit::Text::ShapeText. All characters must have a font set." );
 +
 +  DALI_ASSERT_DEBUG( ( 0u != numberOfScriptRuns ) &&
 +                     ( numberOfCharacters == scripts[numberOfScriptRuns - 1u].characterRun.characterIndex + scripts[numberOfScriptRuns - 1u].characterRun.numberOfCharacters ) &&
 +                     "Toolkit::Text::ShapeText. All characters must have a script set." );
 +
 +  // The text needs to be split in chunks of consecutive characters.
 +  // Each chunk must contain characters with the same font id and script set.
 +  // A chunk of consecutive characters must not contain a LINE_MUST_BREAK, if there is one a new chunk have to be created.
 +
 +  TextAbstraction::Shaping shaping = TextAbstraction::Shaping::Get();
 +
 +  // To shape the text a font and an script is needed.
 +  Vector<FontRun>::ConstIterator fontRunIt = fonts.Begin();
 +  Vector<ScriptRun>::ConstIterator scriptRunIt = scripts.Begin();
 +
 +  // The line must break token converted to LineBreakInfo to be compared and avoid a compile error.
 +  const LineBreakInfo MUST_BREAK = static_cast<LineBreakInfo>( TextAbstraction::LINE_MUST_BREAK );
 +
 +  // Index to the the next one to be shaped. Is pointing the character after the last one it was shaped.
 +  CharacterIndex previousIndex = 0u;
 +
 +  // The current font id and script used to shape the text.
 +  FontId currentFontId = 0u;
 +  Script currentScript = TextAbstraction::UNKNOWN;
 +
 +  // Reserve some space to allocate the glyphs and the glyph to character map.
 +  // There is no way to know the number of glyphs before shaping the text.
 +  // To avoid reallocations it's reserved space for a slightly biger number of glyphs than the number of characters.
 +
 +  Length numberOfGlyphsReserved = static_cast<Length>( numberOfCharacters * 1.3f );
 +  glyphs.Resize( numberOfGlyphsReserved );
 +  charactersPerGlyph.Resize( numberOfGlyphsReserved );
 +
 +  // The actual number of glyphs.
 +  Length totalNumberOfGlyphs = 0u;
 +
 +  // Traverse the characters and shape the text.
 +  for( previousIndex = 0; previousIndex < numberOfCharacters; )
 +  {
 +    // Get the font id and the script.
 +    const FontRun& fontRun = *fontRunIt;
 +    const ScriptRun& scriptRun = *scriptRunIt;
 +
 +    currentFontId = fontRun.fontId;
 +    currentScript = scriptRun.script;
 +
 +    // Get the min index to the last character of both runs.
 +    CharacterIndex currentIndex = min( fontRun.characterRun.characterIndex + fontRun.characterRun.numberOfCharacters,
 +                                       scriptRun.characterRun.characterIndex + scriptRun.characterRun.numberOfCharacters );
 +
 +    // Check if there is a line must break.
 +    for( CharacterIndex index = previousIndex; index < currentIndex; ++index )
 +    {
 +      if( MUST_BREAK == lineBreakInfo.Begin() + index )
 +      {
 +        currentIndex = index;
 +        break;
 +      }
 +    }
 +
 +    // Shape the text for the current chunk.
 +    const Length numberOfGlyphs = shaping.Shape( text.Begin() + previousIndex,
 +                                                 currentIndex - previousIndex,
 +                                                 currentFontId,
 +                                                 currentScript );
 +
 +    const Length glyphIndex = totalNumberOfGlyphs;
 +    totalNumberOfGlyphs += numberOfGlyphs;
 +
 +    if( totalNumberOfGlyphs > numberOfGlyphsReserved )
 +    {
 +      // Resize the vectors to get enough space.
 +      numberOfGlyphsReserved = static_cast<Length>( totalNumberOfGlyphs * 1.3f );
 +      glyphs.Resize( numberOfGlyphsReserved );
 +      charactersPerGlyph.Resize( numberOfGlyphsReserved );
 +    }
 +
 +    // Retrieve the glyphs and the glyph to character conversion map.
 +    shaping.GetGlyphs( glyphs.Begin() + glyphIndex,
 +                       charactersPerGlyph.Begin() + glyphIndex );
 +
 +    // Update the iterators to get the next font or script run.
 +    if( currentIndex == fontRun.characterRun.characterIndex + fontRun.characterRun.numberOfCharacters )
 +    {
 +      ++fontRunIt;
 +    }
 +    if( currentIndex == scriptRun.characterRun.characterIndex + scriptRun.characterRun.numberOfCharacters )
 +    {
 +      ++scriptRunIt;
 +    }
 +
 +    // Update the previous index.
 +    previousIndex = currentIndex;
 +  }
 +
 +  characterIndices.Reserve( totalNumberOfGlyphs );
 +  CharacterIndex characterIndex = 0u;
 +  characterIndices.PushBack( characterIndex );
 +  for( Length index = 0u, length = totalNumberOfGlyphs - 1u; index < length; ++index )
 +  {
 +    characterIndex += *( charactersPerGlyph.Begin() + index );
 +    characterIndices.PushBack( characterIndex );
 +  }
 +
 +  // Resize the vectors to set the right number of items.
 +  glyphs.Resize( totalNumberOfGlyphs );
 +  // characterIndices.Resize( totalNumberOfGlyphs );
 +  charactersPerGlyph.Resize( totalNumberOfGlyphs );
 +}
 +
 +} // namespace Text
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
Simple merge