Merge "Fix bug with mixed language text" into devel/master
authorDavid Steele <david.steele@samsung.com>
Thu, 7 Dec 2017 14:29:17 +0000 (14:29 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 7 Dec 2017 14:29:18 +0000 (14:29 +0000)
58 files changed:
automated-tests/resources/demo-tile-texture-focused.9.png [new file with mode: 0644]
automated-tests/resources/folder_appicon_empty_bg.png [new file with mode: 0644]
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.cpp
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dummy-visual.h
automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h
automated-tests/src/dali-toolkit/utc-Dali-Control.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp
build/tizen/dali-toolkit/Makefile.am
dali-toolkit/devel-api/controls/text-controls/text-label-devel.h [new file with mode: 0644]
dali-toolkit/devel-api/file.list
dali-toolkit/devel-api/text/text-enumerations-devel.h [new file with mode: 0644]
dali-toolkit/devel-api/visuals/image-visual-actions-devel.h [new file with mode: 0644]
dali-toolkit/devel-api/visuals/image-visual-properties-devel.h
dali-toolkit/internal/controls/control/control-data-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/image/image-visual.h
dali-toolkit/internal/visuals/npatch/npatch-visual.cpp
dali-toolkit/internal/visuals/npatch/npatch-visual.h
dali-toolkit/internal/visuals/texture-manager-impl.cpp
dali-toolkit/internal/visuals/texture-manager-impl.h
dali-toolkit/internal/visuals/visual-base-impl.cpp
dali-toolkit/internal/visuals/visual-base-impl.h
dali-toolkit/internal/visuals/visual-factory-cache.h
dali-toolkit/internal/visuals/visual-string-constants.cpp
dali-toolkit/internal/visuals/visual-string-constants.h
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control.h
dali-toolkit/public-api/controls/progress-bar/progress-bar.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/public-api/visuals/border-visual-properties.h
dali-toolkit/public-api/visuals/color-visual-properties.h
dali-toolkit/public-api/visuals/gradient-visual-properties.h
dali-toolkit/public-api/visuals/image-visual-properties.h
dali-toolkit/public-api/visuals/mesh-visual-properties.h
dali-toolkit/public-api/visuals/primitive-visual-properties.h
dali-toolkit/public-api/visuals/text-visual-properties.h
dali-toolkit/public-api/visuals/visual-properties.h
dali-toolkit/styles/1920x1080/images/cursor_handler_drop_center.png
dali-toolkit/styles/1920x1080/images/selection_handle_drop_left.png
dali-toolkit/styles/1920x1080/images/selection_handle_drop_right.png
dali-toolkit/styles/360x360/dali-toolkit-default-theme.json [new file with mode: 0644]
dali-toolkit/styles/360x360/images/cursor_handler_drop_center.png [new file with mode: 0644]
dali-toolkit/styles/360x360/images/selection_handle_drop_left.png [new file with mode: 0644]
dali-toolkit/styles/360x360/images/selection_handle_drop_right.png [new file with mode: 0644]
dali-toolkit/styles/360x360/images/tw_bottom_btn_bg.png [new file with mode: 0755]
packaging/dali-toolkit.spec

diff --git a/automated-tests/resources/demo-tile-texture-focused.9.png b/automated-tests/resources/demo-tile-texture-focused.9.png
new file mode 100644 (file)
index 0000000..3236edd
Binary files /dev/null and b/automated-tests/resources/demo-tile-texture-focused.9.png differ
diff --git a/automated-tests/resources/folder_appicon_empty_bg.png b/automated-tests/resources/folder_appicon_empty_bg.png
new file mode 100644 (file)
index 0000000..32a47a5
Binary files /dev/null and b/automated-tests/resources/folder_appicon_empty_bg.png differ
index f5c5aeb..d792609 100644 (file)
@@ -70,7 +70,7 @@ void DummyVisual::DoSetOnStage( Actor& actor )
   // Implement if required
 }
 
-void DummyVisual::OnDoAction( const Property::Index actionName, const Property::Value attributes )
+void DummyVisual::OnDoAction( const Property::Index actionName, const Property::Value& attributes )
 {
   if ( DummyVisual::TEST_ACTION == actionName )
   {
index 73e8185..23334ba 100644 (file)
@@ -80,7 +80,7 @@ protected:
   virtual void DoSetProperties( const Property::Map& propertyMap ) override;
   virtual void OnSetTransform() override;
   virtual void DoSetOnStage( Actor& actor ) override;
-  virtual void OnDoAction( const Property::Index actionName, const Property::Value attributes );
+  virtual void OnDoAction( const Property::Index actionName, const Property::Value& attributes ) override;
 
 private:
   unsigned int mActionCounter;
index c2161d1..e09dd06 100644 (file)
@@ -61,7 +61,8 @@ int UtcTextureManagerRequestLoad(void)
     SamplingMode::BOX_THEN_LINEAR,
     TextureManager::NO_ATLAS,
     &observer,
-    true );
+    true,
+    TextureManager::ReloadPolicy::CACHED );
 
   const VisualUrl& url = textureManager.GetVisualUrl( textureId );
 
index 5e843c2..96699ec 100644 (file)
@@ -192,6 +192,7 @@ Property::Value DummyControlImpl::GetProperty( BaseObject* object, Dali::Propert
   return value;
 }
 
+
 Toolkit::DummyControl Impl::DummyControl::New()
 {
   IntrusivePtr< Toolkit::Impl::DummyControl > impl = new Toolkit::Impl::DummyControl;
@@ -300,6 +301,23 @@ void Impl::DummyControl::SetRelayoutCallback( RelayoutCallbackFunc callback  )
   mRelayoutCallback = callback;
 }
 
+Vector3 Impl::DummyControl::GetNaturalSize()
+{
+  Vector2 currentSize;
+
+  for( auto elem : mRegisteredVisualIndices )
+  {
+    Vector2 naturalSize;
+    Visual::Base visual = GetVisual(elem);
+    visual.GetNaturalSize( naturalSize );
+    currentSize.width = std::max( naturalSize.width, currentSize.width );
+    currentSize.height = std::max( naturalSize.height, currentSize.height );
+  }
+
+  return Vector3( currentSize );
+}
+
+
 
 DummyControl DummyControl::New( bool override )
 {
index 69a5c88..5988284 100644 (file)
@@ -162,6 +162,7 @@ private: // From Internal::Control
   virtual void OnPan(const PanGesture& pan);
   virtual void OnTap(const TapGesture& tap);
   virtual void OnLongPress(const LongPressGesture& longPress);
+  virtual Vector3 GetNaturalSize();
 
 private: // From CustomActorImpl
 
index 9869f21..d695e92 100755 (executable)
@@ -27,6 +27,9 @@
 #include <dali-toolkit/public-api/align-enumerations.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-actions-devel.h>
+
+
 #include <toolkit-event-thread-callback.h>
 
 #include "dummy-control.h"
@@ -952,3 +955,96 @@ int UtcDaliControlPaddingProperty(void)
 
   END_TEST;
 }
+
+int UtcDaliControlDoAction(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "DoAction on a visual registered with a control" );
+
+  // Set up trace debug
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable( true );
+
+  //Created AnimatedImageVisual
+  VisualFactory factory = VisualFactory::Get();
+  Visual::Base imageVisual = factory.CreateVisual( TEST_IMAGE_FILE_NAME, ImageDimensions() );
+
+  DummyControl dummyControl = DummyControl::New(true);
+  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual );
+  dummyControl.SetSize(200.f, 200.f);
+  Stage::GetCurrent().Add( dummyControl );
+
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
+  textureTrace.Reset();
+
+  Property::Map attributes;
+  DevelControl::DoAction( dummyControl,  DummyControl::Property::TEST_VISUAL, DevelImageVisual::Action::RELOAD, attributes );
+
+  tet_infoline( "Perform RELOAD action. should reload Image and generate a texture" );
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliControlDoActionWhenNotStage(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "DoAction on a visual registered with a control but not staged" );
+
+  // Set up trace debug
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable( true );
+
+  //Created AnimatedImageVisual
+  VisualFactory factory = VisualFactory::Get();
+  Visual::Base imageVisual = factory.CreateVisual( TEST_IMAGE_FILE_NAME, ImageDimensions() );
+
+  DummyControl dummyControl = DummyControl::New(true);
+  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
+
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual );
+  dummyControl.SetSize(200.f, 200.f);
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
+  textureTrace.Reset();
+
+  Property::Map attributes;
+  DevelControl::DoAction( dummyControl,  DummyControl::Property::TEST_VISUAL, DevelImageVisual::Action::RELOAD, attributes );
+
+  tet_infoline( "Perform RELOAD action. should reload Image and generate a texture" );
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
+  textureTrace.Reset();
+
+  tet_infoline( "Adding control to stage will in turn add the visual to the stage" );
+
+  Stage::GetCurrent().Add( dummyControl );
+  application.SendNotification();
+  application.Render();
+  tet_infoline( "No change in textures could occurs as already loaded and cached texture will be used" );
+
+  DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
+  textureTrace.Reset();
+
+  END_TEST;
+}
index 6d4c3e3..487ae20 100644 (file)
@@ -118,8 +118,14 @@ const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
 
 const int KEY_A_CODE = 38;
 const int KEY_D_CODE = 40;
+const int KEY_C_CODE = 54;
+const int KEY_V_CODE = 55;
+const int KEY_X_CODE = 53;
 const int KEY_WHITE_SPACE_CODE = 65;
 
+const int KEY_SHIFT_MODIFIER = 257;
+const int KEY_CONTROL_MODIFIER = 258;
+
 const char* HANDLE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/insertpoint-icon.png";
 
 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
@@ -2035,6 +2041,113 @@ int utcDaliTextEditorEvent06(void)
   application.SendNotification();
   application.Render();
 
+  application.ProcessEvent( GenerateKey( "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
+
+  application.ProcessEvent( GenerateKey( "", "", Dali::DevelKey::DALI_KEY_CONTROL_RIGHT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.SendNotification();
+  application.Render();
+
+  END_TEST;
+}
+
+int utcDaliTextEditorEvent07(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextEditorEvent07");
+
+  // Checks if the highlight actor is created.
+
+  TextEditor editor = TextEditor::New();
+  DALI_TEST_CHECK( editor );
+
+  Stage::GetCurrent().Add( editor );
+
+  editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworld\nHello world" );
+  editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+  editor.SetSize( 100.f, 50.f );
+  editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Tap on the text editor
+  application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+  application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Move to second line of the text.
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Select some text in the right of the current cursor position
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Cut the selected text
+  application.ProcessEvent( GenerateKey( "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "x", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( "Hello\nld\nHello world", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
+  // Select some text in the left of the current cursor position
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Copy the selected text
+  application.ProcessEvent( GenerateKey( "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "c", "c", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Move the cursor to the third line
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Paste the selected text at the current cursor position
+  application.ProcessEvent( GenerateKey( "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "v", "v", KEY_V_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( "Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
   END_TEST;
 }
 
index 659eb54..45214f8 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -1125,3 +1127,55 @@ int UtcDaliToolkitTextlabelTextStyle01(void)
 
   END_TEST;
 }
+
+int UtcDaliToolkitTextlabelMultiline(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitTextlabelMultiline");
+
+  TextLabel label = TextLabel::New();
+  label.SetProperty( TextLabel::Property::TEXT, "Hello world Hello world Hello world Hello world Hello world Hello world" );
+  label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
+  label.SetProperty( TextLabel::Property::MULTI_LINE, false );
+  Stage::GetCurrent().Add( label );
+
+  application.SendNotification();
+  application.Render();
+
+  int lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
+  DALI_TEST_EQUALS( lineCount, 1, TEST_LOCATION );
+
+  label.SetProperty( TextLabel::Property::MULTI_LINE, true );
+
+  application.SendNotification();
+  application.Render();
+
+  lineCount =  label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
+  DALI_TEST_EQUALS( true, (lineCount > 1) , TEST_LOCATION );
+
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextlabelTextDirection(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
+
+  TextLabel label = TextLabel::New();
+  label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
+  label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
+  Stage::GetCurrent().Add( label );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+
+  label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+
+  END_TEST;
+}
index af56d92..b1f2e2e 100644 (file)
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 #include <dali-toolkit/devel-api/visuals/animated-gradient-visual-properties-devel.h>
 #include <dali-toolkit/dali-toolkit.h>
+
 #include "dummy-control.h"
 
 using namespace Dali;
@@ -36,12 +38,13 @@ namespace
 {
 const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif";
 const char* TEST_IMAGE_FILE_NAME =  TEST_RESOURCE_DIR "/gallery-small-1.jpg";
-const char* TEST_NPATCH_FILE_NAME =  "gallery_image_01.9.jpg";
+const char* TEST_NPATCH_FILE_NAME =  TEST_RESOURCE_DIR "/button-up.9.png";
 const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
 const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
 const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
 const char* TEST_RESOURCE_LOCATION = TEST_RESOURCE_DIR "/";
 
+
 const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
 
 Property::Map DefaultTransform()
@@ -764,6 +767,8 @@ int UtcDaliVisualGetPropertyMap6(void)
   propertyMap.Insert( ImageVisual::Property::URL,  TEST_NPATCH_FILE_NAME );
   propertyMap.Insert( ImageVisual::Property::BORDER_ONLY,  true );
   propertyMap.Insert( ImageVisual::Property::BORDER, border );
+  propertyMap.Insert( DevelImageVisual::Property::AUXILIARY_IMAGE, "application-icon-30.png" );
+  propertyMap.Insert( DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA, 0.9f );
   Visual::Base nPatchVisual = factory.CreateVisual( propertyMap );
 
   Property::Map resultMap;
@@ -790,6 +795,14 @@ int UtcDaliVisualGetPropertyMap6(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get< Rect< int > >() == border );
 
+  value = resultMap.Find( DevelImageVisual::Property::AUXILIARY_IMAGE, Property::STRING );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get<std::string>() == "application-icon-30.png" );
+
+  value = resultMap.Find( DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA, Property::FLOAT );
+  DALI_TEST_CHECK( value );
+  DALI_TEST_CHECK( value->Get<float>() == 0.9f );
+
   Vector4 border1( 1.0f, 1.0f, 1.0f, 1.0f );
 
   Property::Map propertyMap1;
index 950b3e1..54a45a3 100644 (file)
@@ -20,8 +20,9 @@
 #include <toolkit-timer.h>
 #include <toolkit-event-thread-callback.h>
 #include <dali/devel-api/images/nine-patch-image.h>
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 #include "dummy-control.h"
 
 using namespace Dali;
@@ -31,12 +32,13 @@ namespace
 {
 typedef NinePatchImage::StretchRanges StretchRanges;
 
-const char* TEST_NPATCH_FILE_NAME =  TEST_RESOURCE_DIR  "/button-up-1.9.png";
+const char* TEST_NPATCH_FILE_NAME =  TEST_RESOURCE_DIR  "/demo-tile-texture-focused.9.png";
 const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
 const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
 const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
 const char* TEST_SIMPLE_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube-Points-Only.obj";
 const char* TEST_SIMPLE_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal-Simple.mtl";
+const char* TEST_AUX_IMAGE = TEST_RESOURCE_DIR "/folder_appicon_empty_bg.png";
 
 // resolution: 50*50, frame count: 4, frame delay: 0.2 second for each frame
 const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif";
@@ -837,7 +839,11 @@ int UtcDaliVisualFactoryGetNPatchVisual5(void)
   stretchRangesY.PushBack( Uint16Pair( 8, 12 ) );
   stretchRangesY.PushBack( Uint16Pair( 15, 16 ) );
   stretchRangesY.PushBack( Uint16Pair( 25, 27 ) );
-  Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application, ninePatchImageWidth, ninePatchImageHeight, stretchRangesX, stretchRangesY );
+  Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application,
+                                                                       ninePatchImageWidth,
+                                                                       ninePatchImageHeight,
+                                                                       stretchRangesX,
+                                                                       stretchRangesY );
 
   Visual::Base visual = factory.CreateVisual( TEST_NPATCH_FILE_NAME, ImageDimensions() );
   DALI_TEST_CHECK( visual );
@@ -856,6 +862,65 @@ int UtcDaliVisualFactoryGetNPatchVisual5(void)
   END_TEST;
 }
 
+
+int UtcDaliNPatchVisualAuxiliaryImage(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "NPatchVisual with aux image" );
+
+  VisualFactory factory = VisualFactory::Get();
+  Property::Map properties;
+  Property::Map shader;
+
+  Property::Map transformMap;
+  transformMap["size"] = Vector2( 0.5f, 0.5f ) ;
+  transformMap["offset"] = Vector2( 20.0f, 0.0f ) ;
+  transformMap["offsetPolicy"] = Vector2( Visual::Transform::Policy::ABSOLUTE, Visual::Transform::Policy::ABSOLUTE );
+  transformMap["anchorPoint"] = Align::CENTER;
+  transformMap["origin"] = Align::CENTER;
+  properties[Visual::Property::TRANSFORM] = transformMap;
+
+  properties[Visual::Property::TYPE] = Visual::IMAGE;
+  properties[Visual::Property::MIX_COLOR] = Color::BLUE;
+  properties[Visual::Property::SHADER]=shader;
+  properties[ImageVisual::Property::URL] = TEST_NPATCH_FILE_NAME;
+  properties[DevelImageVisual::Property::AUXILIARY_IMAGE] = TEST_AUX_IMAGE;
+  properties[DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA] = 0.9f;
+
+  const unsigned int ninePatchImageWidth =  256;
+  const unsigned int ninePatchImageHeight = 256;
+  StretchRanges stretchRangesX;
+  stretchRangesX.PushBack( Uint16Pair( 10, 246 ) );
+  StretchRanges stretchRangesY;
+  stretchRangesY.PushBack( Uint16Pair( 15, 241 ) );
+  Integration::ResourcePointer ninePatchResource = CustomizeNinePatch( application,
+                                                                       ninePatchImageWidth,
+                                                                       ninePatchImageHeight,
+                                                                       stretchRangesX,
+                                                                       stretchRangesY );
+
+  Visual::Base visual = factory.CreateVisual( properties );
+
+  // trigger creation through setting on stage
+  DummyControl dummy = DummyControl::New(true);
+  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
+  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+  dummyImpl.SetLayout( DummyControl::Property::TEST_VISUAL, transformMap );
+  dummy.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+  dummy.SetParentOrigin(ParentOrigin::CENTER);
+  Stage::GetCurrent().Add(dummy);
+  application.SendNotification();
+  application.Render();
+
+  Renderer renderer = dummy.GetRendererAt( 0 );
+  auto textures = renderer.GetTextures();
+  DALI_TEST_EQUALS( textures.GetTextureCount(), 2, TEST_LOCATION );
+
+
+  END_TEST;
+}
+
+
 int UtcDaliVisualFactoryGetNPatchVisualN1(void)
 {
   //This should still load but display an error image
index 35534a0..542d064 100644 (file)
@@ -151,6 +151,7 @@ develapitransitioneffectsdir =  $(develapidir)/transition-effects
 develapitoolbardir =            $(develapicontrolsdir)/tool-bar
 develapitooltipdir =            $(develapicontrolsdir)/tooltip
 develapitextselectionpopupdir = $(develapicontrolsdir)/text-controls
+develapitextdir =               $(develapidir)/text
 develapivisualfactorydir =      $(develapidir)/visual-factory
 develapivisualsdir =            $(develapidir)/visuals
 
@@ -180,6 +181,7 @@ develapitoolbar_HEADERS =           $(devel_api_tool_bar_header_files)
 develapitooltip_HEADERS =           $(devel_api_tooltip_header_files)
 develapitransitioneffects_HEADERS = $(devel_api_transition_effects_header_files)
 develapitextselectionpopup_HEADERS = $(devel_api_text_controls_header_files)
+develapitext_HEADERS =              $(devel_api_text_header_files)
 
 # public api source
 publicapidir =                     $(topleveldir)/public-api
diff --git a/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h
new file mode 100644 (file)
index 0000000..2838a00
--- /dev/null
@@ -0,0 +1,84 @@
+#ifndef DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
+#define DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
+
+/*
+ * Copyright (c) 2017 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-controls/text-label.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelTextLabel
+{
+
+namespace Property
+{
+  enum Type
+  {
+    RENDERING_BACKEND = Dali::Toolkit::TextLabel::Property::RENDERING_BACKEND,
+    TEXT = Dali::Toolkit::TextLabel::Property::TEXT,
+    FONT_FAMILY = Dali::Toolkit::TextLabel::Property::FONT_FAMILY,
+    FONT_STYLE = Dali::Toolkit::TextLabel::Property::FONT_STYLE,
+    POINT_SIZE = Dali::Toolkit::TextLabel::Property::POINT_SIZE,
+    MULTI_LINE = Dali::Toolkit::TextLabel::Property::MULTI_LINE,
+    HORIZONTAL_ALIGNMENT = Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT,
+    VERTICAL_ALIGNMENT = Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT,
+    UNUSED_PROPERTY_TEXT_COLOR = Dali::Toolkit::TextLabel::Property::UNUSED_PROPERTY_TEXT_COLOR,
+    SHADOW_OFFSET = Dali::Toolkit::TextLabel::Property::SHADOW_OFFSET,
+    SHADOW_COLOR = Dali::Toolkit::TextLabel::Property::SHADOW_COLOR,
+    UNDERLINE_ENABLED = Dali::Toolkit::TextLabel::Property::UNDERLINE_ENABLED,
+    UNDERLINE_COLOR = Dali::Toolkit::TextLabel::Property::UNDERLINE_COLOR,
+    UNDERLINE_HEIGHT = Dali::Toolkit::TextLabel::Property::UNDERLINE_HEIGHT,
+    ENABLE_MARKUP = Dali::Toolkit::TextLabel::Property::ENABLE_MARKUP,
+    ENABLE_AUTO_SCROLL = Dali::Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL,
+    AUTO_SCROLL_SPEED = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED,
+    AUTO_SCROLL_LOOP_COUNT = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_COUNT,
+    AUTO_SCROLL_GAP = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_GAP,
+    LINE_SPACING = Dali::Toolkit::TextLabel::Property::LINE_SPACING,
+    UNDERLINE = Dali::Toolkit::TextLabel::Property::UNDERLINE,
+    SHADOW = Dali::Toolkit::TextLabel::Property::SHADOW,
+    EMBOSS = Dali::Toolkit::TextLabel::Property::EMBOSS,
+    OUTLINE = Dali::Toolkit::TextLabel::Property::OUTLINE,
+    PIXEL_SIZE = Dali::Toolkit::TextLabel::Property::PIXEL_SIZE,
+    ELLIPSIS = Dali::Toolkit::TextLabel::Property::ELLIPSIS,
+    AUTO_SCROLL_LOOP_DELAY = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_DELAY,
+    AUTO_SCROLL_STOP_MODE = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_STOP_MODE,
+    LINE_COUNT = Dali::Toolkit::TextLabel::Property::LINE_COUNT,
+    LINE_WRAP_MODE = Dali::Toolkit::TextLabel::Property::LINE_WRAP_MODE,
+
+    /**
+     * @brief The direction of the layout.
+     * @details Name "textDirection", type Property::Integer, Read-Only.
+     * @see TextDirection::Type for supported values.
+     */
+    TEXT_DIRECTION,
+  };
+
+} // namespace Property
+
+} // namespace DevelTextLabel
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
index 275e14d..3f114bb 100644 (file)
@@ -92,6 +92,7 @@ devel_api_visual_factory_header_files = \
 
 devel_api_visuals_header_files = \
   $(devel_api_src_dir)/visuals/image-visual-properties-devel.h \
+  $(devel_api_src_dir)/visuals/image-visual-actions-devel.h \
   $(devel_api_src_dir)/visuals/animated-gradient-visual-properties-devel.h \
   $(devel_api_src_dir)/visuals/visual-properties-devel.h
 
@@ -128,9 +129,13 @@ devel_api_super_blur_view_header_files = \
 
 devel_api_text_controls_header_files = \
   $(devel_api_src_dir)/controls/text-controls/text-editor-devel.h \
+  $(devel_api_src_dir)/controls/text-controls/text-label-devel.h \
   $(devel_api_src_dir)/controls/text-controls/text-selection-popup.h \
   $(devel_api_src_dir)/controls/text-controls/text-selection-toolbar.h
 
+devel_api_text_header_files = \
+  $(devel_api_src_dir)/text/text-enumerations-devel.h
+
 devel_api_tool_bar_header_files = \
   $(devel_api_src_dir)/controls/tool-bar/tool-bar.h
 
diff --git a/dali-toolkit/devel-api/text/text-enumerations-devel.h b/dali-toolkit/devel-api/text/text-enumerations-devel.h
new file mode 100644 (file)
index 0000000..5062417
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H
+#define DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H
+
+/*
+ * Copyright (c) 2017 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.
+ *
+ */
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelText
+{
+
+namespace TextDirection
+{
+
+enum Type
+{
+  LEFT_TO_RIGHT,
+  RIGHT_TO_LEFT
+};
+
+} // namespace TextDirection
+
+} // namespace DevelText
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif //DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H
diff --git a/dali-toolkit/devel-api/visuals/image-visual-actions-devel.h b/dali-toolkit/devel-api/visuals/image-visual-actions-devel.h
new file mode 100644 (file)
index 0000000..f76e772
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef DALI_TOOLKIT_DEVEL_API_VISUALS_IMAGE_VISUAL_ACTIONS_DEVEL_H
+#define DALI_TOOLKIT_DEVEL_API_VISUALS_IMAGE_VISUAL_ACTIONS_DEVEL_H
+
+/*
+ * Copyright (c) 2017 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.
+ *
+ */
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelImageVisual
+{
+
+/**
+ * @brief Actions that the image visual can perform.  These actions are called through the Visual::Base::DoAction API.
+ */
+namespace Action
+{
+/**
+ * @brief The available actions for this visual
+ */
+enum Type
+{
+  RELOAD = 0,  ///< Force reloading of the image, all visuals using this image will get the latest one.
+};
+
+} // namespace Actions
+
+} // namespace DevelImageVisual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_DEVEL_API_VISUALS_IMAGE_VISUAL_ACTIONS_DEVEL_H
index acb9b11..e87af5d 100644 (file)
@@ -112,6 +112,26 @@ enum Type
    * @note Default true
    */
   ORIENTATION_CORRECTION = CROP_TO_MASK + 3,
+
+  /**
+   * @brief Overlays the auxiliary iamge on top of an NPatch image.
+   *
+   * The resulting visual image will be at least as large as the
+   * smallest possible n-patch or the auxiliary image, whichever is
+   * larger.
+   *
+   * @details Name "auxiliaryImage", Type Property::STRING, URL of the image.
+   * @note Default true
+   */
+  AUXILIARY_IMAGE = CROP_TO_MASK + 4,
+
+  /**
+   * @brief An alpha value for mixing between the masked main NPatch image and the auxiliary image
+   * @details Name "auxiliaryImageAlpha", Type Property::FLOAT, between 0 and 1
+   * @note Default 0
+   */
+  AUXILIARY_IMAGE_ALPHA = CROP_TO_MASK + 5,
+
 };
 
 } //namespace Property
index 187e62f..b061268 100644 (file)
@@ -486,9 +486,6 @@ void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base
 
   if( !visualReplaced ) // New registration entry
   {
-    // monitor when the visual resources are ready
-    StartObservingVisual( visual );
-
     // If we've not set the depth-index value, we have more than one visual and the visual does not have a depth index, then set it to be the highest
     if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
         ( mVisuals.Size() > 0 ) &&
index 94957db..cd96e00 100644 (file)
@@ -44,6 +44,8 @@
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+
 using namespace Dali::Toolkit::Text;
 
 namespace Dali
@@ -113,6 +115,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit,           TextLabel, "autoScrollLoopDelay",
 DALI_PROPERTY_REGISTRATION( Toolkit,           TextLabel, "autoScrollStopMode",        STRING,  AUTO_SCROLL_STOP_MODE      )
 DALI_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount",                 INTEGER, LINE_COUNT                 )
 DALI_PROPERTY_REGISTRATION( Toolkit,           TextLabel, "lineWrapMode",              INTEGER, LINE_WRAP_MODE             )
+DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "textDirection",       INTEGER, TEXT_DIRECTION             )
 DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( Toolkit, TextLabel, "textColor",      Color::BLACK,     TEXT_COLOR     )
 DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit,    TextLabel, "textColorRed",   TEXT_COLOR_RED,   TEXT_COLOR, 0  )
 DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit,    TextLabel, "textColorGreen", TEXT_COLOR_GREEN, TEXT_COLOR, 1  )
@@ -750,6 +753,14 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde
         }
         break;
       }
+      case Toolkit::DevelTextLabel::Property::TEXT_DIRECTION:
+      {
+        if( impl.mController )
+        {
+          value = impl.mController->GetTextDirection();
+        }
+        break;
+      }
     }
   }
 
index c1eb0e4..874503d 100644 (file)
@@ -1151,6 +1151,9 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event )
   }
 
   int keyCode = event.p1.mInt;
+  bool isShiftModifier = event.p2.mBool;
+
+  CharacterIndex previousPrimaryCursorPosition = mEventData->mPrimaryCursorPosition;
 
   if( Dali::DALI_KEY_CURSOR_LEFT == keyCode )
   {
@@ -1166,8 +1169,10 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event )
       mEventData->mPrimaryCursorPosition = CalculateNewCursorIndex( mEventData->mPrimaryCursorPosition );
     }
   }
-  else if( Dali::DALI_KEY_CURSOR_UP == keyCode )
+  else if( Dali::DALI_KEY_CURSOR_UP == keyCode && !isShiftModifier )
   {
+    // Ignore Shift-Up for text selection for now.
+
     // Get first the line index of the current cursor position index.
     CharacterIndex characterIndex = 0u;
 
@@ -1200,8 +1205,10 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event )
                                                                       CharacterHitTest::TAP,
                                                                       matchedCharacter );
   }
-  else if( Dali::DALI_KEY_CURSOR_DOWN == keyCode )
+  else if( Dali::DALI_KEY_CURSOR_DOWN == keyCode && !isShiftModifier )
   {
+    // Ignore Shift-Down for text selection for now.
+
     // Get first the line index of the current cursor position index.
     CharacterIndex characterIndex = 0u;
 
@@ -1237,7 +1244,64 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event )
     }
   }
 
-  mEventData->mUpdateCursorPosition = true;
+  if ( !isShiftModifier && mEventData->mState != EventData::SELECTING )
+  {
+    // Update selection position after moving the cursor
+    mEventData->mLeftSelectionPosition = mEventData->mPrimaryCursorPosition;
+    mEventData->mRightSelectionPosition = mEventData->mPrimaryCursorPosition;
+  }
+
+  if ( isShiftModifier && IsShowingRealText() )
+  {
+    // Handle text selection
+    bool selecting = false;
+
+    if ( Dali::DALI_KEY_CURSOR_LEFT == keyCode || Dali::DALI_KEY_CURSOR_RIGHT == keyCode )
+    {
+      // Shift-Left/Right to select the text
+      int cursorPositionDelta = mEventData->mPrimaryCursorPosition - previousPrimaryCursorPosition;
+      if ( cursorPositionDelta > 0 || mEventData->mRightSelectionPosition > 0u ) // Check the boundary
+      {
+        mEventData->mRightSelectionPosition += cursorPositionDelta;
+      }
+      selecting = true;
+    }
+    else if ( mEventData->mLeftSelectionPosition != mEventData->mRightSelectionPosition )
+    {
+      // Show no grab handles and text highlight if Shift-Up/Down pressed but no selected text
+      selecting = true;
+    }
+
+    if ( selecting )
+    {
+      // Notify the cursor position to the imf manager.
+      if( mEventData->mImfManager )
+      {
+        mEventData->mImfManager.SetCursorPosition( mEventData->mPrimaryCursorPosition );
+        mEventData->mImfManager.NotifyCursorPosition();
+      }
+
+      ChangeState( EventData::SELECTING );
+
+      mEventData->mUpdateLeftSelectionPosition = true;
+      mEventData->mUpdateRightSelectionPosition = true;
+      mEventData->mUpdateGrabHandlePosition = true;
+      mEventData->mUpdateHighlightBox = true;
+
+      // Hide the text selection popup if select the text using keyboard instead of moving grab handles
+      if( mEventData->mGrabHandlePopupEnabled )
+      {
+        mEventData->mDecorator->SetPopupActive( false );
+      }
+    }
+  }
+  else
+  {
+    // Handle normal cursor move
+    ChangeState( EventData::EDITING );
+    mEventData->mUpdateCursorPosition = true;
+  }
+
   mEventData->mUpdateInputStyle = true;
   mEventData->mScrollAfterUpdatePosition = true;
 }
@@ -1277,6 +1341,10 @@ void Controller::Impl::OnTapEvent( const Event& event )
         mEventData->mPrimaryCursorPosition = 0u;
       }
 
+      // Update selection position after tapping
+      mEventData->mLeftSelectionPosition = mEventData->mPrimaryCursorPosition;
+      mEventData->mRightSelectionPosition = mEventData->mPrimaryCursorPosition;
+
       mEventData->mUpdateCursorPosition = true;
       mEventData->mUpdateGrabHandlePosition = true;
       mEventData->mScrollAfterUpdatePosition = true;
index 44d1a7d..a5de151 100644 (file)
@@ -64,6 +64,7 @@ struct Event
     int mInt;
     unsigned int mUint;
     float mFloat;
+    bool mBool;
   };
 
   Event( Type eventType )
index 0a951cc..1c15e22 100755 (executable)
@@ -49,6 +49,10 @@ const float MAX_FLOAT = std::numeric_limits<float>::max();
 
 const std::string EMPTY_STRING("");
 
+const std::string KEY_C_NAME = "c";
+const std::string KEY_V_NAME = "v";
+const std::string KEY_X_NAME = "x";
+
 const char * const PLACEHOLDER_TEXT = "text";
 const char * const PLACEHOLDER_TEXT_FOCUSED = "textFocused";
 const char * const PLACEHOLDER_COLOR = "color";
@@ -347,6 +351,7 @@ void Controller::SetMultiLineEnabled( bool enable )
                                                                           ALIGN              |
                                                                           REORDER );
 
+    mImpl->mTextUpdateInfo.mFullRelayoutNeeded = true;
     mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | layoutOperations );
 
     mImpl->RequestRelayout();
@@ -2098,6 +2103,17 @@ void Controller::GetPlaceholderProperty( Property::Map& map )
   }
 }
 
+Toolkit::DevelText::TextDirection::Type Controller::GetTextDirection()
+{
+  const LineRun* const firstline = mImpl->mModel->mVisualModel->mLines.Begin();
+  if ( firstline && firstline->direction )
+  {
+    return Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT;
+  }
+
+  return Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT;
+}
+
 // public : Relayout.
 
 Controller::UpdateTextType Controller::Relayout( const Size& size )
@@ -2321,6 +2337,7 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
   {
     int keyCode = keyEvent.keyCode;
     const std::string& keyString = keyEvent.keyPressed;
+    const std::string keyName = keyEvent.keyPressedName;
 
     const bool isNullKey = ( 0 == keyCode ) && ( keyString.empty() );
 
@@ -2366,11 +2383,43 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
       mImpl->mEventData->mCheckScrollAmount = true;
       Event event( Event::CURSOR_KEY_EVENT );
       event.p1.mInt = keyCode;
+      event.p2.mBool = keyEvent.IsShiftModifier();
       mImpl->mEventData->mEventQueue.push_back( event );
 
       // Will request for relayout.
       relayoutNeeded = true;
     }
+    else if ( Dali::DevelKey::DALI_KEY_CONTROL_LEFT == keyCode || Dali::DevelKey::DALI_KEY_CONTROL_RIGHT == keyCode )
+    {
+      // Left or Right Control key event is received before Ctrl-C/V/X key event is received
+      // If not handle it here, any selected text will be deleted
+
+      // Do nothing
+      return false;
+    }
+    else if ( keyEvent.IsCtrlModifier() )
+    {
+      bool consumed = false;
+      if (keyName == KEY_C_NAME)
+      {
+        // Ctrl-C to copy the selected text
+        TextPopupButtonTouched( Toolkit::TextSelectionPopup::COPY );
+        consumed = true;
+      }
+      else if (keyName == KEY_V_NAME)
+      {
+        // Ctrl-V to paste the copied text
+        TextPopupButtonTouched( Toolkit::TextSelectionPopup::PASTE );
+        consumed = true;
+      }
+      else if (keyName == KEY_X_NAME)
+      {
+        // Ctrl-X to cut the selected text
+        TextPopupButtonTouched( Toolkit::TextSelectionPopup::CUT );
+        consumed = true;
+      }
+      return consumed;
+    }
     else if( ( Dali::DALI_KEY_BACKSPACE == keyCode ) ||
              ( Dali::DevelKey::DALI_KEY_DELETE == keyCode ) )
     {
@@ -3542,6 +3591,10 @@ void Controller::ProcessModifyEvents()
   {
     // When the text is being modified, delay cursor blinking
     mImpl->mEventData->mDecorator->DelayCursorBlink();
+
+    // Update selection position after modifying the text
+    mImpl->mEventData->mLeftSelectionPosition = mImpl->mEventData->mPrimaryCursorPosition;
+    mImpl->mEventData->mRightSelectionPosition = mImpl->mEventData->mPrimaryCursorPosition;
   }
 
   // Discard temporary text
index d5ec2ae..07d91be 100755 (executable)
@@ -25,6 +25,8 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
 #include <dali-toolkit/internal/text/hidden-text.h>
@@ -1154,6 +1156,12 @@ public: // Queries & retrieves.
    */
   void GetPlaceholderProperty( Property::Map& map );
 
+  /**
+   * @brief Checks text direction.
+   * @return The text direction.
+   */
+  Toolkit::DevelText::TextDirection::Type GetTextDirection();
+
 public: // Relayout.
 
   /**
index 32f2bc0..03dbcbc 100644 (file)
@@ -105,7 +105,7 @@ void FixedImageCache::LoadBatch()
     mImageUrls[ mUrlIndex ].mTextureId =
       mTextureManager.RequestLoad( url, ImageDimensions(), FittingMode::SCALE_TO_FILL,
                                    SamplingMode::BOX_THEN_LINEAR, TextureManager::NO_ATLAS,
-                                   this, ENABLE_ORIENTATION_CORRECTION );
+                                   this, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED  );
     mRequestingLoad = false;
     ++mUrlIndex;
   }
index 847e681..9c3f82f 100644 (file)
@@ -142,7 +142,7 @@ void RollingImageCache::LoadBatch()
     mImageUrls[ imageFrame.mUrlIndex ].mTextureId =
       mTextureManager.RequestLoad( url, ImageDimensions(), FittingMode::SCALE_TO_FILL,
                                    SamplingMode::BOX_THEN_LINEAR, TextureManager::NO_ATLAS,
-                                   this, ENABLE_ORIENTATION_CORRECTION );
+                                   this, ENABLE_ORIENTATION_CORRECTION, TextureManager::ReloadPolicy::CACHED );
     mRequestingLoad = false;
   }
 
index 9afcb29..8845541 100644 (file)
@@ -33,6 +33,7 @@
 // INTERNAL HEADERS
 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-actions-devel.h>
 #include <dali-toolkit/internal/visuals/texture-manager-impl.h>
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
@@ -411,12 +412,12 @@ void ImageVisual::DoSetProperties( const Property::Map& propertyMap )
       }
     }
   }
-
   // Load image immediately if LOAD_POLICY requires it
   if ( mLoadPolicy == DevelImageVisual::LoadPolicy::IMMEDIATE )
   {
-    auto attemptAtlasing = mAttemptAtlasing;
-    LoadTexture( attemptAtlasing, mAtlasRect, mTextures, mOrientationCorrection );
+    auto attemptAtlasing = AttemptAtlasing();
+    LoadTexture( attemptAtlasing, mAtlasRect, mTextures, mOrientationCorrection,
+                 TextureManager::ReloadPolicy::CACHED  );
   }
 }
 
@@ -759,7 +760,8 @@ bool ImageVisual::IsSynchronousResourceLoading() const
   return mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
 }
 
-void ImageVisual::LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection )
+void ImageVisual::LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection,
+                               TextureManager::ReloadPolicy forceReload )
 {
   TextureManager& textureManager = mFactoryCache.GetTextureManager();
 
@@ -776,28 +778,35 @@ void ImageVisual::LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& t
   textures = textureManager.LoadTexture( mImageUrl, mDesiredSize, mFittingMode, mSamplingMode,
                                          mMaskingData, IsSynchronousResourceLoading(), mTextureId,
                                          atlasRect, atlasing, mLoading, mWrapModeU,
-                                         mWrapModeV, textureObserver, atlasUploadObserver, atlasManager, mOrientationCorrection );
+                                         mWrapModeV, textureObserver, atlasUploadObserver, atlasManager,
+                                         mOrientationCorrection,
+                                         forceReload );
+
+  if( atlasing ) // Flag needs to be set before creating renderer
+  {
+    mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
+  }
+  else
+  {
+    mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
+  }
 }
 
-void ImageVisual::InitializeRenderer()
+bool ImageVisual::AttemptAtlasing()
 {
-  auto attemptAtlasing = ( ! mImpl->mCustomShader && mImageUrl.GetProtocolType() == VisualUrl::LOCAL && mAttemptAtlasing );
+  return ( ! mImpl->mCustomShader && mImageUrl.GetProtocolType() == VisualUrl::LOCAL && mAttemptAtlasing );
+}
 
+void ImageVisual::InitializeRenderer()
+{
+  auto attemptAtlasing = AttemptAtlasing();
   // texture set has to be created first as we need to know if atlasing succeeded or not
   // when selecting the shader
 
   if( mTextureId == TextureManager::INVALID_TEXTURE_ID && ! mTextures ) // Only load the texture once
   {
-    LoadTexture( attemptAtlasing, mAtlasRect, mTextures, mOrientationCorrection );
-  }
-
-  if( attemptAtlasing ) // Flag needs to be set before creating renderer
-  {
-    mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
-  }
-  else
-  {
-    mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
+    LoadTexture( attemptAtlasing, mAtlasRect, mTextures, mOrientationCorrection,
+                 TextureManager::ReloadPolicy::CACHED );
   }
 
   CreateRenderer( mTextures );
@@ -960,6 +969,22 @@ void ImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
   }
 }
 
+void ImageVisual::OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes )
+{
+  // Check if action is valid for this visual type and perform action if possible
+
+  switch ( actionName )
+  {
+    case DevelImageVisual::Action::RELOAD:
+    {
+      auto attemptAtlasing = AttemptAtlasing();
+      LoadTexture( attemptAtlasing, mAtlasRect, mTextures, mOrientationCorrection,
+                   TextureManager::ReloadPolicy::FORCED );
+      break;
+    }
+  }
+}
+
 void ImageVisual::OnSetTransform()
 {
   if( mImpl->mRenderer )
@@ -1031,7 +1056,8 @@ void ImageVisual::ApplyImageToSampler( const Image& image )
 // From existing atlas manager
 void ImageVisual::UploadCompleted()
 {
-  // Texture has been uploaded. If weak handle is holding a placement actor, it is the time to add the renderer to actor.
+  // Texture has been uploaded. If weak handle is holding a placement actor,
+  // it is the time to add the renderer to actor.
   Actor actor = mPlacementActor.GetHandle();
   if( actor )
   {
@@ -1046,7 +1072,8 @@ void ImageVisual::UploadCompleted()
 }
 
 // From Texture Manager
-void ImageVisual::UploadComplete( bool loadingSuccess, int32_t textureId, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle )
+void ImageVisual::UploadComplete( bool loadingSuccess, int32_t textureId, TextureSet textureSet, bool usingAtlas,
+                                  const Vector4& atlasRectangle )
 {
   Toolkit::Visual::ResourceStatus resourceStatus;
   Actor actor = mPlacementActor.GetHandle();
index 729185a..3108b55 100644 (file)
@@ -177,6 +177,11 @@ public:  // from Visual
    */
   virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
 
+  /**
+   * @copydoc Visual::Base::OnDoAction
+   */
+  virtual void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override;
+
 protected:
 
   /**
@@ -222,12 +227,12 @@ protected:
   /**
    * @copydoc Visual::Base::DoSetOffStage
    */
-  virtual void DoSetOffStage( Actor& actor );
+  virtual void DoSetOffStage( Actor& actor ) ;
 
   /**
    * @copydoc Visual::Base::OnSetTransform
    */
-  virtual void OnSetTransform();
+  virtual void OnSetTransform() ;
 
   /**
    * @copydoc Visual::Base::IsResourceReady
@@ -280,8 +285,15 @@ private:
    * @param[out] atlasRect if atlasing is used this the texture area of the image in the atlas.
    * @param[out] textures resulting texture set from the image loading.
    * @param[in] orientationCorrection flag determines if orientation correction should be performed
+   * @param[in] forceReload flag determines if the texture should be reloaded from its source or use the cached texture.
+   */
+  void LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection, TextureManager::ReloadPolicy forceReload );
+
+  /**
+   * @brief Checks if atlasing should be attempted
+   * @return bool returns true if atlasing can be attempted.
    */
