From: Adeel Kazmi Date: Fri, 12 May 2017 18:22:28 +0000 (+0000) Subject: Merge "Check for NULL return value in button-impl.cpp" into devel/master X-Git-Tag: dali_1.2.40~6 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=0e07671d24b10bd49423ec6ce22817000bb18336;hp=58ca02131d2fe77d8f05611aafe656e8dc005ca3 Merge "Check for NULL return value in button-impl.cpp" into devel/master --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-MultiLanguage.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-MultiLanguage.cpp index 3904faa..c3f0b9b 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-MultiLanguage.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-MultiLanguage.cpp @@ -1614,6 +1614,38 @@ int UtcDaliTextMultiLanguageValidateFonts01(void) fontDescriptions10.PushBack( fontDescription1003 ); fontDescriptions10.PushBack( fontDescription1004 ); + FontRun fontRun1101 = + { + { + 0u, + 22u + }, + 5u + }; + Vector fontRuns11; + fontRuns11.PushBack( fontRun1101 ); + + FontDescriptionRun fontDescription1101 = + { + { + 0, + 22u + }, + const_cast( "TizenSans" ), + 9u, + TextAbstraction::FontWeight::NORMAL, + TextAbstraction::FontWidth::NORMAL, + TextAbstraction::FontSlant::NORMAL, + pointSize02, + true, + false, + false, + false, + true + }; + Vector fontDescriptions11; + fontDescriptions11.PushBack( fontDescription1101 ); + const ValidateFontsData data[] = { { @@ -1716,8 +1748,18 @@ int UtcDaliTextMultiLanguageValidateFonts01(void) fontDescriptions10, fontRuns10 }, + { + "Unknown script -> changed to LATIN", + "WRC – The Official App", + "/tizen/TizenSansRegular.ttf", + TextAbstraction::FontClient::DEFAULT_POINT_SIZE, + 0u, + 22u, + fontDescriptions11, + fontRuns11 + }, }; - const unsigned int numberOfTests = 10u; + const unsigned int numberOfTests = 11u; for( unsigned int index = 0u; index < numberOfTests; ++index ) { diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp index ad65aea..57b39a5 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp @@ -1523,3 +1523,296 @@ int UtcDaliPushButtonSetLabelText(void) END_TEST; } + +int UtcDaliPushButtonSetButtonImageDeprecatedP(void) +{ + ToolkitTestApplication application; + Image setButtonImage = ResourceImage::New( TEST_IMAGE_ONE); + PushButton pushButton = PushButton::New(); + pushButton.SetButtonImage( setButtonImage ); + Image retreivedButtonImage = ImageView::DownCast(pushButton.GetButtonImage()).GetImage(); + DALI_TEST_EQUALS( retreivedButtonImage, setButtonImage , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonSetSelectedImageDeprecatedP(void) +{ + ToolkitTestApplication application; + Image setButtonImage = ResourceImage::New( TEST_IMAGE_ONE); + PushButton pushButton = PushButton::New(); + pushButton.SetSelectedImage( setButtonImage ); + Image retreivedButtonImage = ImageView::DownCast(pushButton.GetSelectedImage()).GetImage(); + DALI_TEST_EQUALS( retreivedButtonImage, setButtonImage , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonGetButtonImageURLDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButtonGetButtonImageURLDeprecatedP Testing mix use of API"); + + ToolkitTestApplication application; + + PushButton pushButton = PushButton::New(); + pushButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, TEST_IMAGE_ONE ); + + ImageView retreivedButtonImageView = ImageView::DownCast(pushButton.GetButtonImage()); + Image retreivedButtonImage = retreivedButtonImageView.GetImage(); + ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage ); + + DALI_TEST_EQUALS( resourceImage.GetUrl(), TEST_IMAGE_ONE , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonGetSelectedImageURLDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButtonGetSelectedImageURLDeprecatedP Testing mix use of API"); + + ToolkitTestApplication application; + + PushButton pushButton = PushButton::New(); + + pushButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, TEST_IMAGE_ONE ); + + Image retreivedButtonImage = ImageView::DownCast(pushButton.GetSelectedImage()).GetImage(); + ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage ); + DALI_TEST_EQUALS( resourceImage.GetUrl(), TEST_IMAGE_ONE , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonSetSelectedImageWithActorDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButton SetSelectedImage With ImageView (Actor)"); + + ToolkitTestApplication application; + + Image image = ResourceImage::New( TEST_IMAGE_ONE ); + + DALI_TEST_CHECK( image ); + + ImageView imgViewSet = ImageView::New(image); + + DALI_TEST_CHECK(imgViewSet ); + + PushButton pushButton = PushButton::New(); + + DALI_TEST_CHECK( pushButton ); + + pushButton.SetSelectedImage( imgViewSet ); + + ImageView imageView = ImageView::DownCast( pushButton.GetSelectedImage()); + + DALI_TEST_CHECK( imageView ); + + Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) ); + Property::Map map; + value.Get( map ); + DALI_TEST_CHECK( !map.Empty() ); + DALI_TEST_EQUALS( map[ "filename" ].Get(), TEST_IMAGE_ONE , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonSetButtonImageWithActorDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButton SetButtonImage With ImageView (Actor)"); + + ToolkitTestApplication application; + + Image image = ResourceImage::New( TEST_IMAGE_ONE ); + + DALI_TEST_CHECK( image ); + + ImageView imgViewSet = ImageView::New(image); + + DALI_TEST_CHECK(imgViewSet ); + + PushButton pushButton = PushButton::New(); + + DALI_TEST_CHECK( pushButton ); + + pushButton.SetButtonImage( imgViewSet ); + + ImageView imageView = ImageView::DownCast( pushButton.GetButtonImage()); + + DALI_TEST_CHECK( imageView ); + + Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) ); + Property::Map map; + value.Get( map ); + DALI_TEST_CHECK( !map.Empty() ); + DALI_TEST_EQUALS( map[ "filename" ].Get(), TEST_IMAGE_ONE , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonSetBackgroundImageWithActorDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButton SetBackgroundImage With ImageView (Actor)"); + + ToolkitTestApplication application; + + Image image = ResourceImage::New( TEST_IMAGE_ONE ); + + DALI_TEST_CHECK( image ); + + ImageView imgViewSet = ImageView::New(image); + + DALI_TEST_CHECK(imgViewSet ); + + PushButton pushButton = PushButton::New(); + + DALI_TEST_CHECK( pushButton ); + + pushButton.SetBackgroundImage( imgViewSet ); + + ImageView imageView = ImageView::DownCast( pushButton.GetButtonImage()); + + DALI_TEST_CHECK( imageView ); + + Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) ); + Property::Map map; + value.Get( map ); + DALI_TEST_CHECK( !map.Empty() ); + DALI_TEST_EQUALS( map[ "filename" ].Get(), TEST_IMAGE_ONE , TEST_LOCATION ); + + END_TEST; +} + + +int UtcDaliPushButtonSetSelectedBackgroundImageWithActorDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButton SetSelectedBackgroundImage With ImageView (Actor)"); + + ToolkitTestApplication application; + + Image image = ResourceImage::New( TEST_IMAGE_ONE ); + + DALI_TEST_CHECK( image ); + + ImageView imgViewSet = ImageView::New(image); + + DALI_TEST_CHECK(imgViewSet ); + + PushButton pushButton = PushButton::New(); + + DALI_TEST_CHECK( pushButton ); + + pushButton.SetSelectedBackgroundImage( imgViewSet ); + + ImageView imageView = ImageView::DownCast( pushButton.GetSelectedImage()); + + DALI_TEST_CHECK( imageView ); + + Property::Value value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) ); + Property::Map map; + value.Get( map ); + DALI_TEST_CHECK( !map.Empty() ); + DALI_TEST_EQUALS( map[ "filename" ].Get(), TEST_IMAGE_ONE , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonSetDisabledBackgroundImageWithActorDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButton SetDisabledBackgroundImage With ImageView (Actor)"); + + ToolkitTestApplication application; + + Image image = ResourceImage::New( TEST_IMAGE_ONE ); + + DALI_TEST_CHECK( image ); + + ImageView imgViewSet = ImageView::New(image); + + DALI_TEST_CHECK(imgViewSet ); + + PushButton pushButton = PushButton::New(); + + DALI_TEST_CHECK( pushButton ); + + pushButton.SetDisabledBackgroundImage( imgViewSet ); + + Property::Value value = pushButton.GetProperty( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL ); + Property::Map map; + value.Get( map ); + + Property::Value* urlValue = map.Find( ImageVisual::Property::URL ); + + std::string urlString; + urlValue->Get( urlString ); + DALI_TEST_EQUALS( urlString , TEST_IMAGE_ONE , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonSetDisabledImageWithActorDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButton SetDisabledImage With ImageView (Actor)"); + + ToolkitTestApplication application; + + Image image = ResourceImage::New( TEST_IMAGE_ONE ); + + DALI_TEST_CHECK( image ); + + ImageView imgViewSet = ImageView::New(image); + + DALI_TEST_CHECK(imgViewSet ); + + PushButton pushButton = PushButton::New(); + + DALI_TEST_CHECK( pushButton ); + + pushButton.SetDisabledImage( imgViewSet ); + + Property::Value value = pushButton.GetProperty( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL ); + + Property::Map map; + value.Get( map ); + + Property::Value* urlValue = map.Find( ImageVisual::Property::URL ); + + std::string urlString; + urlValue->Get( urlString ); + DALI_TEST_EQUALS( urlString , TEST_IMAGE_ONE , TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliPushButtonSetDisabledSelectedImageWithActorDeprecatedP(void) +{ + tet_infoline(" UtcDaliPushButton SetDisabledSelectedImage With ImageView (Actor)"); + + ToolkitTestApplication application; + + Image image = ResourceImage::New( TEST_IMAGE_ONE ); + + DALI_TEST_CHECK( image ); + + ImageView imgViewSet = ImageView::New(image); + + DALI_TEST_CHECK(imgViewSet ); + + PushButton pushButton = PushButton::New(); + + DALI_TEST_CHECK( pushButton ); + + pushButton.SetDisabledSelectedImage( imgViewSet ); + + Property::Value value = pushButton.GetProperty( Toolkit::DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL ); + + Property::Map map; + value.Get( map ); + + Property::Value* urlValue = map.Find( ImageVisual::Property::URL ); + + std::string urlString; + urlValue->Get( urlString ); + DALI_TEST_EQUALS( urlString , TEST_IMAGE_ONE , TEST_LOCATION ); + + 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 6455402..ff32ccf 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -1847,3 +1847,69 @@ int utcDaliTextEditorHandles(void) END_TEST; } + +int utcDaliTextEditorUnderPropertyStringP(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextEditorUnderPropertyStringP"); + TextEditor editor = TextEditor::New(); + DALI_TEST_CHECK( editor ); + + std::string underlineSettings1( "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"1\"}" ); + + Stage::GetCurrent().Add( editor ); + + editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettings1 ); + DALI_TEST_EQUALS( editor.GetProperty( TextEditor::Property::UNDERLINE ), underlineSettings1, TEST_LOCATION ); + + tet_infoline("Set underline settings with a map"); + // Check the input underline property + Property::Map underlineMapSet; + Property::Map underlineMapGet; + underlineMapSet.Insert( "enable", "true" ); + underlineMapSet.Insert( "color", "blue" ); + underlineMapSet.Insert( "height", "2" ); + + editor.SetProperty( TextEditor::Property::UNDERLINE, underlineMapSet ); + underlineMapGet = editor.GetProperty( TextEditor::Property::UNDERLINE ); + DALI_TEST_EQUALS( underlineMapGet.Count(), underlineMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( underlineMapSet, underlineMapGet ), true, TEST_LOCATION ); + + tet_infoline("Set underline settings with a string"); + editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettings1 ); + Property::Value value = editor.GetProperty( TextEditor::Property::UNDERLINE ); + std::string result; + value.Get(result); + DALI_TEST_EQUALS( result , underlineSettings1, TEST_LOCATION ); + + tet_infoline("Trying to set invalid underline settings, should not update and stay at previous settings"); + std::string underlineSettingsVoid( "{\"enable\":\"true\",\"coooolor\":\"blue\",\"heeeight\":\"4\"}" ); + editor.SetProperty( TextEditor::Property::UNDERLINE, underlineSettingsVoid ); + value = editor.GetProperty( TextEditor::Property::UNDERLINE ); + value.Get(result); + DALI_TEST_EQUALS( result , underlineSettings1, TEST_LOCATION ); + + END_TEST; +} + +int utcDaliTextEditorShadowPropertyStringP(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextEditorUnderPropertyStringP Setting Shadow propeties by string"); + + TextEditor editor = TextEditor::New(); + + std::string shadowSettings( "{\"color\":\"green\",\"offset\":\"2 2\"}" ); + + Stage::GetCurrent().Add( editor ); + + editor.SetProperty( TextEditor::Property::SHADOW, "{\"color\":\"green\",\"offset\":\"2 2\"}" ); + + Property::Value value = editor.GetProperty( TextEditor::Property::SHADOW ); + std::string result; + value.Get(result); + + DALI_TEST_EQUALS( result, shadowSettings, 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 85be1e3..5671523 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -67,6 +67,7 @@ const char* const PROPERTY_NAME_OUTLINE = "outline"; const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize"; const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis"; +const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay"; const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; const std::string DEFAULT_FONT_DIR( "/resources/fonts" ); @@ -209,6 +210,7 @@ int UtcDaliToolkitTextLabelGetPropertyP(void) DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE ); DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == DevelTextLabel::Property::PIXEL_SIZE ); DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == DevelTextLabel::Property::ELLIPSIS ); + DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY ); END_TEST; } @@ -347,6 +349,10 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) const int SCROLL_SPEED = 80; const int SCROLL_LOOPS = 4; const float SCROLL_GAP = 50.0f; + const float SCROLL_LOOP_DELAY = 0.3f; + const std::string STOP_IMMEDIATE = std::string( "IMMEDIATE" ); + const std::string STOP_FINISH_LOOP = std::string( "FINISH_LOOP" ); + label.SetProperty( TextLabel::Property::MULTI_LINE, false ); // Autoscroll only supported in single line DALI_TEST_CHECK( !label.GetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL ) ); label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); @@ -357,6 +363,16 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION ); label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP ); DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION ); + label.SetProperty(DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY, SCROLL_LOOP_DELAY ); + DALI_TEST_EQUALS( SCROLL_LOOP_DELAY, label.GetProperty( DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY ), TEST_LOCATION ); + + //Check autoscroll stop type property + label.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE ); + DALI_TEST_EQUALS( STOP_IMMEDIATE, label.GetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION ); + + label.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP ); + DALI_TEST_EQUALS( STOP_FINISH_LOOP, label.GetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE ), TEST_LOCATION ); + // Check the line spacing property DALI_TEST_EQUALS( label.GetProperty( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); @@ -542,23 +558,44 @@ int UtcDaliToolkitTextlabelScrollingP(void) { ToolkitTestApplication application; tet_infoline(" UtcDaliToolkitTextLabelScrollingP"); - TextLabel label = TextLabel::New("Some text to scroll"); - DALI_TEST_CHECK( label ); + TextLabel labelImmediate = TextLabel::New("Some text to scroll"); + TextLabel labelFinished = TextLabel::New("Some text to scroll"); + + DALI_TEST_CHECK( labelImmediate ); + DALI_TEST_CHECK( labelFinished ); // Avoid a crash when core load gl resources. application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); - Stage::GetCurrent().Add( label ); + Stage::GetCurrent().Add( labelImmediate ); // Turn on all the effects - label.SetProperty( TextLabel::Property::MULTI_LINE, false ); - label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); - label.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); - label.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelImmediate.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelImmediate.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelImmediate.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::IMMEDIATE ); + + Stage::GetCurrent().Add( labelFinished ); + // Turn on all the effects + labelFinished.SetProperty( TextLabel::Property::MULTI_LINE, false ); + labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, 50.0f ); + labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3 ); + labelFinished.SetProperty( TextLabel::Property::AUTO_SCROLL_SPEED, 80.0f ); + labelFinished.SetProperty( DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE, DevelTextLabel::AutoScrollStopMode::FINISH_LOOP ); + + try { // Render some text with the shared atlas backend - label.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); + labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, true ); application.SendNotification(); application.Render(); + + labelImmediate.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + labelFinished.SetProperty( TextLabel::Property::ENABLE_AUTO_SCROLL, false ); + application.SendNotification(); + application.Render(); + } catch( ... ) { diff --git a/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h index 0d0ca82..40c6c70 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-label-devel.h @@ -70,9 +70,37 @@ namespace Property * @details name "ellipsis", type bool */ ELLIPSIS = OUTLINE + 2, + + /** + * @brief delay starting time of auto scrolling and further loops + * @details name "autoScrollLoopDelay", type float. + */ + AUTO_SCROLL_LOOP_DELAY = OUTLINE + 3, + + /** + * @brief Auto scrolling stop behaviour. + * @details name "autoScrollStopMode", type [Type](@ref Dali::Toolkit::DevelTextLabel::AutoScrollStopMode::Type) (Property::INTEGER) or Property::STRING. + * values FINISH_LOOP, IMMEDIATE, defualt FINISH_LOOP + */ + AUTO_SCROLL_STOP_MODE = OUTLINE + 4, }; } // namespace Property +/** +* @brief The type for TextLabel::Property::AUTO_SCROLL_STOP_MODE +*/ +namespace AutoScrollStopMode +{ +/** +* @ref Dali::Toolkit::DevelTextLabel::AutoScrollStopMode +*/ +enum Type +{ + FINISH_LOOP = 0, ///< stop animation after current loop finished. + IMMEDIATE ///< stop animation immediatly and reset position. +}; +} // namespace AutoScrollStopMode + } // namespace DevelText } // namespace Toolkit diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index 08beee1..d580457 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -1600,27 +1600,52 @@ void Button::SetButtonImage( Image image ) { DALI_LOG_WARNING("Button::SetButtonImage @DEPRECATED_1_0.50\n"); SetUnselectedImage( GetUrlFromImage( image ) ); + mSetButtonImage = image; } void Button::SetSelectedImage( Image image ) { DALI_LOG_WARNING("Button::SetSelectedImage @DEPRECATED_1_0.50\n"); SetSelectedImage( GetUrlFromImage( image ) ); + mSetSelectedImage = image; } Actor Button::GetButtonImage() const { + // When deprecated ImageView API removed then this button API can be removed too. DALI_LOG_WARNING("Button::GetButtonImage @DEPRECATED_1_0.50\n"); - Actor imageView = Toolkit::ImageView::New( GetUrlForImageVisual( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL ) ); + + Actor imageView; + + if ( mSetButtonImage ) + { + imageView = Toolkit::ImageView::New( mSetButtonImage ); + } + else + { + ResourceImage image = ResourceImage::New( GetUrlForImageVisual( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL ) ); + imageView = Toolkit::ImageView::New( image ); + } return imageView; } Actor Button::GetSelectedImage() const { + // When deprecated ImageView API removed then this button API can be removed too. DALI_LOG_WARNING("Button::GetSelectedImage @DEPRECATED_1_0.50\n"); - Actor imageView = Toolkit::ImageView::New( GetUrlForImageVisual( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL ) ); + Actor imageView; + + if ( mSetSelectedImage ) + { + imageView = Toolkit::ImageView::New( mSetSelectedImage ); + } + else + { + ResourceImage image = ResourceImage::New( GetUrlForImageVisual( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL ) ); + imageView = Toolkit::ImageView::New( image ); + } return imageView; } diff --git a/dali-toolkit/internal/controls/buttons/button-impl.h b/dali-toolkit/internal/controls/buttons/button-impl.h index e0b7d50..210246e 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.h +++ b/dali-toolkit/internal/controls/buttons/button-impl.h @@ -680,6 +680,11 @@ private: // Actions bool mClickActionPerforming; ///< Used to manage signal emissions during action + + // Deprecated API support + Image mSetButtonImage; ///< Store set image if deprecated SetButtonImage used. + Image mSetSelectedImage; ///< Store set image if deprecated SetSelectedImage used. + }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp index 3391bae..1b7f495 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp @@ -243,6 +243,104 @@ Property::Value PushButton::GetProperty( BaseObject* object, Property::Index pro return value; } +// Deprecated API using Actor to set images + +void PushButton::SetButtonImage( Actor image ) +{ + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetButtonImage() is deprecated and will be removed from next release. Use Button.SetProperty UNSELECTED_STATE_IMAGE or Styling file instead.\n" ); + + Image retreivedButtonImage = Toolkit::ImageView::DownCast( image ).GetImage(); + if ( retreivedButtonImage ) + { + ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage ); + + if ( resourceImage ) + { + Self().SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, resourceImage.GetUrl() ); + + } + } +} + +void PushButton::SetBackgroundImage( Actor image ) +{ + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release.\n" ); + + SetButtonImage( image ); + +} + +void PushButton::SetSelectedImage( Actor image ) +{ + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedImage() is deprecated and will be removed from next release. Use Button.SetProperty SELECTED_STATE_IMAGE or Styling file instead.\n" ); + + Image retreivedButtonImage = Toolkit::ImageView::DownCast( image ).GetImage(); + if ( retreivedButtonImage ) + { + ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage ); + + if ( resourceImage ) + { + Self().SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, resourceImage.GetUrl() ); + } + } +} + +void PushButton::SetSelectedBackgroundImage( Actor image ) +{ + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedBackgroundImage() is deprecated and will be removed from next release.\n" ); + + SetSelectedImage( image ); +} + +void PushButton::SetDisabledBackgroundImage( Actor image ) +{ + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledBackgroundImage() is deprecated and will be removed from next release.\n" ); + + Image retreivedButtonImage = Toolkit::ImageView::DownCast( image ).GetImage(); + if ( retreivedButtonImage ) + { + ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage ); + + if ( resourceImage ) + { + Self().SetProperty( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, resourceImage.GetUrl() ); + } + } +} + +void PushButton::SetDisabledImage( Actor image ) +{ + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledImage() is deprecated and will be removed from next release. Use Button.SetProperty DISABLED_STATE_IMAGE or Styling file instead.\n" ); + + Image retreivedButtonImage = Toolkit::ImageView::DownCast( image ).GetImage(); + if ( retreivedButtonImage ) + { + ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage ); + + if ( resourceImage ) + { + Self().SetProperty( Toolkit::DevelButton::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, resourceImage.GetUrl() ); + } + } +} + +void PushButton::SetDisabledSelectedImage( Actor image ) +{ + DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledSelectedImage() is deprecated and will be removed from next release.\n" ); + + Image retreivedButtonImage = Toolkit::ImageView::DownCast( image ).GetImage(); + if ( retreivedButtonImage ) + { + ResourceImage resourceImage = ResourceImage::DownCast( retreivedButtonImage ); + + if ( resourceImage ) + { + Self().SetProperty( Toolkit::DevelButton::Property::DISABLED_SELECTED_BACKGROUND_VISUAL, resourceImage.GetUrl() ); + } + } +} + } // namespace Internal } // namespace Toolkit diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.h b/dali-toolkit/internal/controls/buttons/push-button-impl.h index ecc7ac7..6417b4b 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.h @@ -93,6 +93,48 @@ public: */ static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex ); + /** + * Deprecated API for Setting Pushbutton image using an Actor + * @param[in] image, Image Actor that has a url which can be used to create an image visual + */ + void SetButtonImage( Actor image ); + + /** + * Deprecated API for Setting Pushbutton image using an Actor + * @param[in] image, Image Actor that has a url which can be used to create an image visual + */ + void SetBackgroundImage( Actor image ); + + /** + * Deprecated API for Setting Pushbutton image using an Actor + * @param[in] image, Image Actor that has a url which can be used to create an image visual + */ + void SetSelectedImage( Actor image ); + + /** + * Deprecated API for Setting Pushbutton image using an Actor + * @param[in] image, Image Actor that has a url which can be used to create an image visual + */ + void SetSelectedBackgroundImage( Actor image ); + + /** + * Deprecated API for Setting Pushbutton image using an Actor + * @param[in] image, Image Actor that has a url which can be used to create an image visual + */ + void SetDisabledBackgroundImage( Actor image ); + + /** + * Deprecated API for Setting Pushbutton image using an Actor + * @param[in] image, Image Actor that has a url which can be used to create an image visual + */ + void SetDisabledImage( Actor image ); + + /** + * Deprecated API for Setting Pushbutton image using an Actor + * @param[in] image, Image Actor that has a url which can be used to create an image visual + */ + void SetDisabledSelectedImage( Actor image ); + private: // From Button /** 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 de5c097..b1c031c 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -58,6 +58,13 @@ namespace Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS"); #endif +const Scripting::StringEnum AUTO_SCROLL_STOP_MODE_TABLE[] = +{ + { "IMMEDIATE", Toolkit::DevelTextLabel::AutoScrollStopMode::IMMEDIATE }, + { "FINISH_LOOP", Toolkit::DevelTextLabel::AutoScrollStopMode::FINISH_LOOP }, +}; +const unsigned int AUTO_SCROLL_STOP_MODE_TABLE_COUNT = sizeof( AUTO_SCROLL_STOP_MODE_TABLE ) / sizeof( AUTO_SCROLL_STOP_MODE_TABLE[0] ); + const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] = { { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN }, @@ -83,32 +90,34 @@ BaseHandle Create() // Setup properties, signals and actions using the type-registry. DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextLabel, Toolkit::Control, Create ); -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "text", STRING, TEXT ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontFamily", STRING, FONT_FAMILY ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", MAP, FONT_STYLE ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pointSize", FLOAT, POINT_SIZE ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalAlignment", STRING, VERTICAL_ALIGNMENT ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textColor", VECTOR4, TEXT_COLOR ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowOffset", VECTOR2, SHADOW_OFFSET ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowColor", VECTOR4, SHADOW_COLOR ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineEnabled", BOOLEAN, UNDERLINE_ENABLED ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineColor", VECTOR4, UNDERLINE_COLOR ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineHeight", FLOAT, UNDERLINE_HEIGHT ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableMarkup", BOOLEAN, ENABLE_MARKUP ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableAutoScroll", BOOLEAN, ENABLE_AUTO_SCROLL ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollSpeed", INTEGER, AUTO_SCROLL_SPEED ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopCount", INTEGER, AUTO_SCROLL_LOOP_COUNT ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollGap", FLOAT, AUTO_SCROLL_GAP ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineSpacing", FLOAT, LINE_SPACING ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", MAP, UNDERLINE ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", MAP, SHADOW ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", MAP, EMBOSS ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", MAP, OUTLINE ) -DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pixelSize", FLOAT, PIXEL_SIZE ) -DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "ellipsis", BOOLEAN, ELLIPSIS ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "text", STRING, TEXT ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontFamily", STRING, FONT_FAMILY ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", MAP, FONT_STYLE ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pointSize", FLOAT, POINT_SIZE ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalAlignment", STRING, VERTICAL_ALIGNMENT ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textColor", VECTOR4, TEXT_COLOR ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowOffset", VECTOR2, SHADOW_OFFSET ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowColor", VECTOR4, SHADOW_COLOR ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineEnabled", BOOLEAN, UNDERLINE_ENABLED ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineColor", VECTOR4, UNDERLINE_COLOR ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineHeight", FLOAT, UNDERLINE_HEIGHT ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableMarkup", BOOLEAN, ENABLE_MARKUP ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableAutoScroll", BOOLEAN, ENABLE_AUTO_SCROLL ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollSpeed", INTEGER, AUTO_SCROLL_SPEED ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopCount", INTEGER, AUTO_SCROLL_LOOP_COUNT ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollGap", FLOAT, AUTO_SCROLL_GAP ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineSpacing", FLOAT, LINE_SPACING ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", MAP, UNDERLINE ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", MAP, SHADOW ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", MAP, EMBOSS ) +DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", MAP, OUTLINE ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pixelSize", FLOAT, PIXEL_SIZE ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "ellipsis", BOOLEAN, ELLIPSIS ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopDelay", FLOAT, AUTO_SCROLL_LOOP_DELAY ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE ) DALI_TYPE_REGISTRATION_END() @@ -353,6 +362,22 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE: + { + if( !impl.mTextScroller ) + { + impl.mTextScroller = Text::TextScroller::New( impl ); + } + DevelTextLabel::AutoScrollStopMode::Type stopMode = impl.mTextScroller->GetStopMode(); + if( Scripting::GetEnumerationProperty< Toolkit::DevelTextLabel::AutoScrollStopMode::Type >( value, + AUTO_SCROLL_STOP_MODE_TABLE, + AUTO_SCROLL_STOP_MODE_TABLE_COUNT, + stopMode ) ) + { + impl.mTextScroller->SetStopMode( stopMode ); + } + break; + } case Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED: { if( !impl.mTextScroller ) @@ -371,6 +396,15 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr impl.mTextScroller->SetLoopCount( value.Get() ); break; } + case Toolkit::DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY: + { + if( !impl.mTextScroller ) + { + impl.mTextScroller = Text::TextScroller::New( impl ); + } + impl.mTextScroller->SetLoopDelay( value.Get() ); + break; + } case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP: { if( !impl.mTextScroller ) @@ -602,6 +636,20 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::DevelTextLabel::Property::AUTO_SCROLL_STOP_MODE: + { + if( impl.mTextScroller ) + { + const char* mode = Scripting::GetEnumerationName< Toolkit::DevelTextLabel::AutoScrollStopMode::Type >( impl.mTextScroller->GetStopMode(), + AUTO_SCROLL_STOP_MODE_TABLE, + AUTO_SCROLL_STOP_MODE_TABLE_COUNT ); + if( mode ) + { + value = std::string( mode ); + } + } + break; + } case Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED: { TextLabel& impl( GetImpl( label ) ); @@ -623,6 +671,18 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::DevelTextLabel::Property::AUTO_SCROLL_LOOP_DELAY: + { + if( impl.mController ) + { + TextLabel& impl( GetImpl( label ) ); + if ( impl.mTextScroller ) + { + value = impl.mTextScroller->GetLoopDelay(); + } + } + break; + } case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP: { TextLabel& impl( GetImpl( label ) ); diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp index 260bd5a..fd1d8e4 100644 --- a/dali-toolkit/internal/text/multi-language-support-impl.cpp +++ b/dali-toolkit/internal/text/multi-language-support-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. @@ -477,9 +477,9 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, currentFontId = fontId; // Get the script for the current character. - const Script script = GetScript( index, - scriptRunIt, - scriptRunEndIt ); + Script script = GetScript( index, + scriptRunIt, + scriptRunEndIt ); #ifdef DEBUG_ENABLED { @@ -494,6 +494,10 @@ void MultilanguageSupport::ValidateFonts( const Vector& text, description.path.c_str() ); } #endif + if (script == TextAbstraction::UNKNOWN) + { + script = TextAbstraction::LATIN; + } // Validate whether the current character is supported by the given font. bool isValidFont = false; diff --git a/dali-toolkit/internal/text/text-controller-impl.h b/dali-toolkit/internal/text/text-controller-impl.h index f317fb3..43a7cf3 100644 --- a/dali-toolkit/internal/text/text-controller-impl.h +++ b/dali-toolkit/internal/text/text-controller-impl.h @@ -314,7 +314,9 @@ struct Controller::Impl mMarkupProcessorEnabled( false ), mClipboardHideEnabled( true ), mIsAutoScrollEnabled( false ), - mAutoScrollDirectionRTL( false ) + mAutoScrollDirectionRTL( false ), + mUnderlineSetByString( false ), + mShadowSetByString( false ) { mModel = Model::New(); @@ -721,6 +723,8 @@ public: bool mIsAutoScrollEnabled:1; ///< Whether auto text scrolling is enabled. CharacterDirection mAutoScrollDirectionRTL:1; ///< Direction of auto scrolling, true if rtl + 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 }; } // namespace Text diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 2811804..7545481 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1418,6 +1418,26 @@ Controller::NoTextTap::Action Controller::GetNoTextLongPressAction() const return action; } +bool Controller::IsUnderlineSetByString() +{ + return mImpl->mUnderlineSetByString; +} + +void Controller::UnderlineSetByString( bool setByString ) +{ + mImpl->mUnderlineSetByString = setByString; +} + +bool Controller::IsShadowSetByString() +{ + return mImpl->mShadowSetByString; +} + +void Controller::ShadowSetByString( bool setByString ) +{ + mImpl->mShadowSetByString = 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 7301e70..b9cbb2c 100644 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -398,6 +398,30 @@ public: // Configure the text controller. */ NoTextTap::Action GetNoTextLongPressAction() const; + /** + * @brief Query if Underline settings were provided by string or map + * @return bool true if set by string + */ + bool IsUnderlineSetByString(); + + /** + * Set method underline setting were set by + * @param[in] bool, true if set by string + */ + void UnderlineSetByString( bool setByString ); + + /** + * @brief Query if shadow settings were provided by string or map + * @return bool true if set by string + */ + bool IsShadowSetByString(); + + /** + * Set method shadow setting were set by + * @param[in] bool, true if set by string + */ + void ShadowSetByString( bool setByString ); + public: // Update. /** diff --git a/dali-toolkit/internal/text/text-effects-style.cpp b/dali-toolkit/internal/text/text-effects-style.cpp index 44302d7..75fabd7 100644 --- a/dali-toolkit/internal/text/text-effects-style.cpp +++ b/dali-toolkit/internal/text/text-effects-style.cpp @@ -138,12 +138,39 @@ bool SetUnderlineProperties( ControllerPtr controller, const Property::Value& va bool heightDefined = false; float height = 0.f; - const bool empty = ParseUnderlineProperties( propertiesMap, - enabled, - colorDefined, - color, - heightDefined, - height ); + bool empty = true; + + if ( propertiesMap.Empty() ) + { + // Map empty so check if a string provided + const std::string propertyString = value.Get(); + + if ( !propertyString.empty() ) + { + Property::Map parsedStringMap; + Text::ParsePropertyString( propertyString, parsedStringMap ); + + empty = ParseUnderlineProperties( parsedStringMap, + enabled, + colorDefined, + color, + heightDefined, + height ); + + controller->UnderlineSetByString( !empty); + } + } + else + { + empty = ParseUnderlineProperties( propertiesMap, + enabled, + colorDefined, + color, + heightDefined, + height ); + + controller->UnderlineSetByString( false ); + } if( !empty ) { @@ -202,20 +229,40 @@ void GetUnderlineProperties( ControllerPtr controller, Property::Value& value, E const Vector4& color = controller->GetUnderlineColor(); const float height = controller->GetUnderlineHeight(); - Property::Map map; + if ( controller->IsUnderlineSetByString() ) + { + std::string underlineProperties = "{\"enable\":"; + const std::string enabledStr = enabled ? "true" : "false"; + underlineProperties += "\"" + enabledStr + "\","; + + std::string colorStr; + Vector4ToColorString( color, colorStr ); + underlineProperties += "\"color\":\"" + colorStr + "\","; + + std::string heightStr; + FloatToString( height, heightStr ); + underlineProperties += "\"height\":\"" + heightStr + "\"}"; + + value = underlineProperties; + } + else + { + Property::Map map; - const std::string enabledStr = enabled ? TRUE_TOKEN : FALSE_TOKEN; - map.Insert( ENABLE_KEY, enabledStr ); + const std::string enabledStr = enabled ? TRUE_TOKEN : FALSE_TOKEN; + map.Insert( ENABLE_KEY, enabledStr ); - std::string colorStr; - Vector4ToColorString( color, colorStr ); - map.Insert( COLOR_KEY, colorStr ); + std::string colorStr; + Vector4ToColorString( color, colorStr ); + map.Insert( COLOR_KEY, colorStr ); - std::string heightStr; - FloatToString( height, heightStr ); - map.Insert( HEIGHT_KEY, heightStr ); + std::string heightStr; + FloatToString( height, heightStr ); + map.Insert( HEIGHT_KEY, heightStr ); + + value = map; + } - value = map; break; } case EffectStyle::INPUT: @@ -244,11 +291,35 @@ bool SetShadowProperties( ControllerPtr controller, const Property::Value& value bool offsetDefined = false; Vector2 offset; - const bool empty = ParseShadowProperties( propertiesMap, - colorDefined, - color, - offsetDefined, - offset ); + bool empty = true; + + if ( propertiesMap.Empty() ) + { + // Map empty so check if a string provided + const std::string propertyString = value.Get(); + + Property::Map parsedStringMap; + Text::ParsePropertyString( propertyString, parsedStringMap ); + + empty = ParseShadowProperties( parsedStringMap, + colorDefined, + color, + offsetDefined, + offset ); + + controller->ShadowSetByString( !empty ); + + } + else + { + empty = ParseShadowProperties( propertiesMap, + colorDefined, + color, + offsetDefined, + offset ); + + controller->ShadowSetByString( false ); + } if( !empty ) { @@ -299,17 +370,34 @@ void GetShadowProperties( ControllerPtr controller, Property::Value& value, Effe const Vector4& color = controller->GetShadowColor(); const Vector2& offset = controller->GetShadowOffset(); - Property::Map map; + if ( controller->IsShadowSetByString() ) + { + std::string shadowProperties = "{"; - std::string colorStr; - Vector4ToColorString( color, colorStr ); - map.Insert( COLOR_KEY, colorStr ); + std::string colorStr; + Vector4ToColorString( color, colorStr ); + shadowProperties += "\"color\":\"" + colorStr + "\","; - std::string offsetStr; - Vector2ToString( offset, offsetStr ); - map.Insert( OFFSET_KEY, offsetStr ); + std::string offsetStr; + Vector2ToString( offset, offsetStr ); + shadowProperties += "\"offset\":\"" + offsetStr + "\"}"; - value = map; + value = shadowProperties; + } + else + { + Property::Map map; + + std::string colorStr; + Vector4ToColorString( color, colorStr ); + map.Insert( COLOR_KEY, colorStr ); + + std::string offsetStr; + Vector2ToString( offset, offsetStr ); + map.Insert( OFFSET_KEY, offsetStr ); + + value = map; + } break; } case EffectStyle::INPUT: diff --git a/dali-toolkit/internal/text/text-scroller.cpp b/dali-toolkit/internal/text/text-scroller.cpp index a9a7284..c80cf7d 100644 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -234,7 +234,23 @@ void TextScroller::SetLoopCount( int loopCount ) if ( loopCount == 0 ) // Request to stop looping { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount Single loop forced\n" ); - mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way + 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" ); @@ -245,6 +261,27 @@ int TextScroller::GetLoopCount() const return mLoopCount; } +void TextScroller::SetLoopDelay( float delay ) +{ + mLoopDelay = delay; +} + +float TextScroller::GetLoopDelay() const +{ + return mLoopDelay; +} + +void TextScroller::SetStopMode( DevelTextLabel::AutoScrollStopMode::Type stopMode ) +{ + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetAutoScrollStopMode [%s]\n",(stopMode == DevelTextLabel::AutoScrollStopMode::IMMEDIATE)?"IMMEDIATE":"FINISH_LOOP" ); + mStopMode = stopMode; +} + +DevelTextLabel::AutoScrollStopMode::Type TextScroller::GetStopMode() const +{ + return mStopMode; +} + Actor TextScroller::GetSourceCamera() const { return mOffscreenCameraActor; @@ -259,7 +296,9 @@ TextScroller::TextScroller( ScrollerInterface& scrollerInterface ) : mScrollerIn mScrollDeltaIndex( Property::INVALID_INDEX ), mScrollSpeed( MINIMUM_SCROLL_SPEED ), mLoopCount( 1 ), - mWrapGap( 0.0f ) + mLoopDelay( 0.0f ), + mWrapGap( 0.0f ), + mStopMode( DevelTextLabel::AutoScrollStopMode::FINISH_LOOP ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller Default Constructor\n" ); } @@ -333,7 +372,7 @@ void TextScroller::StartScrolling( float scrollAmount, float scrollDuration, int DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::StartScrolling scrollAmount[%f] scrollDuration[%f], loop[%d] speed[%d]\n", scrollAmount, scrollDuration, loopCount, mScrollSpeed ); mScrollAnimation = Animation::New( scrollDuration ); - mScrollAnimation.AnimateTo( Property( mScrollingTextActor, mScrollDeltaIndex ), scrollAmount ); + mScrollAnimation.AnimateTo( Property( mScrollingTextActor, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) ); mScrollAnimation.SetEndAction( Animation::Discard ); mScrollAnimation.SetLoopCount( loopCount ); mScrollAnimation.FinishedSignal().Connect( this, &TextScroller::AutoScrollAnimationFinished ); diff --git a/dali-toolkit/internal/text/text-scroller.h b/dali-toolkit/internal/text/text-scroller.h index 17824b6..f6c0b87 100644 --- a/dali-toolkit/internal/text/text-scroller.h +++ b/dali-toolkit/internal/text/text-scroller.h @@ -22,6 +22,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -104,6 +105,30 @@ public: int GetLoopCount() const; /** + * @brief Set the delay time of scroll animation loop + * @param[in] float delay time seconds of loops + */ + void SetLoopDelay( float delay ); + + /** + * @brief Get the delay time of scroll + * @return float delay time seconds of loops + */ + float GetLoopDelay() const; + + /** + * @brief Set the mode of scrolling stop + * @param[in] stopMode type when text scrolling is stoped. + */ + void SetStopMode( DevelTextLabel::AutoScrollStopMode::Type stopMode ); + + /** + * @brief Get the mode of scrolling stop + * @return stopMode type when text scrolling is stoped. + */ + DevelTextLabel::AutoScrollStopMode::Type GetStopMode() const; + + /** * @brief Get the camera used to look at source, should be added to the parent of target actor. * @return camera Actor */ @@ -161,9 +186,11 @@ private: Property::Index mScrollDeltaIndex; // Property used by shader to represent distance to scroll Animation mScrollAnimation; // Animation used to update the mScrollDeltaIndex - int mScrollSpeed; ///< Speed which text should automatically scroll at - int mLoopCount; ///< Number of time the text should scroll - float mWrapGap; ///< Gap before text wraps around when scrolling + int mScrollSpeed; ///< Speed which text should automatically scroll at + int mLoopCount; ///< Number of time the text should scroll + float mLoopDelay; ///< Time delay of loop start + float mWrapGap; ///< Gap before text wraps around when scrolling + DevelTextLabel::AutoScrollStopMode::Type mStopMode; ///< Stop mode of scrolling text, when loop count is 0. }; // TextScroller class diff --git a/dali-toolkit/public-api/controls/buttons/push-button.cpp b/dali-toolkit/public-api/controls/buttons/push-button.cpp index 80f8b16..22dba2d 100644 --- a/dali-toolkit/public-api/controls/buttons/push-button.cpp +++ b/dali-toolkit/public-api/controls/buttons/push-button.cpp @@ -82,46 +82,49 @@ void PushButton::SetButtonImage( Actor image ) { DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetButtonImage() is deprecated and will be removed from next release. Use Button.SetProperty UNSELECTED_STATE_IMAGE or Styling file instead.\n" ); - // Passing Image as Actor not supported + Dali::Toolkit::GetImplementation( *this ).SetButtonImage( image ); } void PushButton::SetBackgroundImage( Actor image ) { DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release.\n" ); - // Passing Image as Actor not supported} + Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( image ); } void PushButton::SetSelectedImage( Actor image ) { DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedImage() is deprecated and will be removed from next release. Use Button.SetProperty SELECTED_STATE_IMAGE or Styling file instead.\n" ); - // Passing Image as Actor not supported} + Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( image ); } void PushButton::SetSelectedBackgroundImage( Actor image ) { DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedBackgroundImage() is deprecated and will be removed from next release.\n" ); - // Passing Image as Actor not supported} + Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( image ); } void PushButton::SetDisabledBackgroundImage( Actor image ) { DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledBackgroundImage() is deprecated and will be removed from next release.\n" ); - // Passing Image as Actor not supported} + + Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( image ); } void PushButton::SetDisabledImage( Actor image ) { DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledImage() is deprecated and will be removed from next release. Use Button.SetProperty DISABLED_STATE_IMAGE or Styling file instead.\n" ); - // Passing Image as Actor not supported + + Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( image ); } void PushButton::SetDisabledSelectedImage( Actor image ) { DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledSelectedImage() is deprecated and will be removed from next release.\n" ); - // Passing Image as Actor not supported + + Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( image ); } } // namespace Toolkit diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 1729757..8e79e95 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 = 38; +const unsigned int TOOLKIT_MICRO_VERSION = 39; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 00be595..019afcb 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.38 +Version: 1.2.39 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT