From: Nick Holland Date: Fri, 2 Jun 2017 11:56:33 +0000 (+0100) Subject: [dali_1.2.42] Merge branch 'devel/master' X-Git-Tag: dali_1.9.8~5^2~145 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=30b39930a88d3d44cfea9a969c742d662666b149;hp=96d995c2f22cb20080496e7442c4683eccc62a99 [dali_1.2.42] Merge branch 'devel/master' Change-Id: Iee4b624e159ad90653e6eb602ee0da0187db4054 --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp index 8f70228..0d54096 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace Dali { @@ -105,7 +106,7 @@ DummyControlImpl::~DummyControlImpl() void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual ) { - Control::RegisterVisual( index, visual ); + DevelControl::RegisterVisual( *this, index, visual ); VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index ); if( iter == mRegisteredVisualIndices.end() ) @@ -116,7 +117,7 @@ void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::B void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled ) { - Control::RegisterVisual( index, visual, enabled ); + DevelControl::RegisterVisual( *this, index, visual, enabled ); VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index ); if( iter == mRegisteredVisualIndices.end() ) @@ -127,7 +128,7 @@ void DummyControlImpl::RegisterVisual( Property::Index index, Toolkit::Visual::B void DummyControlImpl::UnregisterVisual( Property::Index index ) { - Control::UnregisterVisual( index ); + DevelControl::UnregisterVisual( *this, index ); VisualIndices::iterator iter = std::find( mRegisteredVisualIndices.begin(), mRegisteredVisualIndices.end(), index ); if( iter != mRegisteredVisualIndices.end() ) @@ -138,22 +139,22 @@ void DummyControlImpl::UnregisterVisual( Property::Index index ) Toolkit::Visual::Base DummyControlImpl::GetVisual( Property::Index index ) { - return Control::GetVisual( index ); + return DevelControl::GetVisual( *this, index ); } void DummyControlImpl::EnableVisual( Property::Index index, bool enabled ) { - Control::EnableVisual( index, enabled ); + DevelControl::EnableVisual( *this, index, enabled ); } bool DummyControlImpl::IsVisualEnabled( Property::Index index ) { - return Control::IsVisualEnabled( index ); + return DevelControl::IsVisualEnabled( *this, index ); } Animation DummyControlImpl::CreateTransition( const Toolkit::TransitionData& transition ) { - return Control::CreateTransition( transition ); + return DevelControl::CreateTransition( *this, transition ); } void DummyControlImpl::SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h index d4b8b18..7b43bd0 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_TEST_DUMMY_CONTROL_H__ /* - * Copyright (c) 2014 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. @@ -28,6 +28,12 @@ namespace Toolkit { class DummyControlImpl; +class TransitionData; + +namespace Visual +{ +class Base; +} /** * Control does not have a New method so use this dummy class for the handle. diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp index fd94447..a56df48 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp @@ -52,6 +52,8 @@ const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery_small-1.jpg"; const char* TEST_LARGE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/tbcol.png"; const char* TEST_SMALL_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/icon-edit.png"; const char* TEST_REMOTE_IMAGE_FILE_NAME = "https://www.tizen.org/sites/all/themes/tizen_theme/logo.png"; +const char* TEST_INVALID_FILE_NAME = TEST_RESOURCE_DIR "/invalid.jpg"; +const char* TEST_REMOTE_INVALID_FILE_NAME = "https://www.tizen.org/invalid.png"; } @@ -843,3 +845,131 @@ int UtcDaliImageVisualTextureCancelRemoteLoad(void) END_TEST; } + +int UtcDaliImageVisualSetInvalidAsyncImage(void) +{ + ToolkitTestApplication application; + tet_infoline( "Request image visual with invalid images - should draw broken.png" ); + + VisualFactory factory = VisualFactory::Get(); + DALI_TEST_CHECK( factory ); + + Property::Map propertyMap; + propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); + propertyMap.Insert( ImageVisual::Property::URL, TEST_INVALID_FILE_NAME ); + + Visual::Base visual = factory.CreateVisual( propertyMap ); + DALI_TEST_CHECK( visual ); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); + textureTrace.Enable(true); + + DummyControl actor = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual ); + + actor.SetSize( 200.f, 200.f ); + DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION ); + + Stage::GetCurrent().Remove( actor ); + DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); + + END_TEST; +} + +int UtcDaliImageVisualSetInvalidSyncImage(void) +{ + ToolkitTestApplication application; + tet_infoline( "Request image visual with invalid images - should draw broken.png" ); + + VisualFactory factory = VisualFactory::Get(); + DALI_TEST_CHECK( factory ); + + Property::Map propertyMap; + propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); + propertyMap.Insert( ImageVisual::Property::URL, TEST_INVALID_FILE_NAME ); + propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true ); + + Visual::Base visual = factory.CreateVisual( propertyMap ); + DALI_TEST_CHECK( visual ); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); + textureTrace.Enable(true); + + DummyControl actor = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual ); + + actor.SetSize( 200.f, 200.f ); + DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION ); + + Stage::GetCurrent().Remove( actor ); + DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); + + END_TEST; +} + +int UtcDaliImageVisualSetInvalidRemoteImage(void) +{ + ToolkitTestApplication application; + tet_infoline( "Request image visual with invalid images - should draw broken.png" ); + + VisualFactory factory = VisualFactory::Get(); + DALI_TEST_CHECK( factory ); + + // Local invalid file, asynchronous loading + Property::Map propertyMap; + propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); + propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_INVALID_FILE_NAME ); + + Visual::Base visual = factory.CreateVisual( propertyMap ); + DALI_TEST_CHECK( visual ); + + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); + textureTrace.Enable(true); + + DummyControl actor = DummyControl::New(); + DummyControlImpl& dummyImpl = static_cast(actor.GetImplementation()); + dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual ); + + actor.SetSize( 200.f, 200.f ); + DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION ); + + Stage::GetCurrent().Add( actor ); + + application.SendNotification(); + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION ); + DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION ); + + Stage::GetCurrent().Remove( actor ); + DALI_TEST_CHECK( actor.GetRendererCount() == 0u ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index ff32ccf..5cacd19 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -1913,3 +1913,25 @@ int utcDaliTextEditorShadowPropertyStringP(void) END_TEST; } + +int utcDaliTextEditorFontStylePropertyStringP(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextEditorFontStylePropertyStringP Setting FontStyle propeties by string"); + + TextEditor editor = TextEditor::New(); + + std::string fontStyleSettings( "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" ); + + Stage::GetCurrent().Add( editor ); + + editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" ); + + Property::Value value = editor.GetProperty( TextEditor::Property::FONT_STYLE ); + std::string result; + value.Get(result); + + DALI_TEST_EQUALS( result, fontStyleSettings, TEST_LOCATION ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index 5671523..4e1fd0f 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -251,11 +251,11 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) fontStyleMapSet.Insert( "weight", "thin" ); fontStyleMapSet.Insert( "width", "expanded" ); fontStyleMapSet.Insert( "slant", "oblique" ); + const std::string strFontStyle = "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}"; label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"expanded\",\"slant\":\"oblique\"}" ); - fontStyleMapGet = label.GetProperty( TextLabel::Property::FONT_STYLE ); - DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION ); + std::string getFontStyle = label.GetProperty( TextLabel::Property::FONT_STYLE ); + DALI_TEST_EQUALS( getFontStyle, strFontStyle, TEST_LOCATION ); label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f ); DALI_TEST_EQUALS( label.GetProperty( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); @@ -559,7 +559,7 @@ int UtcDaliToolkitTextlabelScrollingP(void) ToolkitTestApplication application; tet_infoline(" UtcDaliToolkitTextLabelScrollingP"); TextLabel labelImmediate = TextLabel::New("Some text to scroll"); - TextLabel labelFinished = TextLabel::New("Some text to scroll"); + TextLabel labelFinished = TextLabel::New("مرحبا بالعالم"); DALI_TEST_CHECK( labelImmediate ); DALI_TEST_CHECK( labelFinished ); @@ -605,6 +605,206 @@ int UtcDaliToolkitTextlabelScrollingP(void) END_TEST; } +int UtcDaliToolkitTextlabelScrollingCenterAlignP(void) +{ + ToolkitTestApplication application; + TextLabel labelShort = TextLabel::New("Some text to scroll"); + TextLabel labelLong = TextLabel::New("Some text to scroll that is greater than the width of the text. The quick brown fox jumps over the lazy dog. Hello World, we meet again!"); + + DALI_TEST_CHECK( labelShort ); + DALI_TEST_CHECK( labelLong ); + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + Stage::GetCurrent().Add( labelShort ); + // Turn on all the effects + labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelShort.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE ); + + Stage::GetCurrent().Add( labelLong ); + // Turn on all the effects + labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelLong.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP ); + + try + { + // Render some text with the shared atlas backend + labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + application.SendNotification(); + application.Render(); + + labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + application.SendNotification(); + application.Render(); + + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + END_TEST; +} + +int UtcDaliToolkitTextlabelScrollingCenterAlignRTLP(void) +{ + ToolkitTestApplication application; + TextLabel labelShort = TextLabel::New("مرحبا بالعالم"); + TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي"); + + DALI_TEST_CHECK( labelShort ); + DALI_TEST_CHECK( labelLong ); + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + Stage::GetCurrent().Add( labelShort ); + // Turn on all the effects + labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelShort.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE ); + + Stage::GetCurrent().Add( labelLong ); + // Turn on all the effects + labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelLong.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP ); + + try + { + // Render some text with the shared atlas backend + labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + application.SendNotification(); + application.Render(); + + labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + application.SendNotification(); + application.Render(); + + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + END_TEST; +} + +int UtcDaliToolkitTextlabelScrollingEndAlignP(void) +{ + ToolkitTestApplication application; + TextLabel labelShort = TextLabel::New("Some text to scroll"); + TextLabel labelLong = TextLabel::New("Some text to scroll that is greater than the width of the text. The quick brown fox jumps over the lazy dog. Hello World, we meet again!"); + + DALI_TEST_CHECK( labelShort ); + DALI_TEST_CHECK( labelLong ); + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + Stage::GetCurrent().Add( labelShort ); + // Turn on all the effects + labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelShort.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE ); + + Stage::GetCurrent().Add( labelLong ); + // Turn on all the effects + labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelLong.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP ); + + try + { + // Render some text with the shared atlas backend + labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + application.SendNotification(); + application.Render(); + + labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + application.SendNotification(); + application.Render(); + + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + END_TEST; +} + +int UtcDaliToolkitTextlabelScrollingEndAlignRTLP(void) +{ + ToolkitTestApplication application; + TextLabel labelShort = TextLabel::New("مرحبا بالعالم"); + TextLabel labelLong = TextLabel::New("لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار النشوة وتمجيد الألم نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي"); + + DALI_TEST_CHECK( labelShort ); + DALI_TEST_CHECK( labelLong ); + // Avoid a crash when core load gl resources. + application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); + Stage::GetCurrent().Add( labelShort ); + // Turn on all the effects + labelShort.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelShort.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelShort.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelShort.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE ); + + Stage::GetCurrent().Add( labelLong ); + // Turn on all the effects + labelLong.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelLong.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "END" ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelLong.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelLong.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP ); + + try + { + // Render some text with the shared atlas backend + labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + application.SendNotification(); + application.Render(); + + labelShort.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + labelLong.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + application.SendNotification(); + application.Render(); + + } + catch( ... ) + { + tet_result(TET_FAIL); + } + + END_TEST; +} + int UtcDaliToolkitTextlabelScrollingInterruptedP(void) { ToolkitTestApplication application; diff --git a/dali-toolkit/devel-api/controls/control-devel.cpp b/dali-toolkit/devel-api/controls/control-devel.cpp index 648602f..77b2368 100644 --- a/dali-toolkit/devel-api/controls/control-devel.cpp +++ b/dali-toolkit/devel-api/controls/control-devel.cpp @@ -18,9 +18,13 @@ // CLASS HEADER #include "control-devel.h" +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -33,7 +37,6 @@ namespace DevelControl ResourceReadySignalType& ResourceReadySignal( Control& control ) { - Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control); Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl ); @@ -48,6 +51,48 @@ bool IsResourceReady( const Control& control ) return controlImpl.IsResourceReady(); } +void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual ) +{ + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control ); + controlImpl.RegisterVisual( index, visual ); +} + +void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled ) +{ + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control ); + controlImpl.RegisterVisual( index, visual, enabled ); +} + +void UnregisterVisual( Internal::Control& control, Dali::Property::Index index ) +{ + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control ); + controlImpl.UnregisterVisual( index ); +} + +Toolkit::Visual::Base GetVisual( const Internal::Control& control, Dali::Property::Index index ) +{ + const Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control ); + return controlImpl.GetVisual( index ); +} + +void EnableVisual( Internal::Control& control, Dali::Property::Index index, bool enable ) +{ + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control ); + controlImpl.EnableVisual( index, enable ); +} + +bool IsVisualEnabled( const Internal::Control& control, Dali::Property::Index index ) +{ + const Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control ); + return controlImpl.IsVisualEnabled( index ); +} + +Dali::Animation CreateTransition( Internal::Control& control, const Toolkit::TransitionData& handle ) +{ + Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( control ); + return controlImpl.CreateTransition( handle ); +} + } // namespace DevelControl diff --git a/dali-toolkit/devel-api/controls/control-devel.h b/dali-toolkit/devel-api/controls/control-devel.h index 63f5cf9..7795df1 100644 --- a/dali-toolkit/devel-api/controls/control-devel.h +++ b/dali-toolkit/devel-api/controls/control-devel.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_CONTROL_DEVEL_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. @@ -27,6 +27,13 @@ namespace Dali namespace Toolkit { +class TransitionData; + +namespace Visual +{ +class Base; +} + namespace DevelControl { @@ -121,7 +128,7 @@ typedef Signal ResourceReadySignalType; * void YourCallbackName( Control control ); * @endcode */ -ResourceReadySignalType& ResourceReadySignal( Control& control ); +DALI_IMPORT_API ResourceReadySignalType& ResourceReadySignal( Control& control ); /** * @brief Query if all resources required by a control are loaded and ready. @@ -129,7 +136,86 @@ ResourceReadySignalType& ResourceReadySignal( Control& control ); * @return true if the resources are loaded and ready, false otherwise * */ -bool IsResourceReady( const Control& control ); +DALI_IMPORT_API bool IsResourceReady( const Control& control ); + +/** + * @brief Register a visual by Property Index, linking an Actor to visual when required. + * In the case of the visual being an actor or control deeming visual not required then visual should be an empty handle. + * No parenting is done during registration, this should be done by derived class. + * + * @param[in] control The control + * @param[in] index The Property index of the visual, used to reference visual + * @param[in] visual The visual to register + * @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage. + * Use below API with enabled set to false if derived class wishes to control when visual is staged. + */ +DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual ); + +/** + * @brief Register a visual by Property Index, linking an Actor to visual when required. + * + * In the case of the visual being an actor or control deeming visual not required then visual should be an empty handle. + * If enabled is false then the visual is not set on stage until enabled by the derived class. + * @see EnableVisual + * + * @param[in] control The control + * @param[in] index The Property index of the visual, used to reference visual + * @param[in] visual The visual to register + * @param[in] enabled false if derived class wants to control when visual is set on stage. + * + */ +DALI_IMPORT_API void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled ); + +/** + * @brief Erase the entry matching the given index from the list of registered visuals + * + * @param[in] control The control + * @param[in] index The Property index of the visual, used to reference visual + */ +DALI_IMPORT_API void UnregisterVisual( Internal::Control& control, Dali::Property::Index index ); + +/** + * @brief Retrieve the visual associated with the given property index. + * + * @param[in] control The control + * @param[in] index The Property index of the visual. + * @return The registered visual if exist, otherwise empty handle. + * @note For managing object life-cycle, do not store the returned visual as a member which increments its reference count. + */ +DALI_IMPORT_API Toolkit::Visual::Base GetVisual( const Internal::Control& control, Dali::Property::Index index ); + +/** + * @brief Sets the given visual to be displayed or not when parent staged. + * + * @param[in] control The control + * @param[in] index The Property index of the visual + * @param[in] enable flag to set enabled or disabled. + */ +DALI_IMPORT_API void EnableVisual( Internal::Control& control, Dali::Property::Index index, bool enable ); + +/** + * @brief Queries if the given visual is to be displayed when parent staged. + * + * @param[in] control The control + * @param[in] index The Property index of the visual + * @return bool whether visual is enabled or not + */ +DALI_IMPORT_API bool IsVisualEnabled( const Internal::Control& control, Dali::Property::Index index ); + +/** + * @brief Create a transition effect on the control. + * + * Only generates an animation if the properties described in the transition + * data are staged (e.g. the visual is Enabled and the control is on stage). + * Otherwise the target values are stored, and will get set onto the properties + * when the visual is next staged. + * + * @param[in] control The control + * @param[in] transitionData The transition data describing the effect to create + * @return A handle to an animation defined with the given effect, or an empty + * handle if no properties match. + */ +DALI_IMPORT_API Dali::Animation CreateTransition( Internal::Control& control, const Toolkit::TransitionData& transitionData ); } // namespace DevelControl diff --git a/dali-toolkit/devel-api/controls/control-wrapper-impl.cpp b/dali-toolkit/devel-api/controls/control-wrapper-impl.cpp index d3fcc56..fbbfa2e 100755 --- a/dali-toolkit/devel-api/controls/control-wrapper-impl.cpp +++ b/dali-toolkit/devel-api/controls/control-wrapper-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -26,6 +26,7 @@ // INTERNAL INCLUDES #include +#include #include #include #include @@ -121,37 +122,37 @@ bool ControlWrapper::RelayoutDependentOnChildrenBase( Dimension::Type dimension void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual ) { - Control::RegisterVisual( index, visual ); + DevelControl::RegisterVisual( *this, index, visual ); } void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled ) { - Control::RegisterVisual( index, visual, enabled ); + DevelControl::RegisterVisual( *this, index, visual, enabled ); } void ControlWrapper::UnregisterVisual( Property::Index index ) { - Control::UnregisterVisual( index ); + DevelControl::UnregisterVisual( *this, index ); } Toolkit::Visual::Base ControlWrapper::GetVisual( Property::Index index ) const { - return Control::GetVisual( index ); + return DevelControl::GetVisual( *this, index ); } void ControlWrapper::EnableVisual( Property::Index index, bool enable ) { - Control::EnableVisual( index, enable ); + DevelControl::EnableVisual( *this, index, enable ); } bool ControlWrapper::IsVisualEnabled( Property::Index index ) const { - return Control::IsVisualEnabled( index ); + return DevelControl::IsVisualEnabled( *this, index ); } Dali::Animation ControlWrapper::CreateTransition( const Toolkit::TransitionData& handle ) { - return Control::CreateTransition( handle ); + return DevelControl::CreateTransition( *this, handle ); } void ControlWrapper::ApplyThemeStyle() diff --git a/dali-toolkit/devel-api/controls/control-wrapper-impl.h b/dali-toolkit/devel-api/controls/control-wrapper-impl.h index 33905a5..85bc26c 100755 --- a/dali-toolkit/devel-api/controls/control-wrapper-impl.h +++ b/dali-toolkit/devel-api/controls/control-wrapper-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_CONTROL_WRAPPER_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. @@ -28,6 +28,13 @@ namespace Dali namespace Toolkit { +class TransitionData; + +namespace Visual +{ +class Base; +} + namespace Internal { @@ -104,37 +111,37 @@ public: // From CustomActorImpl public: // From Control /** - * @copydoc Dali::Toolkit::Internal::Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual ) + * @ref Dali::Toolkit::DevelControl::RegisterVisual() */ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual ); /** - * @copydoc Dali::Toolkit::Internal::Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled ) + * @ref Dali::Toolkit::DevelControl::RegisterVisual() */ void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled ); /** - * @copydoc Dali::Toolkit::Internal::Control::UnregisterVisual() + * @ref Dali::Toolkit::DevelControl::UnregisterVisual() */ void UnregisterVisual( Property::Index index ); /** - * @copydoc Dali::Toolkit::Internal::Control::GetVisual() + * @ref Dali::Toolkit::DevelControl::GetVisual() */ Toolkit::Visual::Base GetVisual( Property::Index index ) const; /** - * @copydoc Dali::Toolkit::Internal::Control::EnableVisual() + * @ref Dali::Toolkit::DevelControl::EnableVisual() */ void EnableVisual( Property::Index index, bool enable ); /** - * @copydoc Dali::Toolkit::Internal::Control::IsVisualEnabled() + * @ref Dali::Toolkit::DevelControl::IsVisualEnabled() */ bool IsVisualEnabled( Property::Index index ) const; /** - * @copydoc Dali::Toolkit::Internal::Control::CreateTransition() + * @ref Dali::Toolkit::DevelControl::CreateTransition() */ Dali::Animation CreateTransition( const Toolkit::TransitionData& transitionData ); diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index d580457..b52e46c 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -385,7 +386,7 @@ void Button::MergeWithExistingLabelProperties( const Property::Map& inMap, Prope * 3) Merge with new properties ( settings ) * 4) Return new merged map */ - Toolkit::Visual::Base visual = GetVisual( Toolkit::Button::Property::LABEL ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, Toolkit::Button::Property::LABEL ); if ( visual ) { DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "MergeLabelProperties Visual already exists, retrieving existing map\n"); @@ -451,13 +452,13 @@ void Button::CreateVisualsForComponent( Property::Index index, const Property::V if ( buttonVisual ) { DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "CreateVisualsForComponent RegisterVisual index(%d) enabled(%s)\n", - index, IsVisualEnabled( index )?"true":"false" ); + index, DevelControl::IsVisualEnabled( *this, index )?"true":"false" ); buttonVisual.SetDepthIndex( visualDepth ); - RegisterVisual( index, buttonVisual, IsVisualEnabled( index ) ); + DevelControl::RegisterVisual( *this, index, buttonVisual, DevelControl::IsVisualEnabled( *this, index ) ); } else { - UnregisterVisual( index ); + DevelControl::UnregisterVisual( *this, index ); DALI_LOG_INFO( gLogButtonFilter, Debug::General, "CreateVisualsForComponent Visual not created or empty map (clearing visual).(%d)\n", index); } PerformFunctionOnVisualsInState( &Button::SelectRequiredVisual, mButtonState ); @@ -467,7 +468,7 @@ bool Button::GetPropertyMapForVisual( Property::Index visualIndex, Property::Map { DALI_LOG_INFO( gLogButtonFilter, Debug::General, "GetPropertyMapForVisual visual(%d)\n", visualIndex); bool success = false; - Toolkit::Visual::Base visual = GetVisual( visualIndex ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, visualIndex ); if ( visual ) { visual.CreatePropertyMap( retreivedMap ); @@ -787,7 +788,7 @@ Vector3 Button::GetNaturalSize() for ( int state = Button::UNSELECTED_STATE; state < Button::STATE_COUNT; state++ ) { - Toolkit::Visual::Base visual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND] ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND] ); Size visualSize; if ( visual ) { @@ -802,7 +803,7 @@ Vector3 Button::GetNaturalSize() { for ( int state = Button::UNSELECTED_STATE; state < Button::STATE_COUNT; state++ ) { - Toolkit::Visual::Base visual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[state][BACKGROUND] ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, GET_VISUAL_INDEX_FOR_STATE[state][BACKGROUND] ); Size visualSize; if ( visual ) { @@ -830,7 +831,7 @@ Vector3 Button::GetNaturalSize() // Get natural size of label if text has been set if ( mTextStringSetFlag ) { - Toolkit::Visual::Base visual = GetVisual( Toolkit::Button::Property::LABEL ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, Toolkit::Button::Property::LABEL ); if ( visual ) { @@ -883,9 +884,9 @@ void Button::OnRelayout( const Vector2& size, RelayoutContainer& container ) { DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout targetSize(%f,%f) ptr(%p) state[%d]\n", size.width, size.height, this, mButtonState ); - Toolkit::Visual::Base currentVisual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[mButtonState][FOREGROUND] ); + Toolkit::Visual::Base currentVisual = DevelControl::GetVisual( *this, GET_VISUAL_INDEX_FOR_STATE[mButtonState][FOREGROUND] ); - Toolkit::Visual::Base currentBackGroundVisual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[mButtonState][BACKGROUND] ); + Toolkit::Visual::Base currentBackGroundVisual = DevelControl::GetVisual( *this, GET_VISUAL_INDEX_FOR_STATE[mButtonState][BACKGROUND] ); // Sizes and padding set to zero, if not present then values will no effect calculations. Vector2 visualPosition = Vector2::ZERO; @@ -1006,7 +1007,7 @@ void Button::OnRelayout( const Vector2& size, RelayoutContainer& container ) if ( mTextStringSetFlag ) { - Toolkit::Visual::Base textVisual = GetVisual( Toolkit::Button::Property::LABEL ); // No need to search for Label visual if no text set. + Toolkit::Visual::Base textVisual = DevelControl::GetVisual( *this, Toolkit::Button::Property::LABEL ); // No need to search for Label visual if no text set. if ( textVisual ) { @@ -1101,7 +1102,7 @@ void Button::SelectRequiredVisual( Property::Index visualIndex ) { DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SelectRequiredVisual index(%d) state(%d)\n", visualIndex, mButtonState ); - EnableVisual( visualIndex, true ); + DevelControl::EnableVisual( *this, visualIndex, true ); } void Button::RemoveVisual( Property::Index visualIndex ) @@ -1109,11 +1110,11 @@ void Button::RemoveVisual( Property::Index visualIndex ) // Use OnButtonVisualRemoval if want button developer to have the option to override removal. DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::RemoveVisual index(%d) state(%d)\n", visualIndex, mButtonState ); - Toolkit::Visual::Base visual = GetVisual( visualIndex ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, visualIndex ); if( visual ) { - EnableVisual( visualIndex, false ); + DevelControl::EnableVisual( *this, visualIndex, false ); } } @@ -1511,7 +1512,7 @@ void Button::SetBackgroundImage( const std::string& filename ) } else { - UnregisterVisual( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL ); + DevelControl::UnregisterVisual( *this, Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL ); } } @@ -1528,7 +1529,7 @@ void Button::SetSelectedBackgroundImage( const std::string& filename ) } else { - UnregisterVisual( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL ); + DevelControl::UnregisterVisual( *this, Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL ); } } @@ -1559,7 +1560,7 @@ void Button::SetDisabledSelectedImage( const std::string& filename ) // Used by Deprecated Properties which don't use the Visual Property maps for setting and getting std::string Button::GetUrlForImageVisual( const Property::Index index ) const { - Toolkit::Visual::Base visual = GetVisual( index ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, index ); std::string result; if ( visual ) diff --git a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp index 0e2b58c..36366cb 100755 --- a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp @@ -29,6 +29,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include @@ -304,13 +305,13 @@ const std::vector& ToggleButton::GetToggleTooltips() const void ToggleButton::PrepareVisual(Property::Index index, Toolkit::Visual::Base& visual) { - RegisterVisual( index, visual, true ); - EnableVisual( index, false ); + DevelControl::RegisterVisual( *this, index, visual, true ); + DevelControl::EnableVisual( *this, index, false ); } void ToggleButton::RelayoutVisual( Property::Index index, const Vector2& size ) { - Toolkit::Visual::Base visual = GetVisual( index ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, index ); if ( visual ) { Size visualSize = Size::ZERO; diff --git a/dali-toolkit/internal/controls/control/control-data-impl.cpp b/dali-toolkit/internal/controls/control/control-data-impl.cpp index 38c9a57..f20e489 100644 --- a/dali-toolkit/internal/controls/control/control-data-impl.cpp +++ b/dali-toolkit/internal/controls/control/control-data-impl.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include #include @@ -93,6 +94,21 @@ Toolkit::DevelVisual::Type GetVisualTypeFromMap( const Property::Map& map ) return type; } +/** + * Finds visual in given array, returning true if found along with the iterator for that visual as a out parameter + */ +bool FindVisual( Property::Index targetIndex, const RegisteredVisualContainer& visuals, RegisteredVisualContainer::Iterator& iter ) +{ + for ( iter = visuals.Begin(); iter != visuals.End(); iter++ ) + { + if ( (*iter)->index == targetIndex ) + { + return true; + } + } + return false; +} + void FindChangableVisuals( Dictionary& stateVisualsToAdd, Dictionary& stateVisualsToChange, DictionaryKeys& stateVisualsToRemove) @@ -113,6 +129,25 @@ void FindChangableVisuals( Dictionary& stateVisualsToAdd, } } +Toolkit::Visual::Base GetVisualByName( + const RegisteredVisualContainer& visuals, + const std::string& visualName ) +{ + Toolkit::Visual::Base visualHandle; + + RegisteredVisualContainer::Iterator iter; + for ( iter = visuals.Begin(); iter != visuals.End(); iter++ ) + { + Toolkit::Visual::Base visual = (*iter)->visual; + if( visual && visual.GetName() == visualName ) + { + visualHandle = visual; + break; + } + } + return visualHandle; +} + /** * Performs actions as requested using the action name. * @param[in] object The object on which to perform the action. @@ -225,8 +260,6 @@ TypeAction registerAction( typeRegistration, ACTION_ACCESSIBILITY_ACTIVATED, &Do DALI_TYPE_REGISTRATION_END() - - } // unnamed namespace @@ -285,28 +318,6 @@ const Control::Impl& Control::Impl::Get( const Internal::Control& internalContro return *internalControl.mImpl; } - - - -Toolkit::Visual::Base Control::Impl::GetVisualByName( - RegisteredVisualContainer& visuals, - const std::string& visualName ) -{ - Toolkit::Visual::Base visualHandle; - - RegisteredVisualContainer::Iterator iter; - for ( iter = visuals.Begin(); iter != visuals.End(); iter++ ) - { - Toolkit::Visual::Base visual = (*iter)->visual; - if( visual && visual.GetName() == visualName ) - { - visualHandle = visual; - break; - } - } - return visualHandle; -} - // Gesture Detection Methods void Control::Impl::PinchDetected(Actor actor, const PinchGesture& pinch) { @@ -369,6 +380,139 @@ bool Control::Impl::IsResourceReady() const } return true; } + +void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual ) +{ + RegisterVisual( index, visual, true ); +} + +void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled ) +{ + bool visualReplaced ( false ); + Actor self = mControlImpl.Self(); + + if( !mVisuals.Empty() ) + { + RegisteredVisualContainer::Iterator iter; + // Check if visual (index) is already registered. Replace if so. + if ( FindVisual( index, mVisuals, iter ) ) + { + if( (*iter)->visual && self.OnStage() ) + { + Toolkit::GetImplementation((*iter)->visual).SetOffStage( self ); + } + + StopObservingVisual( (*iter)->visual ); + StartObservingVisual( visual ); + + (*iter)->visual = visual; + visualReplaced = true; + } + } + + // If not set, set the name of the visual to the same name as the control's property. + // ( If the control has been type registered ) + if( visual.GetName().empty() ) + { + // Check if the control has been type registered: + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid( mControlImpl ) ); + if( typeInfo ) + { + // Check if the property index has been registered: + Property::IndexContainer indices; + typeInfo.GetPropertyIndices( indices ); + Property::IndexContainer::Iterator iter = std::find( indices.Begin(), indices.End(), index ); + if( iter != indices.End() ) + { + // If it has, then get it's name and use that for the visual + std::string visualName = typeInfo.GetPropertyName( index ); + visual.SetName( visualName ); + } + } + } + + if( !visualReplaced ) // New registration entry + { + mVisuals.PushBack( new RegisteredVisual( index, visual, enabled ) ); + + // monitor when the visuals resources are ready + StartObservingVisual( visual ); + + } + + if( visual && self.OnStage() && enabled ) + { + Toolkit::GetImplementation(visual).SetOnStage( self ); + } + + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n", visual.GetName().c_str(), index, enabled?"T":"F" ); +} + +void Control::Impl::UnregisterVisual( Property::Index index ) +{ + RegisteredVisualContainer::Iterator iter; + if ( FindVisual( index, mVisuals, iter ) ) + { + // stop observing visual + StopObservingVisual( (*iter)->visual ); + + Actor self( mControlImpl.Self() ); + Toolkit::GetImplementation((*iter)->visual).SetOffStage( self ); + (*iter)->visual.Reset(); + mVisuals.Erase( iter ); + } +} + +Toolkit::Visual::Base Control::Impl::GetVisual( Property::Index index ) const +{ + RegisteredVisualContainer::Iterator iter; + if ( FindVisual( index, mVisuals, iter ) ) + { + return (*iter)->visual; + } + + return Toolkit::Visual::Base(); +} + +void Control::Impl::EnableVisual( Property::Index index, bool enable ) +{ + RegisteredVisualContainer::Iterator iter; + if ( FindVisual( index, mVisuals, iter ) ) + { + if ( (*iter)->enabled == enable ) + { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual %s(%d) already %s\n", (*iter)->visual.GetName().c_str(), index, enable?"enabled":"disabled"); + return; + } + + (*iter)->enabled = enable; + Actor parentActor = mControlImpl.Self(); + if ( mControlImpl.Self().OnStage() ) // If control not on Stage then Visual will be added when StageConnection is called. + { + if ( enable ) + { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) on stage \n", (*iter)->visual.GetName().c_str(), index ); + Toolkit::GetImplementation((*iter)->visual).SetOnStage( parentActor ); + } + else + { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) off stage \n", (*iter)->visual.GetName().c_str(), index ); + Toolkit::GetImplementation((*iter)->visual).SetOffStage( parentActor ); // No need to call if control not staged. + } + } + } +} + +bool Control::Impl::IsVisualEnabled( Property::Index index ) const +{ + RegisteredVisualContainer::Iterator iter; + if ( FindVisual( index, mVisuals, iter ) ) + { + return (*iter)->enabled; + } + return false; +} + void Control::Impl::StopObservingVisual( Toolkit::Visual::Base& visual ) { Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); @@ -385,14 +529,70 @@ void Control::Impl::StartObservingVisual( Toolkit::Visual::Base& visual) visualImpl.AddResourceObserver( *this ); } -// Properties +Dali::Animation Control::Impl::CreateTransition( const Toolkit::TransitionData& handle ) +{ + Dali::Animation transition; + const Internal::TransitionData& transitionData = Toolkit::GetImplementation( handle ); + + if( transitionData.Count() > 0 ) + { + // Setup a Transition from TransitionData. + TransitionData::Iterator end = transitionData.End(); + for( TransitionData::Iterator iter = transitionData.Begin() ; + iter != end; ++iter ) + { + TransitionData::Animator* animator = (*iter); + + Toolkit::Visual::Base visual = GetVisualByName( mVisuals, animator->objectName ); + + if( visual ) + { + Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); + visualImpl.AnimateProperty( transition, *animator ); + } + else + { + // Otherwise, try any actor children of control (Including the control) + Actor child = mControlImpl.Self().FindChildByName( animator->objectName ); + if( child ) + { + Property::Index propertyIndex = DevelHandle::GetPropertyIndex( child, animator->propertyKey ); + if( propertyIndex != Property::INVALID_INDEX ) + { + if( animator->animate == false ) + { + if( animator->targetValue.GetType() != Property::NONE ) + { + child.SetProperty( propertyIndex, animator->targetValue ); + } + } + else // animate the property + { + if( animator->initialValue.GetType() != Property::NONE ) + { + child.SetProperty( propertyIndex, animator->initialValue ); + } + + if( ! transition ) + { + transition = Dali::Animation::New( 0.1f ); + } + + transition.AnimateTo( Property( child, propertyIndex ), + animator->targetValue, + animator->alphaFunction, + TimePeriod( animator->timePeriodDelay, + animator->timePeriodDuration ) ); + } + } + } + } + } + } + + return transition; +} -/** - * Called when a property of an object of this type is set. - * @param[in] object The object whose property is set. - * @param[in] index The property index. - * @param[in] value The new property value. - */ void Control::Impl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) { Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) ); @@ -537,7 +737,7 @@ void Control::Impl::SetProperty( BaseObject* object, Property::Index index, cons Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( url, ImageDimensions() ); if( visual ) { - controlImpl.RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual ); + controlImpl.mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual ); visual.SetDepthIndex( DepthIndex::BACKGROUND ); } } @@ -566,12 +766,6 @@ void Control::Impl::SetProperty( BaseObject* object, Property::Index index, cons } } -/** - * Called to retrieve a property of an object of this type. - * @param[in] object The object whose property is to be retrieved. - * @param[in] index The property index. - * @return The current value of the property. - */ Property::Value Control::Impl::GetProperty( BaseObject* object, Property::Index index ) { Property::Value value; @@ -637,7 +831,7 @@ Property::Value Control::Impl::GetProperty( BaseObject* object, Property::Index { DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" ); Property::Map map; - Toolkit::Visual::Base visual = controlImpl.GetVisual( Toolkit::Control::Property::BACKGROUND ); + Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND ); if( visual ) { visual.CreatePropertyMap( map ); @@ -655,7 +849,7 @@ Property::Value Control::Impl::GetProperty( BaseObject* object, Property::Index case Toolkit::Control::Property::BACKGROUND: { Property::Map map; - Toolkit::Visual::Base visual = controlImpl.GetVisual( Toolkit::Control::Property::BACKGROUND ); + Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND ); if( visual ) { visual.CreatePropertyMap( map ); @@ -725,12 +919,6 @@ void Control::Impl::RemoveVisuals( RegisteredVisualContainer& visuals, Dictionar } } - -/** - * Go through the list of visuals that are common to both states. - * If they are different types, or are both image types with different - * URLs, then the existing visual needs moving and the new visual creating - */ void Control::Impl::RecreateChangedVisuals( Dictionary& stateVisualsToChange, Dictionary& instancedProperties ) { diff --git a/dali-toolkit/internal/controls/control/control-data-impl.h b/dali-toolkit/internal/controls/control/control-data-impl.h index 4adfe65..2ee216f 100644 --- a/dali-toolkit/internal/controls/control/control-data-impl.h +++ b/dali-toolkit/internal/controls/control/control-data-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_CONTROL_DATA_IMPL_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. @@ -60,56 +60,193 @@ typedef Dali::OwnerContainer< RegisteredVisual* > RegisteredVisualContainer; /** - * Holds the Implementation for the internal control class + * @brief Holds the Implementation for the internal control class */ class Control::Impl : public ConnectionTracker, public Visual::ResourceObserver { public: + /** + * @brief Retrieves the implementation of the internal control class. + * @param[in] internalControl A ref to the control whose internal implementation is required + * @return The internal implementation + */ static Control::Impl& Get( Internal::Control& internalControl ); + /** + * @copydoc Get( Internal::Control& ) + */ static const Control::Impl& Get( const Internal::Control& internalControl ); - + /** + * @brief Constructor. + * @param[in] controlImpl The control which own this implementation + */ Impl( Control& controlImpl ); + /** + * @brief Destructor. + */ ~Impl(); + /** + * @brief Called when a pinch is detected. + * @param[in] actor The actor the pinch occurred on + * @param[in] pinch The pinch gesture details + */ void PinchDetected(Actor actor, const PinchGesture& pinch); + /** + * @brief Called when a pan is detected. + * @param[in] actor The actor the pan occurred on + * @param[in] pinch The pan gesture details + */ void PanDetected(Actor actor, const PanGesture& pan); + /** + * @brief Called when a tap is detected. + * @param[in] actor The actor the tap occurred on + * @param[in] pinch The tap gesture details + */ void TapDetected(Actor actor, const TapGesture& tap); + /** + * @brief Called when a long-press is detected. + * @param[in] actor The actor the long-press occurred on + * @param[in] pinch The long-press gesture details + */ void LongPressDetected(Actor actor, const LongPressGesture& longPress); - void ResourceReady( Visual::Base& object); - + /** + * @brief Called when a resource is ready. + * @param[in] object The visual whose resources are ready + * @note Overriding method in Visual::ResourceObserver. + */ + virtual void ResourceReady( Visual::Base& object ); + + /** + * @copydoc Dali::Toolkit::DevelControl::RegisterVisual() + */ + void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual ); + + /** + * @copydoc Dali::Toolkit::DevelControl::RegisterVisual() + */ + void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled ); + + /** + * @copydoc Dali::Toolkit::DevelControl::UnregisterVisual() + */ + void UnregisterVisual( Property::Index index ); + + /** + * @copydoc Dali::Toolkit::DevelControl::GetVisual() + */ + Toolkit::Visual::Base GetVisual( Property::Index index ) const; + + /** + * @copydoc Dali::Toolkit::DevelControl::EnableVisual() + */ + void EnableVisual( Property::Index index, bool enable ); + + /** + * @copydoc Dali::Toolkit::DevelControl::IsVisualEnabled() + */ + bool IsVisualEnabled( Property::Index index ) const; + + /** + * @brief Stops observing the given visual. + * @param[in] visual The visual to stop observing + */ void StopObservingVisual( Toolkit::Visual::Base& visual ); + /** + * @brief Starts observing the given visual. + * @param[in] visual The visual to start observing + */ void StartObservingVisual( Toolkit::Visual::Base& visual); + /** + * @copydoc Dali::Toolkit::DevelControl::CreateTransition() + */ + Dali::Animation CreateTransition( const Toolkit::TransitionData& transitionData ); + + /** + * @brief Function used to set control properties. + * @param[in] object The object whose property to set + * @param[in] index The index of the property to set + * @param[in] value The value of the property to set + */ static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ); + /** + * @brief Function used to retrieve the value of control properties. + * @param[in] object The object whose property to get + * @param[in] index The index of the property to get + * @return The value of the property + */ static Property::Value GetProperty( BaseObject* object, Property::Index index ); + /** + * @brief Sets the state of the control. + * @param[in] newState The state to set + * @param[in] withTransitions Whether to show a transition when changing to the new state + */ void SetState( DevelControl::State newState, bool withTransitions=true ); + /** + * @brief Sets the sub-state of the control. + * @param[in] newState The sub-state to set + * @param[in] withTransitions Whether to show a transition when changing to the new sub-state + */ void SetSubState( const std::string& subStateName, bool withTransitions=true ); + /** + * @brief Replaces visuals and properties from the old state to the new state. + * @param[in] oldState The old state + * @param[in] newState The new state + * @param[in] subState The current sub state + */ void ReplaceStateVisualsAndProperties( const StylePtr oldState, const StylePtr newState, const std::string& subState ); + /** + * @brief Removes a visual from the control's container. + * @param[in] visuals The container of visuals + * @param[in] visualName The name of the visual to remove + */ void RemoveVisual( RegisteredVisualContainer& visuals, const std::string& visualName ); + /** + * @brief Removes several visuals from the control's container. + * @param[in] visuals The container of visuals + * @param[in] removeVisuals The visuals to remove + */ void RemoveVisuals( RegisteredVisualContainer& visuals, DictionaryKeys& removeVisuals ); - void CopyInstancedProperties( RegisteredVisualContainer& visuals, Dictionary& instancedProperties ); - + /** + * @brief Copies the visual properties that are specific to the control instance into the instancedProperties container. + * @param[in] visuals The control's visual container + * @param[out] instancedProperties The instanced properties are added to this container + */ + void CopyInstancedProperties( RegisteredVisualContainer& visuals, Dictionary& instancedProperties ); + + /** + * @brief On state change, ensures visuals are moved or created appropriately. + * + * Go through the list of visuals that are common to both states. + * If they are different types, or are both image types with different + * URLs, then the existing visual needs moving and the new visual needs creating + * + * @param[in] stateVisualsToChange The visuals to change + * @param[in] instancedProperties The instanced properties @see CopyInstancedProperties + */ void RecreateChangedVisuals( Dictionary& stateVisualsToChange, Dictionary& instancedProperties ); - Toolkit::Visual::Base GetVisualByName( RegisteredVisualContainer& visuals, const std::string& visualName ); - + /** + * @brief Whether the resource is ready + * @return True if the resource is read. + */ bool IsResourceReady() const; Control& mControlImpl; @@ -121,7 +258,6 @@ public: int mUpFocusableActorId; ///< Actor ID of Up focusable control. int mDownFocusableActorId; ///< Actor ID of Down focusable control. - RegisteredVisualContainer mVisuals; ///< Stores visuals needed by the control, non trivial type so std::vector used. std::string mStyleName; Vector4 mBackgroundColor; ///< The color of the background visual @@ -158,7 +294,6 @@ public: static const PropertyRegistration PROPERTY_10; static const PropertyRegistration PROPERTY_11; static const PropertyRegistration PROPERTY_12; - }; diff --git a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp index 08cfc16..db76861 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp @@ -33,6 +33,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include @@ -193,7 +194,7 @@ void EffectsView::SetType( Toolkit::EffectsView::EffectType type ) FrameBufferImage dummyImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat ); Internal::InitializeVisual( self, mVisualPostFilter, dummyImage ); - RegisterVisual( POST_FILTER_VISUAL, mVisualPostFilter ); + DevelControl::RegisterVisual( *this, POST_FILTER_VISUAL, mVisualPostFilter ); Property::Map customShader; customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = EFFECTS_VIEW_VERTEX_SOURCE; @@ -427,7 +428,7 @@ void EffectsView::AllocateResources() mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat ); Internal::InitializeVisual( self, mVisualForChildren, mImageForChildren ); - RegisterVisual( CHILD_VISUAL, mVisualForChildren ); + DevelControl::RegisterVisual( *this, CHILD_VISUAL, mVisualForChildren ); mVisualForChildren.SetDepthIndex( DepthIndex::CONTENT+1 ); mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat ); diff --git a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp index 80f1ee4..65e043e 100644 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp @@ -1,4 +1,19 @@ -// 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // CLASS HEADER #include "image-view-impl.h" @@ -11,6 +26,7 @@ // INTERNAL INCLUDES #include +#include #include #include #include @@ -79,7 +95,7 @@ void ImageView::SetImage( Image image ) mPropertyMap.Clear(); mVisual = Toolkit::VisualFactory::Get().CreateVisual( image ); - RegisterVisual( Toolkit::ImageView::Property::IMAGE, mVisual ); + DevelControl::RegisterVisual( *this, Toolkit::ImageView::Property::IMAGE, mVisual ); RelayoutRequest(); } @@ -92,7 +108,7 @@ void ImageView::SetImage( const Property::Map& map ) mImage.Reset(); mVisual = Toolkit::VisualFactory::Get().CreateVisual( mPropertyMap ); - RegisterVisual( Toolkit::ImageView::Property::IMAGE, mVisual ); + DevelControl::RegisterVisual( *this, Toolkit::ImageView::Property::IMAGE, mVisual ); RelayoutRequest(); } @@ -105,7 +121,7 @@ void ImageView::SetImage( const std::string& url, ImageDimensions size ) mPropertyMap.Clear(); mVisual = Toolkit::VisualFactory::Get().CreateVisual( url, size ); - RegisterVisual( Toolkit::ImageView::Property::IMAGE, mVisual ); + DevelControl::RegisterVisual( *this, Toolkit::ImageView::Property::IMAGE, mVisual ); RelayoutRequest(); } diff --git a/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp b/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp index cddfa35..24b1aa4 100755 --- a/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp +++ b/dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -131,11 +132,11 @@ void ProgressBar::OnRelayout( const Vector2& size, RelayoutContainer& container trackSize.width = std::max( 0.0f, size.width ); // Ensure we don't go negative - Toolkit::Visual::Base trackVisual = GetVisual( Toolkit::ProgressBar::Property::TRACK_VISUAL ); - Toolkit::Visual::Base secondProgressVisual = GetVisual( Toolkit::ProgressBar::Property::SECONDARY_PROGRESS_VISUAL ); - Toolkit::Visual::Base progressVisual = GetVisual( Toolkit::ProgressBar::Property::PROGRESS_VISUAL ); - Toolkit::Visual::Base labelVisual = GetVisual( Toolkit::ProgressBar::Property::LABEL_VISUAL ); - Toolkit::Visual::Base indeterminateVisual = GetVisual( Toolkit::ProgressBar::Property::INDETERMINATE_VISUAL ); + Toolkit::Visual::Base trackVisual = DevelControl::GetVisual( *this, Toolkit::ProgressBar::Property::TRACK_VISUAL ); + Toolkit::Visual::Base secondProgressVisual = DevelControl::GetVisual( *this, Toolkit::ProgressBar::Property::SECONDARY_PROGRESS_VISUAL ); + Toolkit::Visual::Base progressVisual = DevelControl::GetVisual( *this, Toolkit::ProgressBar::Property::PROGRESS_VISUAL ); + Toolkit::Visual::Base labelVisual = DevelControl::GetVisual( *this, Toolkit::ProgressBar::Property::LABEL_VISUAL ); + Toolkit::Visual::Base indeterminateVisual = DevelControl::GetVisual( *this, Toolkit::ProgressBar::Property::INDETERMINATE_VISUAL ); if( trackVisual ) { @@ -197,8 +198,8 @@ void ProgressBar::OnRelayout( const Vector2& size, RelayoutContainer& container Vector3 ProgressBar::GetNaturalSize() { // Return the bigger size after comparing trackVisual naturalSize and labelVisual naturalSize - Toolkit::Visual::Base trackVisual = GetVisual( Toolkit::ProgressBar::Property::TRACK_VISUAL ); - Toolkit::Visual::Base labelVisual = GetVisual( Toolkit::ProgressBar::Property::LABEL_VISUAL ); + Toolkit::Visual::Base trackVisual = DevelControl::GetVisual( *this, Toolkit::ProgressBar::Property::TRACK_VISUAL ); + Toolkit::Visual::Base labelVisual = DevelControl::GetVisual( *this, Toolkit::ProgressBar::Property::LABEL_VISUAL ); Size trackSize; Size labelSize; @@ -275,7 +276,7 @@ float ProgressBar::GetSecondaryProgressValue() const void ProgressBar::SetIndeterminate( bool value ) { mIndeterminate = value; - EnableVisual( Toolkit::ProgressBar::Property::INDETERMINATE_VISUAL, mIndeterminate ); + DevelControl::EnableVisual( *this, Toolkit::ProgressBar::Property::INDETERMINATE_VISUAL, mIndeterminate ); if( mIndeterminate ) { @@ -316,7 +317,7 @@ void ProgressBar::PlayIndeterminateVisualTransition() mIndeterminateVisualAni.Clear(); } - mIndeterminateVisualAni = CreateTransition( mIndeterminateVisualTransition ); + mIndeterminateVisualAni = DevelControl::CreateTransition( *this, mIndeterminateVisualTransition ); if( mIndeterminate && mIndeterminateVisualAni ) { @@ -377,23 +378,23 @@ void ProgressBar::CreateVisualsForComponent( Property::Index index, const Proper progressVisual.SetDepthIndex( visualDepth ); if( index == Toolkit::ProgressBar::Property::INDETERMINATE_VISUAL ) { - RegisterVisual( index, progressVisual, mIndeterminate ); + DevelControl::RegisterVisual( *this, index, progressVisual, mIndeterminate ); } else { - RegisterVisual( index, progressVisual, true ); + DevelControl::RegisterVisual( *this, index, progressVisual, true ); } } else { - UnregisterVisual( index ); + DevelControl::UnregisterVisual( *this, index ); } } bool ProgressBar::GetPropertyMapForVisual( Property::Index visualIndex, Property::Map& retreivedMap ) const { bool success = false; - Toolkit::Visual::Base visual = GetVisual( visualIndex ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( *this, visualIndex ); if ( visual ) { @@ -468,7 +469,7 @@ void ProgressBar::SetProperty( BaseObject* object, Property::Index propertyIndex { // set new text string as TEXT property Property::Map newTextMap; - Toolkit::Visual::Base label = progressBarImpl.GetVisual( Toolkit::ProgressBar::Property::LABEL_VISUAL ); + Toolkit::Visual::Base label = DevelControl::GetVisual( progressBarImpl, Toolkit::ProgressBar::Property::LABEL_VISUAL ); if( label ) { diff --git a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp index a93257d..581b87e 100644 --- a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp @@ -30,6 +30,7 @@ #include // INTERNAL_INCLUDES +#include #include #include @@ -173,7 +174,7 @@ void SuperBlurView::SetImage(Image inputImage) Actor self( Self() ); mVisuals[0] = Toolkit::VisualFactory::Get().CreateVisual( mInputImage ); - RegisterVisual( 0, mVisuals[0] ); // Will clean up previously registered visuals for this index. + DevelControl::RegisterVisual( *this, 0, mVisuals[0] ); // Will clean up previously registered visuals for this index. mVisuals[0].SetDepthIndex(0); // custom shader is not applied on the original image. @@ -282,7 +283,7 @@ void SuperBlurView::OnSizeSet( const Vector3& targetSize ) GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT ); mVisuals[i] = Toolkit::VisualFactory::Get().CreateVisual( mBlurredImage[i - 1] ); - RegisterVisual( i, mVisuals[i] ); // Will clean up existing visual with same index. + DevelControl::RegisterVisual( *this, i, mVisuals[i] ); // Will clean up existing visual with same index. mVisuals[i].SetDepthIndex( i ); SetShaderEffect( mVisuals[i] ); } diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index b1c031c..ff6fc79 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -349,7 +349,7 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr { if( impl.mTextScroller ) { - impl.mTextScroller->SetLoopCount( 0 ); // Causes the current animation to finish playing (0) + impl.mTextScroller->StopScrolling(); } } // If request is enable (true) then start autoscroll as not already running @@ -881,7 +881,7 @@ void TextLabel::SetUpAutoScrolling() // If speed, loopCount or gap not set via property system then will need to create a TextScroller with defaults mTextScroller = Text::TextScroller::New( *this ); } - mTextScroller->SetParameters( mRenderableActor, controlSize, offScreenSize, direction, alignmentOffset ); + mTextScroller->SetParameters( mRenderableActor, controlSize, offScreenSize, direction, alignmentOffset, mController->GetHorizontalAlignment() ); Actor self = Self(); self.Add( mTextScroller->GetScrollingText() ); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index babd0eb..597fee1 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -352,7 +353,7 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER: { Property::Map map; - Toolkit::Visual::Base visual = impl.GetVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER ); + Toolkit::Visual::Base visual = DevelControl::GetVisual( impl, Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER ); if( visual ) { visual.CreatePropertyMap( map ); @@ -841,7 +842,7 @@ std::string TextSelectionPopup::GetPressedImage() const void TextSelectionPopup::CreateBackgroundBorder( Property::Map& propertyMap ) { // Removes previous image if necessary - UnregisterVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER ); + DevelControl::UnregisterVisual( *this, Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER ); if( ! propertyMap.Empty() ) { @@ -849,7 +850,7 @@ void TextSelectionPopup::CreateBackgroundBorder( Property::Map& propertyMap ) if( visual ) { - RegisterVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER, visual ); + DevelControl::RegisterVisual( *this, Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER, visual ); visual.SetDepthIndex( DepthIndex::CONTENT ); } } diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index e6aae87..15e5366 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -143,6 +143,18 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( Actor actor ) { bool success = false; + Actor currentFocusedActor = GetCurrentFocusActor(); + + // If developer set focus on same actor, doing nothing + if( actor == currentFocusedActor ) + { + if( !actor ) + { + return false; + } + return true; + } + // Check whether the actor is in the stage and is keyboard focusable. if( actor && actor.IsKeyboardFocusable() && actor.OnStage() ) { @@ -150,9 +162,8 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( Actor actor ) { actor.Add( GetFocusIndicatorActor() ); } - // Send notification for the change of focus actor - Actor currentFocusedActor = GetCurrentFocusActor(); + // Send notification for the change of focus actor if( !mFocusChangedSignal.Empty() ) { mFocusChangedSignal.Emit(currentFocusedActor, actor); diff --git a/dali-toolkit/internal/styling/style-manager-impl.cpp b/dali-toolkit/internal/styling/style-manager-impl.cpp index 98596eb..ba89d88 100644 --- a/dali-toolkit/internal/styling/style-manager-impl.cpp +++ b/dali-toolkit/internal/styling/style-manager-impl.cpp @@ -133,8 +133,7 @@ void StyleManager::ApplyTheme( const std::string& themeFile ) void StyleManager::ApplyDefaultTheme() { - std::string empty; - SetTheme( empty ); + SetTheme( DEFAULT_THEME ); } const std::string& StyleManager::GetDefaultFontFamily() const @@ -233,10 +232,10 @@ void StyleManager::SetTheme( const std::string& themeFile ) // Always load the default theme first, then merge in the custom theme if present themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME ); + mThemeFile = themeFile; - if( ! themeFile.empty() ) + if( themeFile.compare(DEFAULT_THEME) != 0 ) { - mThemeFile = themeFile; themeLoaded = LoadJSON( mThemeBuilder, mThemeFile ); } diff --git a/dali-toolkit/internal/text/layouts/layout-alignment.h b/dali-toolkit/internal/text/layouts/layout-alignment.h index df61ff2..339b321 100644 --- a/dali-toolkit/internal/text/layouts/layout-alignment.h +++ b/dali-toolkit/internal/text/layouts/layout-alignment.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_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,6 +53,12 @@ enum VerticalAlignment VERTICAL_ALIGN_BOTTOM }; +enum AlignmentCount +{ + HORIZONTAL_ALIGN_COUNT = HORIZONTAL_ALIGN_END + 1, + VERTICAL_ALIGN_COUNT = VERTICAL_ALIGN_BOTTOM + 1 +}; + } // namespace Layout } // namespace Text diff --git a/dali-toolkit/internal/text/text-controller-impl.h b/dali-toolkit/internal/text/text-controller-impl.h index 43a7cf3..3014edb 100644 --- a/dali-toolkit/internal/text/text-controller-impl.h +++ b/dali-toolkit/internal/text/text-controller-impl.h @@ -316,7 +316,8 @@ struct Controller::Impl mIsAutoScrollEnabled( false ), mAutoScrollDirectionRTL( false ), mUnderlineSetByString( false ), - mShadowSetByString( false ) + mShadowSetByString( false ), + mFontStyleSetByString( false ) { mModel = Model::New(); @@ -725,6 +726,7 @@ public: bool mUnderlineSetByString:1; ///< Set when underline is set by string (legacy) instead of map bool mShadowSetByString:1; ///< Set when shadow is set by string (legacy) instead of map + bool mFontStyleSetByString:1; ///< Set when font style is set by string (legacy) instead of map }; } // namespace Text diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index d02f9aa..a502200 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1438,6 +1438,16 @@ void Controller::ShadowSetByString( bool setByString ) mImpl->mShadowSetByString = setByString; } +bool Controller::IsFontStyleSetByString() +{ + return mImpl->mFontStyleSetByString; +} + +void Controller::FontStyleSetByString( bool setByString ) +{ + mImpl->mFontStyleSetByString = setByString; +} + // public : Queries & retrieves. Layout::Engine& Controller::GetLayoutEngine() diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index b9cbb2c..7562394 100644 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -422,6 +422,18 @@ public: // Configure the text controller. */ void ShadowSetByString( bool setByString ); + /** + * @brief Query if font style settings were provided by string or map + * @return bool true if set by string + */ + bool IsFontStyleSetByString(); + + /** + * Set method font style setting were set by + * @param[in] bool, true if set by string + */ + void FontStyleSetByString( bool setByString ); + public: // Update. /** diff --git a/dali-toolkit/internal/text/text-font-style.cpp b/dali-toolkit/internal/text/text-font-style.cpp index 6a57337..249157e 100644 --- a/dali-toolkit/internal/text/text-font-style.cpp +++ b/dali-toolkit/internal/text/text-font-style.cpp @@ -114,10 +114,13 @@ void SetFontStyleProperty( ControllerPtr controller, const Property::Value& valu const std::string& fontStyleProperties = value.Get(); ParsePropertyString( fontStyleProperties, map ); + controller->FontStyleSetByString( true ); + } else { map = value.Get(); + controller->FontStyleSetByString( false ); } if( !map.Empty() ) @@ -243,6 +246,7 @@ void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, Fon if( controller ) { const bool isDefaultStyle = FontStyle::DEFAULT == type; + const bool isSetbyString = controller->IsFontStyleSetByString(); bool weightDefined = false; bool widthDefined = false; @@ -294,46 +298,97 @@ void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, Fon } } - Property::Map map; - - if( weightDefined ) + if( !isSetbyString ) { - if( TextAbstraction::FontWeight::NONE != weight ) + Property::Map map; + + if( weightDefined ) { - const std::string weightStr( GetEnumerationName( weight, - FONT_WEIGHT_STRING_TABLE, - FONT_WEIGHT_STRING_TABLE_COUNT ) ); + if( TextAbstraction::FontWeight::NONE != weight ) + { + const std::string weightStr( GetEnumerationName( weight, + FONT_WEIGHT_STRING_TABLE, + FONT_WEIGHT_STRING_TABLE_COUNT ) ); - map.Insert( WEIGHT_KEY, weightStr ); + map.Insert( WEIGHT_KEY, weightStr ); + } } - } - if( widthDefined ) - { - if( TextAbstraction::FontWidth::NONE != width ) + if( widthDefined ) + { + if( TextAbstraction::FontWidth::NONE != width ) + { + const std::string widthStr( GetEnumerationName( width, + FONT_WIDTH_STRING_TABLE, + FONT_WIDTH_STRING_TABLE_COUNT ) ); + + map.Insert( WIDTH_KEY, widthStr ); + } + } + + if( slantDefined ) { - const std::string widthStr( GetEnumerationName( width, - FONT_WIDTH_STRING_TABLE, - FONT_WIDTH_STRING_TABLE_COUNT ) ); + if( TextAbstraction::FontSlant::NONE != slant ) + { + const std::string slantStr( GetEnumerationName( slant, + FONT_SLANT_STRING_TABLE, + FONT_SLANT_STRING_TABLE_COUNT ) ); - map.Insert( WIDTH_KEY, widthStr ); + map.Insert( SLANT_KEY, slantStr ); + } } - } - if( slantDefined ) + value = map; + } // SetbyMAP + else { - if( TextAbstraction::FontSlant::NONE != slant ) + std::string fontStyleProperties = "{"; + + if( weightDefined ) { - const std::string slantStr( GetEnumerationName( slant, - FONT_SLANT_STRING_TABLE, - FONT_SLANT_STRING_TABLE_COUNT ) ); + if( TextAbstraction::FontWeight::NONE != weight ) + { + const std::string weightStr( GetEnumerationName( weight, + FONT_WEIGHT_STRING_TABLE, + FONT_WEIGHT_STRING_TABLE_COUNT ) ); - map.Insert( SLANT_KEY, slantStr ); + fontStyleProperties += "\"weight\":\"" + weightStr + "\","; + } } - } - value = map; - } + if( widthDefined ) + { + if( TextAbstraction::FontWidth::NONE != width ) + { + const std::string widthStr( GetEnumerationName( width, + FONT_WIDTH_STRING_TABLE, + FONT_WIDTH_STRING_TABLE_COUNT ) ); + fontStyleProperties += "\"width\":\"" + widthStr + "\","; + } + } + + if( slantDefined ) + { + if( TextAbstraction::FontSlant::NONE != slant ) + { + const std::string slantStr( GetEnumerationName( slant, + FONT_SLANT_STRING_TABLE, + FONT_SLANT_STRING_TABLE_COUNT ) ); + + fontStyleProperties += "\"slant\":\"" + slantStr + "\""; + } + } + + // If last character is comma, it will be removed. + if((*fontStyleProperties.rbegin()) == ',' ) + { + fontStyleProperties = fontStyleProperties.substr( 0, fontStyleProperties.size()-1 ); + } + fontStyleProperties += "}"; + + value = fontStyleProperties; + } // SetbyString + }// controller } FontWeight StringToWeight( const char* const weightStr ) diff --git a/dali-toolkit/internal/text/text-scroller.cpp b/dali-toolkit/internal/text/text-scroller.cpp index c80cf7d..7d9933d 100644 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -58,7 +58,7 @@ const char* VERTEX_SHADER_SCROLL = DALI_COMPOSE_SHADER( uniform mediump float uDelta;\n uniform mediump vec2 uTextureSize; uniform mediump float uGap;\n - uniform mediump float uRtl;\n + uniform mediump float uAlign;\n \n void main()\n {\n @@ -70,7 +70,7 @@ const char* VERTEX_SHADER_SCROLL = DALI_COMPOSE_SHADER( float smallTextPadding = max(uSize.x - uTextureSize.x, 0. );\n float gap = max( uGap, smallTextPadding );\n float delta = floor ( uDelta ) + 0.5; - vTexCoord.x = ( delta + ( uRtl * ( uTextureSize.x - uSize.x ) ) + ( aPosition.x * uSize.x ) )/ ( uTextureSize.x + gap );\n + vTexCoord.x = ( delta + ( uAlign * ( uTextureSize.x - uSize.x ) ) + ( aPosition.x * uSize.x ) )/ ( uTextureSize.x + gap );\n vTexCoord.y = ( 0.5 + floor( aPosition.y * uSize.y ) )/ ( uTextureSize.y ) ;\n vRatio = uTextureSize.x / ( uTextureSize.x + gap );\n gl_Position = uProjection * vertexPosition; @@ -96,6 +96,54 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( ); /** + * @brief How the text should be aligned when scrolling the text. + * + * 0.0f aligns the text to the left, 1.0f aligns the text to the right. + * The final alignment depends on three factors: + * 1) The alignment value of the text label (Use Text::Layout::HorizontalAlignment enumerations). + * 2) The text direction, i.e. whether it's LTR or RTL (0 = LTR, 1 = RTL). + * 3) Whether the text is greater than the size of the control ( 0 = Text width <= Control width, 1 = Text width > Control width ). + */ +const float ALIGNMENT_TABLE[ Text::Layout::HORIZONTAL_ALIGN_COUNT ][ 2 ][ 2 ] = +{ + // HORIZONTAL_ALIGN_BEGIN + { + { // LTR + 0.0f, // Text width <= Control width + 0.0f // Text width > Control width + }, + { // RTL + 1.0f, // Text width <= Control width + 1.0f // Text width > Control width + } + }, + + // HORIZONTAL_ALIGN_CENTER + { + { // LTR + 0.5f, // Text width <= Control width + 0.0f // Text width > Control width + }, + { // RTL + 0.5f, // Text width <= Control width + 1.0f // Text width > Control width + } + }, + + // HORIZONTAL_ALIGN_END + { + { // LTR + 1.0f, // Text width <= Control width + 0.0f // Text width > Control width + }, + { // RTL + 0.0f, // Text width <= Control width + 1.0f // Text width > Control width + } + } +}; + +/** * @brief Create and set up a camera for the render task to use * * @param[in] sizeOfTarget size of the source camera to look at @@ -224,35 +272,11 @@ int TextScroller::GetSpeed() const void TextScroller::SetLoopCount( int loopCount ) { - if ( loopCount > 0 ) + if ( loopCount >= 0 ) { mLoopCount = loopCount; } - if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING ) - { - if ( loopCount == 0 ) // Request to stop looping - { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount Single loop forced\n" ); - switch( mStopMode ) - { - case DevelTextLabel::AutoScrollStopMode::IMMEDIATE: - { - mScrollAnimation.Stop(); - break; - } - case DevelTextLabel::AutoScrollStopMode::FINISH_LOOP: - { - mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way - break; - } - default: - { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" ); - } - } - } - } DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount [%d] Status[%s]\n", mLoopCount, (loopCount)?"looping":"stop" ); } @@ -277,6 +301,30 @@ void TextScroller::SetStopMode( DevelTextLabel::AutoScrollStopMode::Type stopMod mStopMode = stopMode; } +void TextScroller::StopScrolling() +{ + if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING ) + { + switch( mStopMode ) + { + case DevelTextLabel::AutoScrollStopMode::IMMEDIATE: + { + mScrollAnimation.Stop(); + break; + } + case DevelTextLabel::AutoScrollStopMode::FINISH_LOOP: + { + mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way + break; + } + default: + { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" ); + } + } + } +} + DevelTextLabel::AutoScrollStopMode::Type TextScroller::GetStopMode() const { return mStopMode; @@ -308,7 +356,7 @@ TextScroller::~TextScroller() CleanUp(); } -void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, float alignmentOffset ) +void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, float alignmentOffset, Layout::HorizontalAlignment horizontalAlignment ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters controlSize[%f,%f] offscreenSize[%f,%f] direction[%d] alignmentOffset[%f]\n", controlSize.x, controlSize.y, offScreenSize.x, offScreenSize.y, direction, alignmentOffset ); @@ -327,24 +375,58 @@ void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, co CreateRenderer( offscreenRenderTargetForText, renderer ); CreateRenderTask( sourceActor, mOffscreenCameraActor, offscreenRenderTargetForText, mRenderTask ); - // Reposition camera to match alignment of target, RTL text has direction=true - if ( direction ) + float xPosition = 0.0f; + switch( horizontalAlignment ) { - mOffscreenCameraActor.SetX( alignmentOffset + offScreenSize.width*0.5f ); - } - else - { - mOffscreenCameraActor.SetX( offScreenSize.width * 0.5f ); + case Layout::HORIZONTAL_ALIGN_BEGIN: + { + // Reposition camera to match alignment of target, RTL text has direction=true + if ( direction ) + { + xPosition = alignmentOffset + offScreenSize.width * 0.5f; + } + else + { + xPosition = offScreenSize.width * 0.5f; + } + break; + } + + case Layout::HORIZONTAL_ALIGN_CENTER: + { + xPosition = controlSize.width * 0.5f; + break; + } + + case Layout::HORIZONTAL_ALIGN_END: + { + // Reposition camera to match alignment of target, RTL text has direction=true + if ( direction ) + { + xPosition = offScreenSize.width * 0.5f; + } + else + { + xPosition = alignmentOffset + offScreenSize.width * 0.5f; + } + break; + } } + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters xPosition[%f]\n", xPosition ); + + mOffscreenCameraActor.SetX( xPosition ); mOffscreenCameraActor.SetY( offScreenSize.height * 0.5f ); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters mWrapGap[%f]\n", mWrapGap ) + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters mWrapGap[%f]\n", mWrapGap ); + + const float align = ALIGNMENT_TABLE[ horizontalAlignment ][ direction ][ offScreenSize.width > controlSize.width ]; + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters align[%f]\n", align ); mScrollingTextActor = Actor::New(); mScrollingTextActor.AddRenderer( renderer ); mScrollingTextActor.RegisterProperty( "uTextureSize", offScreenSize ); - mScrollingTextActor.RegisterProperty( "uRtl", ((direction)?1.0f:0.0f) ); + mScrollingTextActor.RegisterProperty( "uAlign", align ); mScrollingTextActor.RegisterProperty( "uGap", mWrapGap ); mScrollingTextActor.SetSize( controlSize.width, std::min( offScreenSize.height, controlSize.height ) ); mScrollDeltaIndex = mScrollingTextActor.RegisterProperty( "uDelta", 0.0f ); diff --git a/dali-toolkit/internal/text/text-scroller.h b/dali-toolkit/internal/text/text-scroller.h index f6c0b87..2d611bb 100644 --- a/dali-toolkit/internal/text/text-scroller.h +++ b/dali-toolkit/internal/text/text-scroller.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_TEXT_SCROLLER_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. @@ -22,10 +22,11 @@ #include #include #include -#include // INTERNAL INCLUDES +#include #include +#include namespace Dali { @@ -66,7 +67,7 @@ public: * @param[in] alignmentOffset alignment of source text * */ - void SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, float alignmentOffset ); + void SetParameters( Actor sourceActor, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, float alignmentOffset, Layout::HorizontalAlignment horizontalAlignment ); /** * @brief Set the gap distance to elapse before the text wraps around @@ -123,6 +124,11 @@ public: void SetStopMode( DevelTextLabel::AutoScrollStopMode::Type stopMode ); /** + * @brief Stop the auto scrolling. + */ + void StopScrolling(); + + /** * @brief Get the mode of scrolling stop * @return stopMode type when text scrolling is stoped. */ diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index f589f41..d50cb91 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -471,8 +471,19 @@ void ImageVisual::GetNaturalSize( Vector2& naturalSize ) else if( mImageUrl.IsValid() && mImageUrl.GetLocation() == VisualUrl::LOCAL ) { ImageDimensions dimensions = Dali::GetClosestImageSize( mImageUrl.GetUrl() ); - naturalSize.x = dimensions.GetWidth(); - naturalSize.y = dimensions.GetHeight(); + + if( dimensions != ImageDimensions( 0, 0 ) ) + { + naturalSize.x = dimensions.GetWidth(); + naturalSize.y = dimensions.GetHeight(); + } + else + { + Image brokenImage = VisualFactoryCache::GetBrokenVisualImage(); + + naturalSize.x = brokenImage.GetWidth(); + naturalSize.y = brokenImage.GetWidth(); + } return; } @@ -925,6 +936,10 @@ void ImageVisual::UploadComplete( bool loadingSuccess, TextureSet textureSet, bo else { Image brokenImage = VisualFactoryCache::GetBrokenVisualImage(); + + textureSet = TextureSet::New(); + mImpl->mRenderer.SetTextures( textureSet ); + ApplyImageToSampler( brokenImage ); } // Image loaded and ready to display diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index 525a02e..a41a6f3 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -66,40 +65,6 @@ DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, DISABLED ) DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN ) DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE ) -/** - * Finds visual in given array, returning true if found along with the iterator for that visual as a out parameter - */ -bool FindVisual( Property::Index targetIndex, RegisteredVisualContainer& visuals, RegisteredVisualContainer::Iterator& iter ) -{ - for ( iter = visuals.Begin(); iter != visuals.End(); iter++ ) - { - if ( (*iter)->index == targetIndex ) - { - return true; - } - } - return false; -} - -Toolkit::Visual::Base GetVisualByName( - RegisteredVisualContainer& visuals, - const std::string& visualName ) -{ - Toolkit::Visual::Base visualHandle; - - RegisteredVisualContainer::Iterator iter; - for ( iter = visuals.Begin(); iter != visuals.End(); iter++ ) - { - Toolkit::Visual::Base visual = (*iter)->visual; - if( visual && visual.GetName() == visualName ) - { - visualHandle = visual; - break; - } - } - return visualHandle; -} - } // unnamed namespace @@ -159,7 +124,7 @@ void Control::SetBackground( const Property::Map& map ) Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map ); if( visual ) { - RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual ); + mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual ); visual.SetDepthIndex( DepthIndex::BACKGROUND ); // Trigger a size negotiation request that may be needed by the new visual to relayout its contents. @@ -172,14 +137,14 @@ void Control::SetBackgroundImage( Image image ) Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( image ); if( visual ) { - RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual ); + mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual ); visual.SetDepthIndex( DepthIndex::BACKGROUND ); } } void Control::ClearBackground() { - UnregisterVisual( Toolkit::Control::Property::BACKGROUND ); + mImpl->UnregisterVisual( Toolkit::Control::Property::BACKGROUND ); mImpl->mBackgroundColor = Color::TRANSPARENT; // Trigger a size negotiation request that may be needed when unregistering a visual. @@ -329,202 +294,6 @@ void Control::KeyboardEnter() OnKeyboardEnter(); } -void Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual ) -{ - RegisterVisual( index, visual, true ); -} - -void Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled ) -{ - bool visualReplaced ( false ); - Actor self = Self(); - - if( !mImpl->mVisuals.Empty() ) - { - RegisteredVisualContainer::Iterator iter; - // Check if visual (index) is already registered. Replace if so. - if ( FindVisual( index, mImpl->mVisuals, iter ) ) - { - if( (*iter)->visual && self.OnStage() ) - { - Toolkit::GetImplementation((*iter)->visual).SetOffStage( self ); - } - - mImpl->StopObservingVisual( (*iter)->visual ); - mImpl->StartObservingVisual( visual ); - - (*iter)->visual = visual; - visualReplaced = true; - } - } - - // If not set, set the name of the visual to the same name as the control's property. - // ( If the control has been type registered ) - if( visual.GetName().empty() ) - { - // Check if the control has been type registered: - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(*this) ); - if( typeInfo ) - { - // Check if the property index has been registered: - Property::IndexContainer indices; - typeInfo.GetPropertyIndices( indices ); - Property::IndexContainer::Iterator iter = std::find( indices.Begin(), indices.End(), index ); - if( iter != indices.End() ) - { - // If it has, then get it's name and use that for the visual - std::string visualName = typeInfo.GetPropertyName( index ); - visual.SetName( visualName ); - } - } - } - - if( !visualReplaced ) // New registration entry - { - mImpl->mVisuals.PushBack( new RegisteredVisual( index, visual, enabled ) ); - - // monitor when the visuals resources are ready - mImpl->StartObservingVisual( visual ); - - } - - if( visual && self.OnStage() && enabled ) - { - Toolkit::GetImplementation(visual).SetOnStage( self ); - } - - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n", visual.GetName().c_str(), index, enabled?"T":"F" ); -} - -void Control::UnregisterVisual( Property::Index index ) -{ - RegisteredVisualContainer::Iterator iter; - if ( FindVisual( index, mImpl->mVisuals, iter ) ) - { - // stop observing visual - mImpl->StopObservingVisual( (*iter)->visual ); - - Actor self( Self() ); - Toolkit::GetImplementation((*iter)->visual).SetOffStage( self ); - (*iter)->visual.Reset(); - mImpl->mVisuals.Erase( iter ); - } -} - -Toolkit::Visual::Base Control::GetVisual( Property::Index index ) const -{ - RegisteredVisualContainer::Iterator iter; - if ( FindVisual( index, mImpl->mVisuals, iter ) ) - { - return (*iter)->visual; - } - - return Toolkit::Visual::Base(); -} - -void Control::EnableVisual( Property::Index index, bool enable ) -{ - RegisteredVisualContainer::Iterator iter; - if ( FindVisual( index, mImpl->mVisuals, iter ) ) - { - if ( (*iter)->enabled == enable ) - { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual %s(%d) already %s\n", (*iter)->visual.GetName().c_str(), index, enable?"enabled":"disabled"); - return; - } - - (*iter)->enabled = enable; - Actor parentActor = Self(); - if ( Self().OnStage() ) // If control not on Stage then Visual will be added when StageConnection is called. - { - if ( enable ) - { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) on stage \n", (*iter)->visual.GetName().c_str(), index ); - Toolkit::GetImplementation((*iter)->visual).SetOnStage( parentActor ); - } - else - { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) off stage \n", (*iter)->visual.GetName().c_str(), index ); - Toolkit::GetImplementation((*iter)->visual).SetOffStage( parentActor ); // No need to call if control not staged. - } - } - } -} - -bool Control::IsVisualEnabled( Property::Index index ) const -{ - RegisteredVisualContainer::Iterator iter; - if ( FindVisual( index, mImpl->mVisuals, iter ) ) - { - return (*iter)->enabled; - } - return false; -} - -Dali::Animation Control::CreateTransition( const Toolkit::TransitionData& handle ) -{ - Dali::Animation transition; - const Internal::TransitionData& transitionData = Toolkit::GetImplementation( handle ); - - if( transitionData.Count() > 0 ) - { - // Setup a Transition from TransitionData. - TransitionData::Iterator end = transitionData.End(); - for( TransitionData::Iterator iter = transitionData.Begin() ; - iter != end; ++iter ) - { - TransitionData::Animator* animator = (*iter); - - Toolkit::Visual::Base visual = GetVisualByName( mImpl->mVisuals, animator->objectName ); - - if( visual ) - { - Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual ); - visualImpl.AnimateProperty( transition, *animator ); - } - else - { - // Otherwise, try any actor children of control (Including the control) - Actor child = Self().FindChildByName( animator->objectName ); - if( child ) - { - Property::Index propertyIndex = DevelHandle::GetPropertyIndex( child, animator->propertyKey ); - if( propertyIndex != Property::INVALID_INDEX ) - { - if( animator->animate == false ) - { - if( animator->targetValue.GetType() != Property::NONE ) - { - child.SetProperty( propertyIndex, animator->targetValue ); - } - } - else // animate the property - { - if( animator->initialValue.GetType() != Property::NONE ) - { - child.SetProperty( propertyIndex, animator->initialValue ); - } - - if( ! transition ) - { - transition = Dali::Animation::New( 0.1f ); - } - - transition.AnimateTo( Property( child, propertyIndex ), - animator->targetValue, - animator->alphaFunction, - TimePeriod( animator->timePeriodDelay, - animator->timePeriodDuration ) ); - } - } - } - } - } - } - - return transition; -} - bool Control::OnAccessibilityActivated() { return false; // Accessibility activation is not handled by default @@ -808,7 +577,7 @@ void Control::OnPropertySet( Property::Index index, Property::Value propertyValu void Control::OnSizeSet(const Vector3& targetSize) { - Toolkit::Visual::Base visual = GetVisual( Toolkit::Control::Property::BACKGROUND ); + Toolkit::Visual::Base visual = mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND ); if( visual ) { Vector2 size( targetSize ); @@ -848,7 +617,7 @@ void Control::OnRelayout( const Vector2& size, RelayoutContainer& container ) container.Add( Self().GetChildAt( i ), size ); } - Toolkit::Visual::Base visual = GetVisual( Toolkit::Control::Property::BACKGROUND ); + Toolkit::Visual::Base visual = mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND ); if( visual ) { visual.SetTransformAndSize( Property::Map(), size ); // Send an empty map as we do not want to modify the visual's set transform @@ -861,7 +630,7 @@ void Control::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dime Vector3 Control::GetNaturalSize() { - Toolkit::Visual::Base visual = GetVisual( Toolkit::Control::Property::BACKGROUND ); + Toolkit::Visual::Base visual = mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND ); if( visual ) { Vector2 naturalSize; diff --git a/dali-toolkit/public-api/controls/control-impl.h b/dali-toolkit/public-api/controls/control-impl.h index 7b81c67..9a1e560 100644 --- a/dali-toolkit/public-api/controls/control-impl.h +++ b/dali-toolkit/public-api/controls/control-impl.h @@ -41,12 +41,6 @@ namespace Toolkit */ class StyleManager; -class TransitionData; - -namespace Visual -{ -class Base; -} namespace Internal { @@ -301,90 +295,6 @@ public: protected: // For derived classes to call /** - * @brief Register a visual by Property Index, linking an Actor to visual when required. - * In the case of the visual being an actor or control deeming visual not required then visual should be an empty handle. - * No parenting is done during registration, this should be done by derived class. - * - * @SINCE_1_2.0 - * - * @param[in] index The Property index of the visual, used to reference visual - * @param[in] visual The visual to register - * @note Derived class should not call visual.SetOnStage(actor). It is the responsibility of the base class to connect/disconnect registered visual to stage. - * Use below API with enabled set to false if derived class wishes to control when visual is staged. - */ - void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual ); - - /** - * @brief Register a visual by Property Index, linking an Actor to visual when required. - * In the case of the visual being an actor or control deeming visual not required then visual should be an empty handle. - * If enabled is false then the visual is not set on stage until enabled by the derived class. - * @see EnableVisual - * - * @SINCE_1_2.11 - * - * @param[in] index The Property index of the visual, used to reference visual - * @param[in] visual The visual to register - * @param[in] enabled false if derived class wants to control when visual is set on stage. - * - */ - void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled ); - - /** - * @brief Erase the entry matching the given index from the list of registered visuals - * @param[in] index The Property index of the visual, used to reference visual - * - * @SINCE_1_2.0 - */ - void UnregisterVisual( Property::Index index ); - - /** - * @brief Retrieve the visual associated with the given property index. - * - * @SINCE_1_2.2 - * - * @param[in] index The Property index of the visual. - * @return The registered visual if exist, otherwise empty handle. - * @note For managing object life-cycle, do not store the returned visual as a member which increments its reference count. - */ - Toolkit::Visual::Base GetVisual( Property::Index index ) const; - - /** - * @brief Sets the given visual to be displayed or not when parent staged. - * - * @SINCE_1_2.11 - * - * @param[in] index The Property index of the visual - * @param[in] enable flag to set enabled or disabled. - */ - void EnableVisual( Property::Index index, bool enable ); - - /** - * @brief Queries if the given visual is to be displayed when parent staged. - * - * @SINCE_1_2.11 - * - * @param[in] index The Property index of the visual - * @return bool whether visual is enabled or not - */ - bool IsVisualEnabled( Property::Index index ) const; - - /** - * @brief Create a transition effect on the control. - * - * Only generates an animation if the properties described in the transition - * data are staged (e.g. the visual is Enabled and the control is on stage). - * Otherwise the target values are stored, and will get set onto the properties - * when the visual is next staged. - * - * @SINCE_1_2.12 - * - * @param[in] transitionData The transition data describing the effect to create - * @return A handle to an animation defined with the given effect, or an empty - * handle if no properties match. - */ - Dali::Animation CreateTransition( const Toolkit::TransitionData& transitionData ); - - /** * @brief Emits KeyInputFocusGained signal if true else emits KeyInputFocusLost signal. * * Should be called last by the control after it acts on the Input Focus change. diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index c4d336c..a96fab6 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 2; -const unsigned int TOOLKIT_MICRO_VERSION = 41; +const unsigned int TOOLKIT_MICRO_VERSION = 42; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 39f269b..c34d9aa 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.2.41 +Version: 1.2.42 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT @@ -185,6 +185,9 @@ cp -r dali-toolkit/styles/720x1280/* %{buildroot}%{dali_toolkit_style_files}/720 mkdir -p %{buildroot}%{dali_toolkit_style_files}/1920x1080 cp -r dali-toolkit/styles/1920x1080/* %{buildroot}%{dali_toolkit_style_files}/1920x1080 +# Copy default feedback theme +cp dali-toolkit/styles/default-feedback-theme.json %{buildroot}%{dali_toolkit_style_files} + ############################## # Post Install ############################## @@ -276,6 +279,7 @@ popd %{dali_toolkit_image_files}/* %{dali_toolkit_sound_files}/* %{dali_toolkit_style_files}/480x800/* +%{dali_toolkit_style_files}/default-feedback-theme.json %{_datadir}/locale/*/LC_MESSAGES/* %files resources_720x1280 @@ -284,6 +288,7 @@ popd %{dali_toolkit_image_files}/* %{dali_toolkit_sound_files}/* %{dali_toolkit_style_files}/720x1280/* +%{dali_toolkit_style_files}/default-feedback-theme.json %{_datadir}/locale/*/LC_MESSAGES/* %files resources_1920x1080 @@ -292,4 +297,5 @@ popd %{dali_toolkit_image_files}/* %{dali_toolkit_sound_files}/* %{dali_toolkit_style_files}/1920x1080/* +%{dali_toolkit_style_files}/default-feedback-theme.json %{_datadir}/locale/*/LC_MESSAGES/* diff --git a/plugins/dali-script-v8/src/garbage-collector/garbage-collector.cpp b/plugins/dali-script-v8/src/garbage-collector/garbage-collector.cpp index ffc118d..cc7988d 100644 --- a/plugins/dali-script-v8/src/garbage-collector/garbage-collector.cpp +++ b/plugins/dali-script-v8/src/garbage-collector/garbage-collector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 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. @@ -38,25 +38,31 @@ GarbageCollector::~GarbageCollector() void GarbageCollector::Register( BaseWrappedObject* object ) { - mObjectMap.insert( object ); + mObjectMap.PushBack( object ); }; void GarbageCollector::UnRegister( BaseWrappedObject* object ) { - mObjectMap.erase( object ); + for( ObjectMap::Iterator iter = mObjectMap.Begin(); iter != mObjectMap.End(); ++iter ) + { + if( *iter == object ) + { + mObjectMap.Erase( iter ); + return; + } + } } void GarbageCollector::GarbageCollect() { - for( ObjectMap::iterator iter = mObjectMap.begin(); iter != mObjectMap.end(); ) + for( ObjectMap::Iterator iter = mObjectMap.Begin(); iter != mObjectMap.End(); ++iter ) { BaseWrappedObject* object = *iter; - iter++; // iterator will be invalidated if we delete the object first. delete object; // object will call GarbageCollector.UnRegister } - + mObjectMap.Clear(); } } // V8Plugin diff --git a/plugins/dali-script-v8/src/garbage-collector/garbage-collector.h b/plugins/dali-script-v8/src/garbage-collector/garbage-collector.h index 24cf638..d28faf3 100644 --- a/plugins/dali-script-v8/src/garbage-collector/garbage-collector.h +++ b/plugins/dali-script-v8/src/garbage-collector/garbage-collector.h @@ -2,7 +2,7 @@ #define __DALI_V8PLUGIN_GARBAGE_COLLECTOR_H__ /* - * Copyright (c) 2015 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. @@ -18,11 +18,11 @@ * */ +// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES #include -#include - namespace Dali { @@ -64,13 +64,12 @@ public: */ virtual void GarbageCollect(); - private: /** * Map between dali wrapped object (void *) */ - typedef std::set< BaseWrappedObject* > ObjectMap; + typedef Dali::Vector< BaseWrappedObject* > ObjectMap; ObjectMap mObjectMap; ///< lookup };