-  void LoadTexture( bool& atlasing, Vector4& atlasRect, TextureSet& textures, bool orientationCorrection );
+  bool AttemptAtlasing();
 
   /**
    * @brief Initializes the Dali::Renderer from the image url
index d5976dd..33a4842 100755 (executable)
 // EXTERNAL INCLUDES
 #include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/images/resource-image.h>
+#include <dali/devel-api/object/handle-devel.h>
 #include <dali/devel-api/images/texture-set-image.h>
+#include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
 #include <dali-toolkit/internal/visuals/npatch-loader.h>
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
@@ -47,6 +50,8 @@ namespace
 {
 const char * const BORDER_ONLY( "borderOnly" );
 const char * const BORDER( "border" );
+const char * const AUXILIARY_IMAGE_NAME( "auxiliaryImage" );
+const char * const AUXILIARY_IMAGE_ALPHA_NAME( "auxiliaryImageAlpha" );
 
 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
   attribute mediump vec2 aPosition;\n
@@ -57,7 +62,7 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
   uniform mediump vec2 uNinePatchFactorsY[ FACTOR_SIZE_Y ];\n
   \n
 
-  //Visual size and offset
+  // Visual size and offset
   uniform mediump vec2 offset;\n
   uniform mediump vec2 size;\n
   uniform mediump vec4 offsetSizeMode;\n
@@ -72,16 +77,17 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
     mediump vec2 fixedTotal   = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].x, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].x );\n
     mediump vec2 stretchTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].y, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].y );\n
     \n
-
     vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
     vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-
-    mediump vec4 vertexPosition = vec4( ( fixedFactor + ( visualSize.xy - fixedTotal ) * stretch / stretchTotal ) +  anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+    \n
+    mediump vec4 gridPosition = vec4( fixedFactor + ( visualSize.xy - fixedTotal ) * stretch / stretchTotal, 0.0, 1.0 );\n
+    mediump vec4 vertexPosition = gridPosition;\n
     vertexPosition.xy -= visualSize.xy * vec2( 0.5, 0.5 );\n
-
+    vertexPostion.xy += anchorPoint*visualSize + (visualOffset + origin)*uSize.xy;\n
     vertexPosition = uMvpMatrix * vertexPosition;\n
     \n
     vTexCoord = ( fixedFactor + stretch ) / ( fixedTotal + stretchTotal );\n
+    vMaskTexCoord = gridPosition.xy / visualSize;\n
     \n
     gl_Position = vertexPosition;\n
   }\n
@@ -90,39 +96,41 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
 const char* VERTEX_SHADER_3X3 = DALI_COMPOSE_SHADER(
     attribute mediump vec2 aPosition;\n
     varying mediump vec2 vTexCoord;\n
+    varying mediump vec2 vMaskTexCoord;\n
     uniform mediump mat4 uModelMatrix;\n
     uniform mediump mat4 uMvpMatrix;\n
     uniform mediump vec3 uSize;\n
     uniform mediump vec2 uFixed[ 3 ];\n
     uniform mediump vec2 uStretchTotal;\n
     \n
-
     //Visual size and offset
     uniform mediump vec2 offset;\n
     uniform mediump vec2 size;\n
     uniform mediump vec4 offsetSizeMode;\n
     uniform mediump vec2 origin;\n
     uniform mediump vec2 anchorPoint;\n
-
+    \n
     void main()\n
     {\n
       vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
       vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
-
+      \n
       mediump vec2 size         = visualSize.xy;\n
       \n
       mediump vec2 fixedFactor  = vec2( uFixed[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uFixed[ int( ( aPosition.y  + 1.0 ) * 0.5 ) ].y );\n
       mediump vec2 stretch      = floor( aPosition * 0.5 );\n
       mediump vec2 fixedTotal   = uFixed[ 2 ];\n
       \n
-      mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );
+      mediump vec4 gridPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );\n
+      mediump vec4 vertexPosition = gridPosition;\n
       vertexPosition.xy -= size * vec2( 0.5, 0.5 );\n
-      vertexPosition.xy =  vertexPosition.xy + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
+      vertexPosition.xy += anchorPoint*size + (visualOffset + origin)*uSize.xy;\n
       \n
       vertexPosition = uMvpMatrix * vertexPosition;\n
       \n
       vTexCoord = ( fixedFactor + stretch * uStretchTotal ) / ( fixedTotal + uStretchTotal );\n
       \n
+      vMaskTexCoord = gridPosition.xy / size;\n
       gl_Position = vertexPosition;\n
     }\n
 );
@@ -144,6 +152,36 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
   }\n
 );
 
+const char* FRAGMENT_MASK_SHADER = DALI_COMPOSE_SHADER(
+  varying mediump vec2 vTexCoord;\n
+  varying mediump vec2 vMaskTexCoord;\n
+  uniform sampler2D sTexture;\n
+  uniform sampler2D sMask;\n
+  uniform lowp vec4 uColor;\n
+  uniform lowp vec3 mixColor;\n
+  uniform lowp float opacity;\n
+  uniform lowp float preMultipliedAlpha;\n
+  uniform mediump float auxiliaryImageAlpha;\n
+  lowp vec4 visualMixColor()\n
+  {\n
+    return vec4( mixColor * mix( 1.0, opacity, preMultipliedAlpha ), opacity );\n
+  }\n
+  void main()\n
+  {\n
+      // Where mask image is transparent, all of background image must show through.
+      // where mask image is opaque, only mask should be shown
+      // where mask is translucent, less of background should be shown.
+      // auxiliaryImageAlpha controls how much of mask is visible
+
+      mediump vec4 color = texture2D( sTexture, vTexCoord );\n
+      mediump vec4 mask  = texture2D( sMask, vMaskTexCoord );\n
+
+      mediump vec3 mixedColor = color.rgb * mix( 1.0-mask.a, 1.0, 1.0-auxiliaryImageAlpha)
+                                + mask.rgb*mask.a * auxiliaryImageAlpha;\n
+      gl_FragColor = vec4(mixedColor,1.0) * uColor * visualMixColor();\n
+  }\n
+);
+
 /**
  * @brief Creates the geometry formed from the vertices and indices
  *
@@ -256,22 +294,41 @@ NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchIm
   return nPatchVisual;
 }
 
+void NPatchVisual::LoadImages()
+{
+  if( NPatchLoader::UNINITIALIZED_ID == mId && mImageUrl.IsLocalResource() )
+  {
+    mId = mLoader.Load( mImageUrl.GetUrl(), mBorder );
+  }
+
+  if( ! mAuxiliaryPixelBuffer && mAuxiliaryUrl.IsValid() && mAuxiliaryUrl.IsLocalResource() )
+  {
+    // Load the auxiliary image synchronously
+    mAuxiliaryPixelBuffer = Dali::LoadImageFromFile( mAuxiliaryUrl.GetUrl(), ImageDimensions(),
+                                                     FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true );
+  }
+}
+
 void NPatchVisual::GetNaturalSize( Vector2& naturalSize )
 {
   naturalSize.x = 0u;
   naturalSize.y = 0u;
 
   // load now if not already loaded
-  if( NPatchLoader::UNINITIALIZED_ID == mId && mImageUrl.IsLocalResource() )
-  {
-    mId = mLoader.Load( mImageUrl.GetUrl(), mBorder );
-  }
+  LoadImages();
+
   const NPatchLoader::Data* data;
   if( mLoader.GetNPatchData( mId, data ) )
   {
     naturalSize.x = data->croppedWidth;
     naturalSize.y = data->croppedHeight;
   }
+
+  if( mAuxiliaryPixelBuffer )
+  {
+    naturalSize.x = std::max( naturalSize.x, float(mAuxiliaryPixelBuffer.GetWidth()) );
+    naturalSize.y = std::max( naturalSize.y, float(mAuxiliaryPixelBuffer.GetHeight()) );
+  }
 }
 
 void NPatchVisual::DoSetProperties( const Property::Map& propertyMap )
@@ -297,15 +354,28 @@ void NPatchVisual::DoSetProperties( const Property::Map& propertyMap )
       mBorder.top = static_cast< int >( border.w );
     }
   }
+
+  Property::Value* auxImage = propertyMap.Find( Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE, AUXILIARY_IMAGE_NAME );
+  if( auxImage )
+  {
+    std::string url;
+    if( auxImage->Get( url ) )
+    {
+      mAuxiliaryUrl = url;
+    }
+  }
+
+  Property::Value* auxImageAlpha = propertyMap.Find( Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA, AUXILIARY_IMAGE_ALPHA_NAME );
+  if( auxImageAlpha )
+  {
+    auxImageAlpha->Get( mAuxiliaryImageAlpha );
+  }
 }
 
 void NPatchVisual::DoSetOnStage( Actor& actor )
 {
   // load when first go on stage
-  if( NPatchLoader::UNINITIALIZED_ID == mId && mImageUrl.IsLocalResource() )
-  {
-    mId = mLoader.Load( mImageUrl.GetUrl(), mBorder );
-  }
+  LoadImages();
 
   Geometry geometry = CreateGeometry();
   Shader shader = CreateShader();
@@ -340,20 +410,32 @@ void NPatchVisual::DoCreatePropertyMap( Property::Map& map ) const
   map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl.GetUrl() );
   map.Insert( Toolkit::ImageVisual::Property::BORDER_ONLY, mBorderOnly );
   map.Insert( Toolkit::ImageVisual::Property::BORDER, mBorder );
+
+  if( mAuxiliaryUrl.IsValid() )
+  {
+    map.Insert( Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE, mAuxiliaryUrl.GetUrl() );
+    map.Insert( Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA, mAuxiliaryImageAlpha );
+  }
 }
 
 void NPatchVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
 {
-  // Do nothing
+  if( mAuxiliaryUrl.IsValid() )
+  {
+    map.Insert( Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE, mAuxiliaryUrl.GetUrl() );
+    map.Insert( Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA, mAuxiliaryImageAlpha );
+  }
 }
 
 NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache )
 : Visual::Base( factoryCache ),
   mLoader( factoryCache.GetNPatchLoader() ),
   mImageUrl(),
+  mAuxiliaryUrl(),
   mId( NPatchLoader::UNINITIALIZED_ID ),
   mBorderOnly( false ),
-  mBorder()
+  mBorder(),
+  mAuxiliaryImageAlpha( 0.0f )
 {
 }
 
@@ -401,6 +483,11 @@ Shader NPatchVisual::CreateShader()
   NinePatchImage::StretchRanges::SizeType xStretchCount = 0;
   NinePatchImage::StretchRanges::SizeType yStretchCount = 0;
 
+  auto fragmentShader = mAuxiliaryPixelBuffer ? FRAGMENT_MASK_SHADER
+                                              : FRAGMENT_SHADER;
+  auto shaderType = mAuxiliaryPixelBuffer ? VisualFactoryCache::NINE_PATCH_MASK_SHADER
+                                          : VisualFactoryCache::NINE_PATCH_SHADER;
+
   // ask loader for the regions
   if( mLoader.GetNPatchData( mId, data ) )
   {
@@ -413,11 +500,12 @@ Shader NPatchVisual::CreateShader()
     if( DALI_LIKELY( ( xStretchCount == 1 && yStretchCount == 1 ) ||
                      ( xStretchCount == 0 && yStretchCount == 0 ) ) )
     {
-      shader = mFactoryCache.GetShader( VisualFactoryCache::NINE_PATCH_SHADER );
+      shader = mFactoryCache.GetShader( shaderType );
       if( DALI_UNLIKELY( !shader ) )
       {
-        shader = Shader::New( VERTEX_SHADER_3X3, FRAGMENT_SHADER );
-        mFactoryCache.SaveShader( VisualFactoryCache::NINE_PATCH_SHADER, shader );
+        shader = Shader::New( VERTEX_SHADER_3X3, fragmentShader );
+        // Only cache vanilla 9 patch shaders
+        mFactoryCache.SaveShader( shaderType, shader );
       }
     }
     else if( xStretchCount > 0 || yStretchCount > 0)
@@ -427,12 +515,11 @@ Shader NPatchVisual::CreateShader()
                    << "#define FACTOR_SIZE_Y " << yStretchCount + 2 << "\n"
                    << VERTEX_SHADER;
 
-      shader = Shader::New( vertexShader.str(), FRAGMENT_SHADER );
+      shader = Shader::New( vertexShader.str(), fragmentShader );
     }
   }
   else
   {
-    const char* fragmentShader = FRAGMENT_SHADER;
     Dali::Shader::Hint::Value hints = Dali::Shader::Hint::NONE;
 
     if( !mImpl->mCustomShader->mFragmentShader.empty() )
@@ -470,10 +557,12 @@ Shader NPatchVisual::CreateShader()
 void NPatchVisual::ApplyTextureAndUniforms()
 {
   const NPatchLoader::Data* data;
+  TextureSet textureSet;
+
   if( mLoader.GetNPatchData( mId, data ) )
   {
-    TextureSet textures( data->textureSet );
-    mImpl->mRenderer.SetTextures( textures );
+    textureSet = data->textureSet;
+
     if( data->stretchPixelsX.Size() == 1 && data->stretchPixelsY.Size() == 1 )
     {
       //special case for 9 patch
@@ -500,8 +589,8 @@ void NPatchVisual::ApplyTextureAndUniforms()
   else
   {
     DALI_LOG_ERROR("The N patch image '%s' is not a valid N patch image\n", mImageUrl.GetUrl().c_str() );
-    TextureSet textureSet = TextureSet::New();
-    mImpl->mRenderer.SetTextures( textureSet );
+    textureSet = TextureSet::New();
+
     Image croppedImage = VisualFactoryCache::GetBrokenVisualImage();
     TextureSetImage( textureSet, 0u, croppedImage );
     mImpl->mRenderer.RegisterProperty( "uFixed[0]", Vector2::ZERO );
@@ -510,7 +599,31 @@ void NPatchVisual::ApplyTextureAndUniforms()
     mImpl->mRenderer.RegisterProperty( "uStretchTotal", Vector2( croppedImage.GetWidth(), croppedImage.GetHeight() ) );
   }
 
-  //Register transform properties
+  if( mAuxiliaryPixelBuffer )
+  {
+    // If the auxiliary image is smaller than the un-stretched NPatch, use CPU resizing to enlarge it to the
+    // same size as the unstretched NPatch. This will give slightly higher quality results than just relying
+    // on GL interpolation alone.
+    if( mAuxiliaryPixelBuffer.GetWidth() < data->croppedWidth &&
+        mAuxiliaryPixelBuffer.GetHeight() < data->croppedHeight )
+    {
+      mAuxiliaryPixelBuffer.Resize( data->croppedWidth, data->croppedHeight );
+    }
+
+    // Note, this resets mAuxiliaryPixelBuffer handle
+    auto auxiliaryPixelData = Devel::PixelBuffer::Convert( mAuxiliaryPixelBuffer );
+
+    auto texture = Texture::New( TextureType::TEXTURE_2D,
+                                 auxiliaryPixelData.GetPixelFormat(), auxiliaryPixelData.GetWidth(),
+                                 auxiliaryPixelData.GetHeight() );
+    texture.Upload( auxiliaryPixelData );
+    textureSet.SetTexture( 1, texture );
+    DevelHandle::RegisterProperty( mImpl->mRenderer, DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA,
+                                   AUXILIARY_IMAGE_ALPHA_NAME, mAuxiliaryImageAlpha );
+  }
+  mImpl->mRenderer.SetTextures( textureSet );
+
+  // Register transform properties
   mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
 }
 
index 901211d..d10e687 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_N_PATCH_VISUAL_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -53,7 +53,8 @@ typedef IntrusivePtr< NPatchVisual > NPatchVisualPtr;
  * | url                      | STRING           |
  * | borderOnly               | BOOLEAN          |
  * | border                   | RECTANGLE        |
- *
+ * | auxiliaryImage           | STRING           |
+ * | auxiliaryImageAlpha      | FLOAT            |
  */
 class NPatchVisual: public Visual::Base
 {
@@ -144,6 +145,11 @@ protected:
 private:
 
   /**
+   * Loads the NPatch image and the Auxiliary image if needed
+   */
+  void LoadImages();
+
+  /**
    * @brief Creates a geometry for this renderer's grid size
    *
    * @return Returns the created geometry for this renderer's grid size
@@ -202,11 +208,14 @@ private:
 
 private:
 
-  NPatchLoader& mLoader;      ///< reference to N patch loader for fast access
-  VisualUrl mImageUrl;        ///< The url to the N patch to load
-  std::size_t mId;            ///< id of the N patch (from loader/cache)
-  bool mBorderOnly;           ///< if only border is desired
-  Rect< int > mBorder;        ///< The size of the border
+  NPatchLoader&      mLoader;               ///< reference to N patch loader for fast access
+  VisualUrl          mImageUrl;             ///< The url to the N patch to load
+  VisualUrl          mAuxiliaryUrl;         ///< An auxiliary image that can be displayed on top of the N-Patch
+  std::size_t        mId;                   ///< id of the N patch (from loader/cache)
+  Devel::PixelBuffer mAuxiliaryPixelBuffer; ///< pixel buffer of the auxiliary mask image
+  bool               mBorderOnly;           ///< if only border is desired
+  Rect<int>          mBorder;               ///< The size of the border
+  float              mAuxiliaryImageAlpha;  ///< The alpha value for the auxiliary image only
 };
 
 } // namespace Internal
index 308b1ee..b2e0d03 100644 (file)
@@ -108,7 +108,8 @@ TextureSet TextureManager::LoadTexture(
     bool synchronousLoading, TextureManager::TextureId& textureId, Vector4& textureRect,
     bool& atlasingStatus, bool& loadingStatus, Dali::WrapMode::Type wrapModeU,
     Dali::WrapMode::Type wrapModeV, TextureUploadObserver* textureObserver,
-    AtlasUploadObserver* atlasObserver, ImageAtlasManagerPtr imageAtlasManager, bool orientationCorrection )
+    AtlasUploadObserver* atlasObserver, ImageAtlasManagerPtr imageAtlasManager, bool orientationCorrection,
+    TextureManager::ReloadPolicy reloadPolicy )
 {
   TextureSet textureSet;
 
@@ -135,7 +136,8 @@ TextureSet TextureManager::LoadTexture(
     PixelData data;
     if( url.IsValid() )
     {
-      Devel::PixelBuffer pixelBuffer = LoadImageFromFile( url.GetUrl(), desiredSize, fittingMode, samplingMode, orientationCorrection  );
+      Devel::PixelBuffer pixelBuffer = LoadImageFromFile( url.GetUrl(), desiredSize, fittingMode, samplingMode,
+                                       orientationCorrection  );
       if( pixelBuffer )
       {
         data = Devel::PixelBuffer::Convert(pixelBuffer); // takes ownership of buffer
@@ -185,7 +187,8 @@ TextureSet TextureManager::LoadTexture(
       atlasingStatus = false;
       if( !maskInfo )
       {
-        textureId = RequestLoad( url, desiredSize, fittingMode, samplingMode, TextureManager::NO_ATLAS, textureObserver, orientationCorrection );
+        textureId = RequestLoad( url, desiredSize, fittingMode, samplingMode, TextureManager::NO_ATLAS,
+                                 textureObserver, orientationCorrection, reloadPolicy );
       }
       else
       {
@@ -197,7 +200,8 @@ TextureSet TextureManager::LoadTexture(
                                  TextureManager::NO_ATLAS,
                                  maskInfo->mCropToMask,
                                  textureObserver,
-                                 orientationCorrection);
+                                 orientationCorrection,
+                                 reloadPolicy );
       }
 
       TextureManager::LoadState loadState = GetTextureState( textureId );
@@ -222,67 +226,80 @@ TextureSet TextureManager::LoadTexture(
 }
 
 TextureManager::TextureId TextureManager::RequestLoad(
-  const VisualUrl&         url,
-  const ImageDimensions    desiredSize,
-  FittingMode::Type        fittingMode,
-  Dali::SamplingMode::Type samplingMode,
-  const UseAtlas           useAtlas,
-  TextureUploadObserver*   observer,
-  bool                     orientationCorrection )
+  const VisualUrl&            url,
+  const ImageDimensions       desiredSize,
+  FittingMode::Type           fittingMode,
+  Dali::SamplingMode::Type    samplingMode,
+  const UseAtlas              useAtlas,
+  TextureUploadObserver*      observer,
+  bool                        orientationCorrection,
+  TextureManager::ReloadPolicy reloadPolicy )
 {
-  return RequestLoadInternal( url, INVALID_TEXTURE_ID, 1.0f, desiredSize, fittingMode, samplingMode, useAtlas, false, UPLOAD_TO_TEXTURE, observer, orientationCorrection );
+  return RequestLoadInternal( url, INVALID_TEXTURE_ID, 1.0f, desiredSize, fittingMode, samplingMode, useAtlas,
+                              false, UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy );
 }
 
 TextureManager::TextureId TextureManager::RequestLoad(
-  const VisualUrl&         url,
-  TextureId                maskTextureId,
-  float                    contentScale,
-  const ImageDimensions    desiredSize,
-  FittingMode::Type        fittingMode,
-  Dali::SamplingMode::Type samplingMode,
-  const UseAtlas           useAtlas,
-  bool                     cropToMask,
-  TextureUploadObserver*   observer,
-  bool                     orientationCorrection )
-{
-  return RequestLoadInternal( url, maskTextureId, contentScale, desiredSize, fittingMode, samplingMode, useAtlas, cropToMask, UPLOAD_TO_TEXTURE, observer, orientationCorrection );
+  const VisualUrl&             url,
+  TextureId                    maskTextureId,
+  float                        contentScale,
+  const ImageDimensions        desiredSize,
+  FittingMode::Type            fittingMode,
+  Dali::SamplingMode::Type     samplingMode,
+  const UseAtlas               useAtlas,
+  bool                         cropToMask,
+  TextureUploadObserver*       observer,
+  bool                         orientationCorrection,
+  TextureManager::ReloadPolicy reloadPolicy )
+{
+  return RequestLoadInternal( url, maskTextureId, contentScale, desiredSize, fittingMode, samplingMode, useAtlas,
+                              cropToMask, UPLOAD_TO_TEXTURE, observer, orientationCorrection, reloadPolicy );
 }
 
 TextureManager::TextureId TextureManager::RequestMaskLoad( const VisualUrl& maskUrl )
 {
   // Use the normal load procedure to get the alpha mask.
-  return RequestLoadInternal( maskUrl, INVALID_TEXTURE_ID, 1.0f, ImageDimensions(), FittingMode::SCALE_TO_FILL, SamplingMode::NO_FILTER, NO_ATLAS, false, KEEP_PIXEL_BUFFER, NULL, true );
+  return RequestLoadInternal( maskUrl, INVALID_TEXTURE_ID, 1.0f, ImageDimensions(), FittingMode::SCALE_TO_FILL,
+                              SamplingMode::NO_FILTER, NO_ATLAS, false, KEEP_PIXEL_BUFFER, NULL, true,
+                              TextureManager::ReloadPolicy::CACHED );
 }
 
 TextureManager::TextureId TextureManager::RequestLoadInternal(
-  const VisualUrl&         url,
-  TextureId                maskTextureId,
-  float                    contentScale,
-  const ImageDimensions    desiredSize,
-  FittingMode::Type        fittingMode,
-  Dali::SamplingMode::Type samplingMode,
-  UseAtlas                 useAtlas,
-  bool                     cropToMask,
-  StorageType              storageType,
-  TextureUploadObserver*   observer,
-  bool                     orientationCorrection )
+  const VisualUrl&               url,
+  TextureId                       maskTextureId,
+  float                           contentScale,
+  const ImageDimensions           desiredSize,
+  FittingMode::Type               fittingMode,
+  Dali::SamplingMode::Type        samplingMode,
+  UseAtlas                        useAtlas,
+  bool                            cropToMask,
+  StorageType                     storageType,
+  TextureUploadObserver*          observer,
+  bool                            orientationCorrection,
+  TextureManager::ReloadPolicy    reloadPolicy )
 {
   // First check if the requested Texture is cached.
-  const TextureHash textureHash = GenerateHash( url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas, maskTextureId );
+  const TextureHash textureHash = GenerateHash( url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas,
+                                                maskTextureId );
 
   TextureManager::TextureId textureId = INVALID_TEXTURE_ID;
 
   // Look up the texture by hash. Note: The extra parameters are used in case of a hash collision.
-  int cacheIndex = FindCachedTexture( textureHash, url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas, maskTextureId );
+  int cacheIndex = FindCachedTexture( textureHash, url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas,
+                                      maskTextureId );
 
   // Check if the requested Texture exists in the cache.
   if( cacheIndex != INVALID_CACHE_INDEX )
   {
-    // Mark this texture being used by another client resource.
-    ++( mTextureInfoContainer[ cacheIndex ].referenceCount );
+    if ( TextureManager::ReloadPolicy::CACHED == reloadPolicy )
+    {
+      // Mark this texture being used by another client resource. Forced reload would replace the current texture
+      // without the need for incrementing the reference count.
+      ++( mTextureInfoContainer[ cacheIndex ].referenceCount );
+    }
     textureId = mTextureInfoContainer[ cacheIndex ].textureId;
-
-    DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) Using cached texture @%d, textureId=%d\n", url.GetUrl().c_str(), observer, cacheIndex, textureId );
+    DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) Using cached texture id@%d, textureId=%d\n",
+                   url.GetUrl().c_str(), observer, cacheIndex, textureId );
   }
 
   if( textureId == INVALID_TEXTURE_ID ) // There was no caching, or caching not required
@@ -294,7 +311,8 @@ TextureManager::TextureId TextureManager::RequestLoadInternal(
                                                   false, cropToMask, useAtlas, textureHash, orientationCorrection ) );
     cacheIndex = mTextureInfoContainer.size() - 1u;
 
-    DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d\n", url.GetUrl().c_str(), observer, cacheIndex, textureId );
+    DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d\n",
+                   url.GetUrl().c_str(), observer, cacheIndex, textureId );
   }
 
   // The below code path is common whether we are using the cache or not.
@@ -311,9 +329,20 @@ TextureManager::TextureId TextureManager::RequestLoadInternal(
                  textureInfo.loadState == TextureManager::UPLOADED ? "UPLOADED" :
                  textureInfo.loadState == TextureManager::CANCELLED ? "CANCELLED" : "Unknown" );
 
-  // Check if we should add the observer. Only do this if we have not loaded yet and it will not have loaded by the end of this method.
+  // Force reloading of texture by setting loadState unless already loading or cancelled.
+  if ( TextureManager::ReloadPolicy::FORCED == reloadPolicy && TextureManager::LOADING != textureInfo.loadState &&
+       TextureManager::CANCELLED != textureInfo.loadState )
+  {
+    DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Verbose, "TextureManager::RequestLoad( url=%s observer=%p ) ForcedReload cacheIndex:%d, textureId=%d\n",
+                   url.GetUrl().c_str(), observer, cacheIndex, textureId );
+    textureInfo.loadState = TextureManager::NOT_STARTED;
+  }
+
+  // Check if we should add the observer.
+  // Only do this if we have not loaded yet and it will not have loaded by the end of this method.
   switch( textureInfo.loadState )
   {
+    case TextureManager::LOAD_FAILED: // Failed notifies observer which then stops observing.
     case TextureManager::NOT_STARTED:
     {
       LoadTexture( textureInfo );
@@ -346,7 +375,6 @@ TextureManager::TextureId TextureManager::RequestLoadInternal(
     }
     case TextureManager::LOAD_FINISHED:
     case TextureManager::WAITING_FOR_MASK:
-    case TextureManager::LOAD_FAILED:
       // Loading has already completed. Do nothing.
       break;
   }
@@ -511,7 +539,8 @@ void TextureManager::ObserveTexture( TextureInfo& textureInfo,
   }
 }
 
-void TextureManager::AsyncLoadComplete( AsyncLoadingInfoContainerType& loadingContainer, uint32_t id, Devel::PixelBuffer pixelBuffer )
+void TextureManager::AsyncLoadComplete( AsyncLoadingInfoContainerType& loadingContainer, uint32_t id,
+                                        Devel::PixelBuffer pixelBuffer )
 {
   DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::AsyncLoadComplete( id:%d )\n", id );
 
@@ -644,10 +673,14 @@ void TextureManager::UploadTexture( Devel::PixelBuffer& pixelBuffer, TextureInfo
   {
     DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "  TextureManager::UploadTexture() New Texture for textureId:%d\n", textureInfo.textureId );
 
-    Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelBuffer.GetPixelFormat(), pixelBuffer.GetWidth(), pixelBuffer.GetHeight() );
+    Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelBuffer.GetPixelFormat(),
+                                    pixelBuffer.GetWidth(), pixelBuffer.GetHeight() );
     PixelData pixelData = Devel::PixelBuffer::Convert( pixelBuffer );
     texture.Upload( pixelData );
-    textureInfo.textureSet = TextureSet::New();
+    if ( ! textureInfo.textureSet )
+    {
+      textureInfo.textureSet = TextureSet::New();
+    }
     textureInfo.textureSet.SetTexture( 0u, texture );
   }
 
@@ -833,7 +866,8 @@ void TextureManager::ObserverDestroyed( TextureUploadObserver* observer )
   for( unsigned int i = 0; i < count; ++i )
   {
     TextureInfo& textureInfo( mTextureInfoContainer[i] );
-    for( TextureInfo::ObserverListType::Iterator j = textureInfo.observerList.Begin(); j != textureInfo.observerList.End(); )
+    for( TextureInfo::ObserverListType::Iterator j = textureInfo.observerList.Begin();
+         j != textureInfo.observerList.End(); )
     {
       if( *j == observer )
       {
index 7693b1c..d27b87f 100644 (file)
@@ -104,6 +104,15 @@ public:
     LOAD_FAILED      ///< Async loading failed, e.g. connection problem
   };
 
+  /**
+  * @breif Types of reloading policies
+  */
+  enum class ReloadPolicy
+  {
+    CACHED = 0,             ///< Loads cached texture if it exists.
+    FORCED                  ///< Forces reloading of texture.
+  };
+
 public:
 
   struct MaskingData
@@ -139,7 +148,8 @@ public:
                          Dali::WrapMode::Type wrapModeV, TextureUploadObserver* textureObserver,
                          AtlasUploadObserver* atlasObserver,
                          ImageAtlasManagerPtr imageAtlasManager,
-                         bool orientationCorrection );
+                         bool orientationCorrection,
+                         TextureManager::ReloadPolicy reloadPolicy );
 
   /**
    * @brief Requests an image load of the given URL.
@@ -158,15 +168,17 @@ public:
    * @param[in] observer              The client object should inherit from this and provide the "UploadCompleted" virtual.
    *                                  This is called when an image load completes (or fails).
    * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
+   * @param[in] reloadPolicy          Forces a reload of the texture even if already cached
    * @return                          A TextureId to use as a handle to reference this Texture
    */
-  TextureId RequestLoad( const VisualUrl&         url,
-                         const ImageDimensions    desiredSize,
-                         FittingMode::Type        fittingMode,
-                         Dali::SamplingMode::Type samplingMode,
-                         const UseAtlas           useAtlasing,
-                         TextureUploadObserver*   observer,
-                         bool                     orientationCorrection );
+  TextureId RequestLoad( const VisualUrl&                   url,
+                         const ImageDimensions              desiredSize,
+                         FittingMode::Type                  fittingMode,
+                         Dali::SamplingMode::Type           samplingMode,
+                         const UseAtlas                     useAtlasing,
+                         TextureUploadObserver*             observer,
+                         bool                               orientationCorrection,
+                         TextureManager::ReloadPolicy       reloadPolicy );
 
   /**
    * @brief Requests an image load of the given URL, when the texture has
@@ -179,29 +191,36 @@ public:
    * When the client has finished with the Texture, Remove() should be called.
    *
    * @param[in] url                   The URL of the image to load
-   * @param[in] maskTextureId         The texture id of an image to mask this with (can be INVALID if no masking required)
+   * @param[in] maskTextureId         The texture id of an image to mask this with
+   *                                  (can be INVALID if no masking required)
    * @param[in] contentScale          The scale factor to apply to the image before masking
    * @param[in] desiredSize           The size the image is likely to appear at. This can be set to 0,0 for automatic
    * @param[in] fittingMode           The FittingMode to use
    * @param[in] samplingMode          The SamplingMode to use
-   * @param[in] useAtlasing           Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be loaded, and marked successful,
-   *                                  but "useAtlasing" will be set to false in the "UploadCompleted" callback from the TextureManagerUploadObserver.
-   * @param[in] cropToMask            Only used with masking, this will crop the scaled image to the mask size. If false, then the mask will be scaled to fit the image before being applied.
-   * @param[in] observer              The client object should inherit from this and provide the "UploadCompleted" virtual.
+   * @param[in] useAtlasing           Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still
+   *                                  be loaded, and marked successful,
+   *                                  but "useAtlasing" will be set to false in the "UploadCompleted" callback from
+   *                                  the TextureManagerUploadObserver.
+   * @param[in] cropToMask            Only used with masking, this will crop the scaled image to the mask size.
+   *                                  If false, then the mask will be scaled to fit the image before being applied.
+   * @param[in] observer              The client object should inherit from this and provide the "UploadCompleted"
+   *                                  virtual.
    *                                  This is called when an image load completes (or fails).
    * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
+   * @param[in] reloadPolicy          Forces a reload of the texture even if already cached
    * @return                          A TextureId to use as a handle to reference this Texture
    */
-  TextureId RequestLoad( const VisualUrl&         url,
-                         TextureId                maskTextureId,
-                         float                    contentScale,
-                         const ImageDimensions    desiredSize,
-                         FittingMode::Type        fittingMode,
-                         Dali::SamplingMode::Type samplingMode,
-                         const UseAtlas           useAtlasing,
-                         bool                     cropToMask,
-                         TextureUploadObserver*   observer,
-                         bool                     orientationCorrection );
+  TextureId RequestLoad( const VisualUrl&                   url,
+                         TextureId                          maskTextureId,
+                         float                              contentScale,
+                         const ImageDimensions              desiredSize,
+                         FittingMode::Type                  fittingMode,
+                         Dali::SamplingMode::Type           samplingMode,
+                         const UseAtlas                     useAtlasing,
+                         bool                               cropToMask,
+                         TextureUploadObserver*             observer,
+                         bool                               orientationCorrection,
+                         TextureManager::ReloadPolicy       reloadPolicy );
 
   /**
    * Requests a masking image to be loaded. This mask is not uploaded to GL,
@@ -266,32 +285,38 @@ private:
    * When the client has finished with the Texture, Remove() should be called.
    *
    * @param[in] url                   The URL of the image to load
-   * @param[in] maskTextureId         The texture id of an image to use as a mask. If no mask is required, then set to INVALID_TEXTURE_ID
+   * @param[in] maskTextureId         The texture id of an image to use as a mask. If no mask is required, then set
+   *                                  to INVALID_TEXTURE_ID
    * @param[in] contentScale          The scaling factor to apply to the content when masking
    * @param[in] desiredSize           The size the image is likely to appear at. This can be set to 0,0 for automatic
    * @param[in] fittingMode           The FittingMode to use
    * @param[in] samplingMode          The SamplingMode to use
-   * @param[in] useAtlasing           Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be loaded, and marked successful,
-   *                                  but "useAtlasing" will be set to false in the "UploadCompleted" callback from the TextureManagerUploadObserver.
-   * @param[in] cropToMask            Whether to crop the target after masking, or scale the mask to the image before masking.
+   * @param[in] useAtlasing           Set to USE_ATLAS to attempt atlasing. If atlasing fails, the image will still be
+   *                                  loaded, and marked successful, but "useAtlasing" will be set to false in the
+   *                                  "UploadCompleted" callback from the TextureManagerUploadObserver.
+   * @param[in] cropToMask            Whether to crop the target after masking, or scale the mask to the image before
+   *                                  masking.
    * @param[in] storageType,          Whether the pixel data is stored in the cache or uploaded to the GPU
-   * @param[in] observer              The client object should inherit from this and provide the "UploadCompleted" virtual.
+   * @param[in] observer              The client object should inherit from this and provide the "UploadCompleted"
+   *                                  virtual.
    *                                  This is called when an image load completes (or fails).
    * @param[in] orientationCorrection Whether to rotate image to match embedded orientation data
+   * @param[in] reloadPolicy          Forces a reload of the texture even if already cached
    * @return                          A TextureId to use as a handle to reference this Texture
    */
   TextureId RequestLoadInternal(
-    const VisualUrl&         url,
-    TextureId                maskTextureId,
-    float                    contentScale,
-    const ImageDimensions    desiredSize,
-    FittingMode::Type        fittingMode,
-    Dali::SamplingMode::Type samplingMode,
-    UseAtlas                 useAtlas,
-    bool                     cropToMask,
-    StorageType              storageType,
-    TextureUploadObserver*   observer,
-    bool                     orientationCorrection );
+    const VisualUrl&                    url,
+    TextureId                           maskTextureId,
+    float                               contentScale,
+    const ImageDimensions               desiredSize,
+    FittingMode::Type                   fittingMode,
+    Dali::SamplingMode::Type            samplingMode,
+    UseAtlas                            useAtlas,
+    bool                                cropToMask,
+    StorageType                         storageType,
+    TextureUploadObserver*              observer,
+    bool                                orientationCorrection,
+    TextureManager::ReloadPolicy        reloadPolicy );
 
 
   typedef size_t TextureHash; ///< The type used to store the hash used for Texture caching.
@@ -356,7 +381,8 @@ private:
     Dali::SamplingMode::Type samplingMode:3; ///< The requested SamplingMode
     StorageType storageType:1;     ///< CPU storage / GPU upload;
     bool loadSynchronously:1;      ///< True if synchronous loading was requested
-    UseAtlas useAtlas:1;           ///< USE_ATLAS if an atlas was requested. This is updated to false if atlas is not used
+    UseAtlas useAtlas:1;           ///< USE_ATLAS if an atlas was requested.
+                                   ///< This is updated to false if atlas is not used
     bool cropToMask:1;             ///< true if the image should be cropped to the mask size.
     bool orientationCorrection:1;  ///< true if the image should be rotated to match exif orientation data
   };
@@ -376,7 +402,7 @@ private:
     }
 
     TextureId           textureId;   ///< The external Texture Id assigned to this load
-    unsigned short      loadId;      ///< The load Id used by the async loader to reference this load
+    uint32_t            loadId;      ///< The load Id used by the async loader to reference this load
   };
 
   // Private typedefs:
@@ -537,10 +563,12 @@ private:
      * @brief Load a new texture.
      * @param[in] textureId             TextureId to reference the texture that will be loaded
      * @param[in] url                   The URL of the image to load
-     * @param[in] desiredSize           The size the image is likely to appear at. This can be set to 0,0 for automatic
+     * @param[in] desiredSize           The size the image is likely to appear at.
+     *                                  This can be set to 0,0 for automatic
      * @param[in] fittingMode           The FittingMode to use
      * @param[in] samplingMode          The SamplingMode to use
-     * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image, e.g., from portrait to landscape
+     * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image,
+     *                                  e.g., from portrait to landscape
      */
     void Load(TextureId textureId,
               const VisualUrl& url,
index 3473509..e4f12c8 100644 (file)
@@ -342,7 +342,7 @@ bool Visual::Base::IsOnStage() const
   return mImpl->mFlags & Impl::IS_ON_STAGE;
 }
 
-void Visual::Base::OnDoAction( const Property::Index actionId, const Property::Value attributes )
+void Visual::Base::OnDoAction( const Property::Index actionId, const Property::Value& attributes )
 {
   // May be overriden by derived class
 }
index 996fa3c..6fc777d 100644 (file)
@@ -315,7 +315,7 @@ protected:
    * @param[in] actionId The action to perform
    * @param[in] attributes The list of attributes for the action. ( optional for this data structure to have content )
    */
-  virtual void OnDoAction( const Property::Index actionId, const Property::Value attributes );
+  virtual void OnDoAction( const Property::Index actionId, const Property::Value& attributes );
 
 protected:
 
index 7f13da6..778a48f 100644 (file)
@@ -67,6 +67,7 @@ public:
     IMAGE_SHADER_ATLAS_DEFAULT_WRAP,
     IMAGE_SHADER_ATLAS_CUSTOM_WRAP,
     NINE_PATCH_SHADER,
+    NINE_PATCH_MASK_SHADER,
     SVG_SHADER,
     TEXT_SHADER_MULTI_COLOR_TEXT,
     TEXT_SHADER_MULTI_COLOR_TEXT_WITH_STYLE,
index 661e251..9e889cb 100644 (file)
@@ -90,6 +90,8 @@ const char * const CROP_TO_MASK_NAME("cropToMask");
 const char * const LOAD_POLICY_NAME("loadPolicy");
 const char * const RELEASE_POLICY_NAME("releasePolicy");
 const char * const ORIENTATION_CORRECTION_NAME("orientationCorrection");
+const char * const AUXILIARY_IMAGE_NAME("auxiliaryImage");
+const char * const AUXILIARY_IMAGE_ALPHA_NAME("auxiliaryImageAlpha");
 
 // Text visual
 const char * const TEXT_PROPERTY( "text" );
index 50f809f..eb0b617 100644 (file)
@@ -76,6 +76,8 @@ extern const char * const CROP_TO_MASK_NAME;
 extern const char * const LOAD_POLICY_NAME;
 extern const char * const RELEASE_POLICY_NAME;
 extern const char * const ORIENTATION_CORRECTION_NAME;
+extern const char * const AUXILLARY_IMAGE_NAME;
+extern const char * const AUXILLARY_IMAGE_ALPHA_NAME;
 
 // Text visual
 extern const char * const TEXT_PROPERTY;
index cba5308..47a12b1 100755 (executable)
@@ -657,11 +657,13 @@ void Control::OnRelayout( const Vector2& size, RelayoutContainer& container )
       newChildSize.width = size.width - ( padding.start + padding.end );
       newChildSize.height = size.height - ( padding.top + padding.bottom );
 
-      Vector3 childPosition = child.GetTargetSize();
-      childPosition.x += ( mImpl->mMargin.start + padding.start );
-      childPosition.y += ( mImpl->mMargin.top + padding.top );
+      // Cannot use childs Position property as it can already have padding and margin applied on it,
+      // so we end up cumulatively applying them over and over again.
+      Vector2 childOffset( 0.f, 0.f );
+      childOffset.x += ( mImpl->mMargin.start + padding.start );
+      childOffset.y += ( mImpl->mMargin.top + padding.top );
 
-      child.SetPosition( childPosition );
+      child.SetPosition( childOffset.x, childOffset.y );
     }
 
     container.Add( child, newChildSize );
index eee3b91..58f3205 100644 (file)
@@ -473,6 +473,7 @@ public:
    * @endcode
    *
    * @SINCE_1_2.60
+   * @return The signal to connect to
    * @note A RelayoutRequest is queued by Control before this signal is emitted
    */
   ResourceReadySignalType& ResourceReadySignal();
index 4d45740..ed4ceb2 100644 (file)
@@ -64,11 +64,15 @@ public:
   };
 
   /**
-   * @brief An enumeration of properties belonging to the ProgressBar class.
+   * @brief Enumeration of properties belonging to the ProgressBar class.
    * @SINCE_1_2.60
    */
   struct Property
   {
+    /**
+     * @brief Enumeration for the instance of properties belonging to the ProgressBar class.
+     * @SINCE_1_2.60
+     */
     enum
     {
       /**
@@ -171,6 +175,7 @@ public:
    *
    * Creates another handle that points to the same real object.
    * @SINCE_1_2.60
+   * @param[in] handle Handle to an object
    */
   ProgressBar( const ProgressBar& handle );
 
@@ -179,6 +184,8 @@ public:
    *
    * Changes this handle to point to another real object.
    * @SINCE_1_2.60
+   * @param[in] handle Handle to an object
+   * @return A reference to this
    */
   ProgressBar& operator=( const ProgressBar& handle );
 
index 1e69f50..e1226ce 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 3;
-const unsigned int TOOLKIT_MICRO_VERSION = 1;
+const unsigned int TOOLKIT_MICRO_VERSION = 2;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 84470a9..3b6c99b 100644 (file)
@@ -40,14 +40,14 @@ namespace BorderVisual
 {
 
 /**
- * @brief BorderVisual Property
+ * @brief BorderVisual Property.
  * @SINCE_1_1.45
  */
 namespace Property
 {
 
 /**
- * @brief BorderVisual Property
+ * @brief Enumeration for the instance of properties belonging to the BorderVisual.
  * @SINCE_1_1.45
  */
 enum
index fb87e54..5f1aab9 100644 (file)
@@ -40,14 +40,14 @@ namespace ColorVisual
 {
 
 /**
- * @brief ColorVisual Property
+ * @brief ColorVisual Property.
  * @SINCE_1_1.45
  */
 namespace Property
 {
 
 /**
- * @brief ColorVisual Property
+ * @brief Enumeration for the instance of properties belonging to the ColorVisual.
  * @SINCE_1_1.45
  */
 enum
index ae895ca..cdfd624 100644 (file)
@@ -40,14 +40,14 @@ namespace GradientVisual
 {
 
 /**
- * @brief GradientVisual Property
+ * @brief GradientVisual Property.
  * @SINCE_1_1.45
  */
 namespace Property
 {
 
 /**
- * @brief GradientVisual Property
+ * @brief Enumeration for the instance of properties belonging to the GradientVisual.
  * @SINCE_1_1.45
  */
 enum
index 589a188..93902cf 100644 (file)
@@ -40,14 +40,14 @@ namespace ImageVisual
 {
 
 /**
- * @brief ImageVisual Property
+ * @brief ImageVisual Property.
  * @SINCE_1_1.45
  */
 namespace Property
 {
 
 /**
- * @brief ImageVisual Property
+ * @brief Enumeration for the instance of properties belonging to the ImageVisual.
  * @SINCE_1_1.45
  */
 enum
index 765fce7..f431207 100644 (file)
@@ -40,14 +40,14 @@ namespace MeshVisual
 {
 
 /**
- * @brief MeshVisual Property
+ * @brief MeshVisual Property.
  * @SINCE_1_1.45
  */
 namespace Property
 {
 
 /**
- * @brief MeshVisual Property
+ * @brief Enumeration for the instance of properties belonging to the MeshVisual.
  * @SINCE_1_1.45
  */
 enum
index 12f56e5..30477e8 100644 (file)
@@ -40,14 +40,14 @@ namespace PrimitiveVisual
 {
 
 /**
- * @brief PrimitiveVisual Property
+ * @brief PrimitiveVisual Property.
  * @SINCE_1_1.45
  */
 namespace Property
 {
 
 /**
- * @brief PrimitiveVisual Property
+ * @brief Enumeration for the instance of properties belonging to the PrimitiveVisual.
  * @SINCE_1_1.45
  */
 enum
index 10c4ab7..0eb7fba 100644 (file)
@@ -32,15 +32,23 @@ namespace Toolkit
  */
 
 /**
- * @brief TextVisual Properties
+ * @brief TextVisual is to render a text.
  * @SINCE_1_2.60
  */
 namespace TextVisual
 {
 
+/**
+ * @brief TextVisual Property.
+ * @SINCE_1_2.60
+ */
 namespace Property
 {
 
+/**
+ * @brief Enumeration for the instance of properties belonging to the TextVisual.
+ * @SINCE_1_2.60
+ */
 enum
 {
   /**
index 54a4350..94b504b 100644 (file)
@@ -33,7 +33,7 @@ namespace Toolkit
  */
 
 /**
- * @brief All the visual types
+ * @brief All the visual types.
  * @SINCE_1_1.45
  */
 namespace Visual
@@ -59,14 +59,14 @@ enum Type
 };
 
 /**
- * @brief Visual Property
+ * @brief Visual Property.
  * @SINCE_1_1.45
  */
 namespace Property
 {
 
 /**
- * @brief Visual Property
+ * @brief Enumeration for the instance of properties belonging to the Visual Property.
  * @SINCE_1_1.45
  */
 enum
@@ -128,28 +128,43 @@ enum
 
 } // namespace Property
 
+/**
+ * @brief Visual Transfrom for the offset or size.
+ * @SINCE_1_2.60
+ */
 namespace Transform
 {
 
 /**
  * @brief Policies used by the transform for the offset or size.
  * @SINCE_1_2.60
- *
  */
 namespace Policy
 {
 
+/**
+ * @brief Enumeration for the type of Transform Policy.
+ * @SINCE_1_2.60
+ */
 enum Type
 {
-  RELATIVE = 0,   ///< Relative to the control (percentage [0.0f to 1.0f] of the control).
-  ABSOLUTE = 1    ///< Absolute value in world units.
+  RELATIVE = 0,   ///< Relative to the control (percentage [0.0f to 1.0f] of the control). @SINCE_1_2.60
+  ABSOLUTE = 1    ///< Absolute value in world units. @SINCE_1_2.60
 };
 
 } // namespace Policy
 
+/**
+ * @brief Visual Transform Property.
+ * @SINCE_1_2.60
+ */
 namespace Property
 {
 
+/**
+ * @brief Enumeration for the type of Transfrom Property.
+ * @SINCE_1_2.60
+ */
 enum Type
 {
   /**
@@ -237,21 +252,21 @@ enum Type
 } // namespace Transform
 
 /**
- * @brief Shader for Visuals
+ * @brief Shader for Visuals.
  * @SINCE_1_1.45
  */
 namespace Shader
 {
 
 /**
- * @brief Shader Property
+ * @brief Shader Property.
  * @SINCE_1_1.45
  */
 namespace Property
 {
 
 /**
- * @brief The type of Shader
+ * @brief The type of Shader.
  * @SINCE_1_1.45
  */
 enum
index 15c937a..244096f 100644 (file)
Binary files a/dali-toolkit/styles/1920x1080/images/cursor_handler_drop_center.png and b/dali-toolkit/styles/1920x1080/images/cursor_handler_drop_center.png differ
index 149becb..244096f 100644 (file)
Binary files a/dali-toolkit/styles/1920x1080/images/selection_handle_drop_left.png and b/dali-toolkit/styles/1920x1080/images/selection_handle_drop_left.png differ
index 75035bc..244096f 100644 (file)
Binary files a/dali-toolkit/styles/1920x1080/images/selection_handle_drop_right.png and b/dali-toolkit/styles/1920x1080/images/selection_handle_drop_right.png differ
diff --git a/dali-toolkit/styles/360x360/dali-toolkit-default-theme.json b/dali-toolkit/styles/360x360/dali-toolkit-default-theme.json
new file mode 100644 (file)
index 0000000..735b0e5
--- /dev/null
@@ -0,0 +1,385 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * This file is part of Dali Toolkit
+ *
+ * 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.
+ */
+
+
+//******************************************************************************
+//
+// Default Reference style theme for a 480x800 resolution, The values determined by UX design specification.
+// This file can be copied to a new folder within the styles/ directory and amended with new default values.
+// Can be overriden if StyleManager applies another style sheet.
+//
+//******************************************************************************
+
+{
+  "config":
+  {
+    "alwaysShowFocus":false,
+    "clearFocusOnEscape":true
+  },
+  "styles":
+  {
+    "TextLabel":
+    {
+      "pointSize":18,
+      "enableAutoScroll":false,
+      "autoScrollLoopCount":2,
+      "autoScrollGap":50,
+      "autoScrollSpeed":80
+    },
+
+    "TextLabelFontSize0":
+    {
+      "pointSize":8
+    },
+    "TextLabelFontSize1":
+    {
+      "pointSize":10
+    },
+    "TextLabelFontSize2":
+    {
+      "pointSize":15
+    },
+    "TextLabelFontSize3":
+    {
+      "pointSize":19
+    },
+    "TextLabelFontSize4":
+    {
+      "pointSize":25
+    },
+    "TextField":
+    {
+      "pointSize":18,
+      "primaryCursorColor":[0.0,0.72,0.9,1.0],
+      "secondaryCursorColor":[0.0,0.72,0.9,1.0],
+      "cursorWidth":3,
+      "selectionHighlightColor":[0.75,0.96,1.0,1.0],
+      "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+      "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+      "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
+      "enableSelection":true
+    },
+
+    "TextFieldFontSize0":
+    {
+      "pointSize":10
+    },
+    "TextFieldFontSize1":
+    {
+      "pointSize":10
+    },
+    "TextFieldFontSize2":
+    {
+      "pointSize":10
+    },
+    "TextFieldFontSize3":
+    {
+      "pointSize":10
+    },
+    "TextFieldFontSize4":
+    {
+      "pointSize":10
+    },
+    "TextSelectionPopup":
+    {
+      "popupMaxSize":[656,72],
+      "optionDividerSize":[2,0],
+      "popupDividerColor":[0.23,0.72,0.8,0.11],
+      "popupIconColor":[1.0,1.0,1.0,1.0],
+      "popupPressedColor":[0.24,0.72,0.8,0.11],
+      "background": {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+        },
+      "backgroundBorder": {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
+        "mixColor":[0.24,0.72,0.8,1.0]
+        },
+      "popupFadeInDuration":0.25,
+      "popupFadeOutDuration":0.25
+    },
+    "TextSelectionPopupButton":
+    {
+      "label":
+      {
+        "visualType":"TEXT",
+        "pointSize":8
+      },
+      "unselectedBackgroundVisual":
+      {
+        "visualType": "IMAGE",
+        "url": ""
+      },
+      "selectedBackgroundVisual":
+      {
+        "visualType": "IMAGE",
+        "url": ""
+      }
+    },
+    "TextSelectionToolbar":
+    {
+      "enableOvershoot":true,
+      "enableScrollBar":true,
+      "scrollView":
+      {
+        "overshootAnimationSpeed":360.0,
+        "overshootSize":[720.0,130.0]
+      }
+    },
+    "TextSelectionScrollBar":
+    {
+      "indicatorShowDuration":0.25,
+      "indicatorHideDuration":0.25,
+      "indicatorTransientDuration":1.0
+    },
+    "TextSelectionScrollIndicator":
+    {
+      "image":
+      {
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}text_selection_scroll_indicator.9.png"
+      },
+      "color":[0.0,0.72,0.9,0.7]
+    },
+    "ScrollView":
+    {
+      "overshootEffectColor":"B018",
+      "overshootAnimationSpeed":360.0,
+      "overshootSize":[720.0,130.0]
+    },
+    "ItemView":
+    {
+      "overshootEffectColor":"B018",
+      "overshootAnimationSpeed":360.0,
+      "overshootSize":[720.0,130.0]
+    },
+    "ScrollBar":
+    {
+      "indicatorShowDuration":0.25,
+      "indicatorHideDuration":0.25,
+      "color":[0.0,0.72,0.9,0.7]
+    },
+    "TextEditor":
+    {
+      "pointSize":18,
+      "primaryCursorColor":[0.0,0.72,0.9,1.0],
+      "secondaryCursorColor":[0.0,0.72,0.9,1.0],
+      "cursorWidth":3,
+      "selectionHighlightColor":[0.75,0.96,1.0,1.0],
+      "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+      "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+      "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
+      "enableScrollBar":true,
+      "scrollBarShowDuration":0.8,
+      "scrollBarFadeDuration":0.5,
+      "enableSelection":true
+    },
+    "Popup":
+    {
+      "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png",
+      "tailUpImage":"{DALI_IMAGE_DIR}popup_tail_up.png",
+      "tailDownImage":"{DALI_IMAGE_DIR}popup_tail_down.png",
+      "tailLeftImage":"{DALI_IMAGE_DIR}popup_tail_left.png",
+      "tailRightImage":"{DALI_IMAGE_DIR}popup_tail_right.png",
+      "popupBackgroundBorder":[17,17,13,13]
+    },
+    "ConfirmationPopup":
+    {
+      "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png",
+      "tailUpImage":"{DALI_IMAGE_DIR}popup_tail_up.png",
+      "tailDownImage":"{DALI_IMAGE_DIR}popup_tail_down.png",
+      "tailLeftImage":"{DALI_IMAGE_DIR}popup_tail_left.png",
+      "tailRightImage":"{DALI_IMAGE_DIR}popup_tail_right.png",
+      "popupBackgroundBorder":[17,17,13,13]
+    },
+    "Slider":
+    {
+      "showPopup": true,
+      "showValue": true,
+      "valuePrecision": 0,
+      "trackVisual":{
+        "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+        "size":[27,27]
+      },
+      "progressVisual":{
+        "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+        "size":[27,27]
+      },
+      "handleVisual":{
+        "url":"{DALI_IMAGE_DIR}slider-skin-handle.png",
+        "size":[72,72]
+      },
+      "popupVisual":"{DALI_IMAGE_DIR}slider-popup.9.png",
+      "popupArrowVisual":"{DALI_IMAGE_DIR}slider-popup-arrow.9.png",
+      "disableColor":[0.5, 0.5, 0.5, 1.0],
+      "popupTextColor":[0.5,0.5,0.5,1.0],
+      "hitRegion":[0, 72],
+      "marks":[],
+      "snapToMarks":false,
+      "markTolerance":0.05
+    },
+    "SliderHandleTextLabel":
+    {
+      "textColor":[0.8,0.8,1,1]
+    },
+    "ProgressBar":
+    {
+      "trackVisual":{
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}progress-bar-skin-track.9.png"
+      },
+      "progressVisual":{
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}progress-bar-skin-progress.9.png"
+      },
+      "secondaryProgressVisual":{
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}progress-bar-skin-secondary-progress.9.png"
+      },
+      "indeterminateVisual":{
+        "visualType":"IMAGE",
+        "pixelArea":[0.0, 0.0, 10.0, 1.0],
+        "wrapModeU":"REPEAT",
+        "url":"{DALI_IMAGE_DIR}progress-bar-skin-indeterminate.png"
+      },
+      "indeterminateVisualAnimation":
+      [
+        {
+          "target":"indeterminateVisual",
+          "property":"pixelArea",
+          "initialValue":[0.0, 0.0, 10.0, 1.0],
+          "targetValue":[-1.0, 0.0, 10.0, 1.0],
+          "animator":
+          {
+            "alphaFunction":"DEFAULT",
+            "timePeriod":
+            {
+              "duration":0.8,
+              "delay":0
+            }
+          }
+        }
+      ],
+      "labelVisual":{
+        "visualType": "TEXT",
+        "textColor": [ 1.0, 1.0, 1.0, 1.0 ],
+        "pointSize" : 12.0, // Point size must always be provided to Text Visual
+        "horizontalAlignment": "CENTER",
+        "verticalAlignment": "CENTER"
+      },
+      "progressValue": 0.0,
+      "secondaryProgressValue":0.0,
+      "indeterminate": false
+    },
+    "Button":
+    {
+      "initialAutoRepeatingDelay":2.0,
+      "nextAutoRepeatingDelay":0.9
+      // Note: Visuals added to Button will be used in all derived buttons unless overridden.
+    },
+    "PushButton":
+    {
+      "anchorPoint": [ 0.5, 1.0, 0.5 ],
+      "parentOrigin": [ 0.5, 1.0, 0,5 ],
+      "label":
+       {
+         "visualType": "TEXT",
+         "text" : "BOTTOM_BTN",
+         "horizontalAlignment": "CENTER",
+         "verticalAlignment": "CENTER",
+         "pointSize" : 6.0,
+         "textColor": [0.98,0.98,0.98,1.0]
+       },
+      "background":
+       {
+         "visualType": "IMAGE",
+         "url": "{DALI_STYLE_IMAGE_DIR}tw_bottom_btn_bg.png",
+         "mixColor": [0.0,0.21,0.29,0.9]
+       },
+       "selectedStateImage":
+       {
+         "visualType": "IMAGE",
+         "url": "{DALI_STYLE_IMAGE_DIR}tw_bottom_btn_bg.png",
+         "mixColor": [0.0,0.57,0.8,0.3]
+       }
+    },
+    "CheckBoxButton":
+    {
+      "styles":["Button"],
+      "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+      "label":
+       {
+         "visualType": "TEXT",
+         "pointSize" : 10.0, // Point size must always be provided to Text Visual
+         "verticalAlignment": "CENTER"
+       },
+      "unselectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}checkbox-unselected.png"
+      },
+      "selectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}checkbox-selected.png"
+      },
+      "disabledUnselectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}checkbox-unselected-disabled.png"
+      },
+      "disabledSelectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}checkbox-selected-disabled.png"
+      }
+    },
+    "RadioButton":
+    {
+      "styles":["Button"],
+      "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+      "label":
+       {
+         "visualType": "TEXT",
+         "pointSize" : 10.0, // Point size must always be provided to Text Visual
+         "verticalAlignment": "CENTER"
+       },
+      "unselectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}radio-button-unselected.png"
+      },
+      "selectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}radio-button-selected.png"
+      },
+      "disabledUnselectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}radio-button-unselected-disabled.png"
+      },
+      "disabledSelectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
+      }
+    }
+  }
+}
diff --git a/dali-toolkit/styles/360x360/images/cursor_handler_drop_center.png b/dali-toolkit/styles/360x360/images/cursor_handler_drop_center.png
new file mode 100644 (file)
index 0000000..a9a2b9e
Binary files /dev/null and b/dali-toolkit/styles/360x360/images/cursor_handler_drop_center.png differ
diff --git a/dali-toolkit/styles/360x360/images/selection_handle_drop_left.png b/dali-toolkit/styles/360x360/images/selection_handle_drop_left.png
new file mode 100644 (file)
index 0000000..d9ed8b8
Binary files /dev/null and b/dali-toolkit/styles/360x360/images/selection_handle_drop_left.png differ
diff --git a/dali-toolkit/styles/360x360/images/selection_handle_drop_right.png b/dali-toolkit/styles/360x360/images/selection_handle_drop_right.png
new file mode 100644 (file)
index 0000000..f66b26b
Binary files /dev/null and b/dali-toolkit/styles/360x360/images/selection_handle_drop_right.png differ
diff --git a/dali-toolkit/styles/360x360/images/tw_bottom_btn_bg.png b/dali-toolkit/styles/360x360/images/tw_bottom_btn_bg.png
new file mode 100755 (executable)
index 0000000..55522be
Binary files /dev/null and b/dali-toolkit/styles/360x360/images/tw_bottom_btn_bg.png differ
index 6d8b558..4cbdb9e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    1.3.1
+Version:    1.3.2
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT
@@ -51,9 +51,20 @@ user interface functionality.
 ##############################
 # resource
 ##############################
+%package resources_360x360
+Summary:    default resource files for 360x360
+Requires:   %{name} = %{version}-%{release}
+Conflicts:  %{name}-resources_480x800
+Conflicts:  %{name}-resources_720x1280
+Conflicts:  %{name}-resources_1920x1080
+%description resources_360x360
+dali-toolkit default resource files for 360x360
+Contain po / sounds / common images / style / style images
+
 %package resources_480x800
 Summary:    default resource files for 480x800
 Requires:   %{name} = %{version}-%{release}
+Conflicts:  %{name}-resources_360x360
 Conflicts:  %{name}-resources_720x1280
 Conflicts:  %{name}-resources_1920x1080
 %description resources_480x800
@@ -63,6 +74,7 @@ Contain po / sounds / common images / style / style images
 %package resources_720x1280
 Summary:    default resource files for 720x1280
 Requires:   %{name} = %{version}-%{release}
+Conflicts:  %{name}-resources_360x360
 Conflicts:  %{name}-resources_480x800
 Conflicts:  %{name}-resources_1920x1080
 %description resources_720x1280
@@ -72,6 +84,7 @@ Contain po / sounds / common images / style / style images
 %package resources_1920x1080
 Summary:    default resource files for 1920x1080
 Requires:   %{name} = %{version}-%{release}
+Conflicts:  %{name}-resources_360x360
 Conflicts:  %{name}-resources_480x800
 Conflicts:  %{name}-resources_720x1280
 %description resources_1920x1080
@@ -227,6 +240,8 @@ rm -rf %{buildroot}%{dali_toolkit_style_files}/*
 
 # Make folder to contain style and style images
 # After making folder, copy local style and style images to new folder
+mkdir -p %{buildroot}%{dali_toolkit_style_files}/360x360
+cp -r dali-toolkit/styles/360x360/* %{buildroot}%{dali_toolkit_style_files}/360x360
 mkdir -p %{buildroot}%{dali_toolkit_style_files}/480x800
 cp -r dali-toolkit/styles/480x800/* %{buildroot}%{dali_toolkit_style_files}/480x800
 mkdir -p %{buildroot}%{dali_toolkit_style_files}/720x1280
@@ -241,6 +256,15 @@ cp dali-toolkit/styles/default-feedback-theme.json %{buildroot}%{dali_toolkit_st
 # Pre Install
 ##############################
 
+%pre resources_360x360
+case "$1" in
+  2)
+    pushd %{dali_toolkit_style_files}
+    rm -rf ./*
+    popd
+  ;;
+esac
+
 %pre resources_480x800
 case "$1" in
   2)
@@ -275,6 +299,11 @@ esac
 /sbin/ldconfig
 exit 0
 
+%post resources_360x360
+pushd %{dali_toolkit_style_files}/360x360
+for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
+popd
+
 %post resources_480x800
 pushd %{dali_toolkit_style_files}/480x800
 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
@@ -294,6 +323,17 @@ popd
 # Pre Uninstall
 ##############################
 
+%preun resources_360x360
+case "$1" in
+  0)
+    %preun resources_360x360
+    pushd %{dali_toolkit_style_files}
+    mv images ./360x360
+    mv dali-toolkit-default-theme.json ./360x360
+    popd
+  ;;
+esac
+
 %preun resources_480x800
 case "$1" in
   0)
@@ -334,6 +374,15 @@ esac
 /sbin/ldconfig
 exit 0
 
+%postun resources_360x360
+case "$1" in
+  0)
+    pushd %{dali_toolkit_style_files}
+    rm -rf *
+    popd
+  ;;
+esac
+
 %postun resources_480x800
 case "$1" in
   0)
@@ -393,6 +442,15 @@ esac
 %{dev_include_path}/dali-toolkit/*
 %{_libdir}/pkgconfig/dali-toolkit.pc
 
+%files resources_360x360
+%manifest dali-toolkit-resources.manifest
+%defattr(-,root,root,-)
+%{dali_toolkit_image_files}/*
+%{dali_toolkit_sound_files}/*
+%{dali_toolkit_style_files}/360x360/*
+%{dali_toolkit_style_files}/default-feedback-theme.json
+%{_datadir}/locale/*/LC_MESSAGES/*
+
 %files resources_480x800
 %manifest dali-toolkit-resources.manifest
 %defattr(-,root,root,-)