diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index d7bc887..575f2b6 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -56,7 +56,7 @@ SET(DEMO_EXAMPLE_BIN \\"${BINDIR}/\\") SET(DEMO_LOCALE_DIR \\"${LOCALE_DIR}\\") SET(DEMO_LANG \\"${LANG}\\") -SET(DEMO_STYLE_IMAGE_DIR ${STYLE_DIR}images) +SET(DEMO_STYLE_IMAGE_DIR ${STYLE_DIR}/images) FILE(GLOB LOCAL_IMAGES_PNG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.png") FILE(GLOB LOCAL_IMAGES_JPG RELATIVE "${LOCAL_IMAGES_DIR}" "${LOCAL_IMAGES_DIR}/*.jpg") diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index daebe61..7be5608 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -44,6 +44,7 @@ const std::string TILE_BACKGROUND_ALPHA(DEMO_IMAGE_DIR "item-background-alpha.9. const char * const DEFAULT_TOOLBAR_TEXT( "TOUCH TO LAUNCH EXAMPLE" ); +const Vector4 TILE_COLOR( 0.5f, 0.6f, 0.8f, 0.23f ); ///< Color (including alpha) of tile contents. const float BUTTON_PRESS_ANIMATION_TIME = 0.25f; ///< Time to perform button scale effect. const float ROTATE_ANIMATION_TIME = 0.5f; ///< Time to perform rotate effect. const int MAX_PAGES = 256; ///< Maximum pages (arbitrary safety limit) @@ -54,34 +55,6 @@ const float LOGO_MARGIN_RATIO = 0.1f / 0.3f; const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f; const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent const Vector3 TABLE_RELATIVE_SIZE(0.95f, 0.9f, 0.8f ); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights. -const float STENCIL_RELATIVE_SIZE = 1.0f; - -const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects -const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects -const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f); - -const Vector4 BUBBLE_COLOR[] = -{ - Vector4( 0.3255f, 0.3412f, 0.6353f, 0.38f ), - Vector4( 0.3647f, 0.7569f, 0.8157f, 0.38f ), - Vector4( 0.3804f, 0.7412f, 0.6510f, 0.38f ), - Vector4( 1.f, 1.f, 1.f, 0.2f ) -}; -const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) ); - -const int NUM_BACKGROUND_IMAGES = 18; -const float BACKGROUND_SWIPE_SCALE = 0.025f; -const float BACKGROUND_SPREAD_SCALE = 1.5f; -const float SCALE_MOD = 1000.0f * Math::PI * 2.0f; -const float SCALE_SPEED = 10.0f; -const float SCALE_SPEED_SIN = 0.1f; - -const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs - -const Vector4 BACKGROUND_COLOR( 0.3569f, 0.5451f, 0.7294f, 1.0f ); - -const float BUBBLE_MIN_Z = -1.0; -const float BUBBLE_MAX_Z = 0.0f; /** * Creates the background image @@ -90,7 +63,7 @@ Control CreateBackground( std::string stylename ) { Control background = Control::New(); Stage::GetCurrent().Add( background ); - background.SetProperty( Control::Property::STYLE_NAME,stylename); + background.SetStyleName( stylename); background.SetName( "BACKGROUND" ); background.SetAnchorPoint( AnchorPoint::CENTER ); background.SetParentOrigin( ParentOrigin::CENTER ); @@ -99,38 +72,6 @@ Control CreateBackground( std::string stylename ) return background; } -/** - * Constraint to return a position for a bubble based on the scroll value and vertical wrapping - */ -struct AnimateBubbleConstraint -{ -public: - AnimateBubbleConstraint( const Vector3& initialPos, float scale ) - : mInitialX( initialPos.x ), - mScale( scale ) - { - } - - void operator()( Vector3& position, const PropertyInputContainer& inputs ) - { - const Vector3& parentSize = inputs[1]->GetVector3(); - const Vector3& childSize = inputs[2]->GetVector3(); - - // Wrap bubbles vertically. - float range = parentSize.y + childSize.y; - // This performs a float mod (we don't use fmod as we want the arithmetic modulus as opposed to the remainder). - position.y -= range * ( floor( position.y / range ) + 0.5f ); - - // Bubbles X position moves parallax to horizontal - // panning by a scale factor unique to each bubble. - position.x = mInitialX + ( inputs[0]->GetVector2().x * mScale ); - } - -private: - float mInitialX; - float mScale; -}; - bool CompareByTitle( const Example& lhs, const Example& rhs ) { return lhs.title < rhs.title; @@ -150,16 +91,13 @@ DaliTableView::DaliTableView( Application& application ) mScrollRulerX(), mScrollRulerY(), mPressedActor(), - mAnimationTimer(), mLogoTapDetector(), mVersionPopup(), mPages(), - mBackgroundAnimations(), mExampleList(), mTotalPages(), mScrolling( false ), - mSortAlphabetically( false ), - mBackgroundAnimsPlaying( false ) + mSortAlphabetically( false ) { application.InitSignal().Connect( this, &DaliTableView::Initialize ); } @@ -185,7 +123,7 @@ void DaliTableView::Initialize( Application& application ) const Vector2 stageSize = Stage::GetCurrent().GetSize(); // Background - Control background = CreateBackground( "launcherbackground" ); + Control background = CreateBackground( "LauncherBackground" ); Stage::GetCurrent().Add( background ); // Add root actor @@ -251,25 +189,6 @@ void DaliTableView::Initialize( Application& application ) mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER ); mScrollViewLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - // Create solid background colour. - Control backgroundColourActor = Control::New(); - backgroundColourActor.SetBackgroundColor( BACKGROUND_COLOR ); - backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER ); - backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER ); - backgroundColourActor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); - backgroundColourActor.SetSizeModeFactor( Vector3( 1.0f, 1.5f, 1.0f ) ); - - mScrollViewLayer.Add( backgroundColourActor ); - - // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show - Actor bubbleContainer = Actor::New(); - bubbleContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER ); - bubbleContainer.SetParentOrigin( ParentOrigin::CENTER ); - backgroundColourActor.Add( bubbleContainer ); - - SetupBackground( bubbleContainer ); - Alignment buttonsAlignment = Alignment::New(); buttonsAlignment.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); buttonsAlignment.Add( mScrollViewLayer ); @@ -301,12 +220,6 @@ void DaliTableView::Initialize( Application& application ) winHandle.ShowIndicator( Dali::Window::INVISIBLE ); - // Background animation - mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION ); - mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation ); - mAnimationTimer.Start(); - mBackgroundAnimsPlaying = true; - KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &DaliTableView::OnKeyboardPreFocusChange ); KeyboardFocusManager::Get().FocusedActorEnterKeySignal().Connect( this, &DaliTableView::OnFocusedActorActivated ); AccessibilityManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated ); @@ -325,7 +238,6 @@ void DaliTableView::ApplyCubeEffectToPages() void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor ) { - } void DaliTableView::Populate() @@ -364,7 +276,7 @@ void DaliTableView::Populate() { const Example& example = ( *iter ); - Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true ); + Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), TILE_COLOR ); AccessibilityManager accessibilityManager = AccessibilityManager::Get(); accessibilityManager.SetFocusOrder( tile, ++exampleCount ); accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_LABEL, @@ -436,7 +348,7 @@ void DaliTableView::Rotate( unsigned int degrees ) mRotateAnimation.Play(); } -Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground ) +Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, const Dali::Vector4& color ) { Actor content = Actor::New(); content.SetName( name ); @@ -445,26 +357,28 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit content.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); content.SetSizeModeFactor( sizeMultiplier ); - // create background image - if( addBackground ) - { - ImageView image = ImageView::New( TILE_BACKGROUND ); - image.SetAnchorPoint( AnchorPoint::CENTER ); - image.SetParentOrigin( ParentOrigin::CENTER ); - // make the image 100% of tile - image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - - content.Add( image ); - - // Add stencil - Toolkit::ImageView stencil = NewStencilImage(); - stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - image.Add( stencil ); - } + // Create background image. + ImageView image = ImageView::New( TILE_BACKGROUND ); + image.SetAnchorPoint( AnchorPoint::CENTER ); + image.SetParentOrigin( ParentOrigin::CENTER ); + // Make the image 100% of tile. + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + content.Add( image ); + + // Create the tile background. + Actor tileBackground = ImageView::New( TILE_BACKGROUND_ALPHA ); + tileBackground.SetParentOrigin( ParentOrigin::CENTER ); + tileBackground.SetAnchorPoint( AnchorPoint::CENTER ); + tileBackground.SetProperty( Actor::Property::COLOR, color ); + Property::Map shaderEffect = CreateAlphaDiscardEffect(); + tileBackground.SetProperty( Toolkit::ImageView::Property::IMAGE, shaderEffect ); + tileBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + image.Add( tileBackground ); + // Create the tile label. TextLabel label = TextLabel::New(); label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - label.SetProperty( Control::Property::STYLE_NAME, "launcherlabel" ); + label.SetStyleName( "LauncherLabel" ); label.SetProperty( TextLabel::Property::MULTI_LINE, true ); label.SetProperty( TextLabel::Property::TEXT, title ); label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); @@ -482,19 +396,6 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit return content; } -Toolkit::ImageView DaliTableView::NewStencilImage() -{ - Toolkit::ImageView stencil = ImageView::New( TILE_BACKGROUND_ALPHA ); - stencil.SetParentOrigin( ParentOrigin::CENTER ); - stencil.SetAnchorPoint( AnchorPoint::CENTER ); - stencil.SetDrawMode( DrawMode::STENCIL ); - - Property::Map shaderEffect = CreateAlphaDiscardEffect(); - stencil.SetProperty( Toolkit::ImageView::Property::IMAGE, shaderEffect ); - - return stencil; -} - bool DaliTableView::OnTilePressed( Actor actor, const TouchData& event ) { return DoTilePress( actor, event.GetState( 0 ) ); @@ -571,8 +472,6 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) void DaliTableView::OnScrollStart( const Dali::Vector2& position ) { mScrolling = true; - - PlayAnimation(); } void DaliTableView::OnScrollComplete( const Dali::Vector2& position ) @@ -656,138 +555,6 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event ) } } -void DaliTableView::SetupBackground( Actor bubbleContainer ) -{ - // Create distance field shape. - BufferImage distanceField; - Size imageSize( 512, 512 ); - CreateShapeImage( CIRCLE, imageSize, distanceField ); - - // Add bubbles to the bubbleContainer. - // Note: The bubbleContainer is parented externally to this function. - AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField ); -} - -void DaliTableView::InitialiseBackgroundActors( Actor actor ) -{ - // Delete current animations - mBackgroundAnimations.clear(); - - // Create new animations - const Vector3 size = actor.GetTargetSize(); - - for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i ) - { - Actor child = actor.GetChildAt( i ); - - // Calculate a random position - Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ), - Random::Range( -size.y, size.y ), - Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) ); - - child.SetPosition( childPos ); - - // Define bubble horizontal parallax and vertical wrapping - Constraint animConstraint = Constraint::New < Vector3 > ( child, Actor::Property::POSITION, AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ) ) ); - animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) ); - animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) ); - animConstraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) ); - animConstraint.SetRemoveAction( Constraint::Discard ); - animConstraint.Apply(); - - // Kickoff animation - Animation animation = Animation::New( Random::Range( 30.0f, 160.0f ) ); - animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -2000.0f, 0.0f ), AlphaFunction::LINEAR ); - animation.SetLooping( true ); - animation.Play(); - mBackgroundAnimations.push_back( animation ); - } -} - -void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField ) -{ - for( int i = 0; i < count; ++i ) - { - float randSize = Random::Range( 10.0f, 400.0f ); - ImageView dfActor = ImageView::New( distanceField ); - dfActor.SetSize( Vector2( randSize, randSize ) ); - dfActor.SetParentOrigin( ParentOrigin::CENTER ); - - Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect(); - dfActor.SetProperty( Toolkit::ImageView::Property::IMAGE, effect ); - dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] ); - - layer.Add( dfActor ); - } - - // Positioning will occur when the layer is relaid out - layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors ); -} - -void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut ) -{ - // this bitmap will hold the alpha map for the distance field shader - distanceFieldOut = BufferImage::New( size.width, size.height, Pixel::A8 ); - - // Generate bit pattern - std::vector< unsigned char > imageDataA8; - imageDataA8.reserve( size.width * size.height ); // A8 - - switch( shapeType ) - { - case CIRCLE: - GenerateCircle( size, imageDataA8 ); - break; - case SQUARE: - GenerateSquare( size, imageDataA8 ); - break; - default: - break; - } - - PixelBuffer* buffer = distanceFieldOut.GetBuffer(); - if( buffer ) - { - GenerateDistanceFieldMap( &imageDataA8[ 0 ], size, buffer, size, 8.0f, size ); - distanceFieldOut.Update(); - } -} - -void DaliTableView::GenerateSquare( const Size& size, std::vector< unsigned char >& distanceFieldOut ) -{ - for( int h = 0; h < size.height; ++h ) - { - for( int w = 0; w < size.width; ++w ) - { - distanceFieldOut.push_back( 0xFF ); - } - } -} - -void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char >& distanceFieldOut ) -{ - const float radius = size.width * 0.5f * size.width * 0.5f; - Vector2 center( size.width / 2, size.height / 2 ); - - for( int h = 0; h < size.height; ++h ) - { - for( int w = 0; w < size.width; ++w ) - { - Vector2 pos( w, h ); - Vector2 dist = pos - center; - - if( dist.x * dist.x + dist.y * dist.y > radius ) - { - distanceFieldOut.push_back( 0x00 ); - } - else - { - distanceFieldOut.push_back( 0xFF ); - } - } - } -} - ImageView DaliTableView::CreateLogo( std::string imagePath ) { ImageView logo = ImageView::New( imagePath ); @@ -798,45 +565,6 @@ ImageView DaliTableView::CreateLogo( std::string imagePath ) return logo; } -bool DaliTableView::PauseBackgroundAnimation() -{ - PauseAnimation(); - - return false; -} - -void DaliTableView::PauseAnimation() -{ - if( mBackgroundAnimsPlaying ) - { - for( AnimationListIter animIter = mBackgroundAnimations.begin(); animIter != mBackgroundAnimations.end(); ++animIter ) - { - Animation anim = *animIter; - - anim.Stop(); - } - - mBackgroundAnimsPlaying = false; - } -} - -void DaliTableView::PlayAnimation() -{ - if ( !mBackgroundAnimsPlaying ) - { - for( AnimationListIter animIter = mBackgroundAnimations.begin(); animIter != mBackgroundAnimations.end(); ++animIter ) - { - Animation anim = *animIter; - - anim.Play(); - } - - mBackgroundAnimsPlaying = true; - } - - mAnimationTimer.SetInterval( BACKGROUND_ANIMATION_DURATION ); -} - Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction ) { Actor nextFocusActor = proposed; @@ -930,11 +658,13 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( "Version information" ); titleActor.SetName( "titleActor" ); titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + titleActor.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE ); Toolkit::TextLabel contentActor = Toolkit::TextLabel::New( stream.str() ); contentActor.SetName( "contentActor" ); contentActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true ); contentActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + contentActor.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE ); contentActor.SetPadding( Padding( 0.0f, 0.0f, 20.0f, 0.0f ) ); mVersionPopup.SetTitle( titleActor ); diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index 749000b..c712a5b 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -1,8 +1,8 @@ -#ifndef __DALI_DEMO_H__ -#define __DALI_DEMO_H__ +#ifndef DALI_DEMO_H +#define DALI_DEMO_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -98,15 +98,6 @@ public: private: // Application callbacks & implementation /** - * Shape enum for create function - */ - enum ShapeType - { - CIRCLE, - SQUARE - }; - - /** * Initialize application. * * @param[in] app Application instance @@ -140,18 +131,11 @@ private: // Application callbacks & implementation * @param[in] name The unique name for this Tile * @param[in] title The text caption that appears on the Tile * @param[in] parentSize Tile's parent size. - * @param[in] addBackground Whether to add a background graphic to the tile or not + * @param[in] color The color (including alpha) of the tiles contents. * * @return The Actor for the created tile. */ - Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground ); - - /** - * Create a stencil image - * - * @return The stencil image - */ - Dali::Toolkit::ImageView NewStencilImage(); + Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, const Dali::Vector4& color ); // Signal handlers @@ -257,49 +241,6 @@ private: // Application callbacks & implementation void OnKeyEvent( const Dali::KeyEvent& event ); /** - * Create a depth field background - * - * @param[in] bubbleLayer Add the graphics to this layer - */ - void SetupBackground( Dali::Actor bubbleLayer ); - - /** - * Create background actors for the given layer - * - * @param[in] layer The layer to add the actors to - * @param[in] count The number of actors to generate - * @param[in] distanceField The distance field bitmap to use - */ - void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField ); - - /** - * Create a bitmap with the specified shape and also output a distance field - * - * @param[in] shapeType The shape to generate - * @param[in] size The size of the bitmap to create - * @param[out] distanceFieldOut The return depth field alpha map - */ - void CreateShapeImage( ShapeType shapeType, const Dali::Size& size, Dali::BufferImage& distanceFieldOut ); - - /** - * Generate a square bit pattern and depth field - * - * @param[in] size The size of the bitmap to create - * @param[out] imageOut The return bitmap - * @param[out] distanceFieldOut The return depth field alpha map - */ - void GenerateSquare( const Dali::Size& size, std::vector& distanceFieldOut ); - - /** - * Generate a circle bit pattern and depth field - * - * @param[in] size The size of the bitmap to create - * @param[out] imageOut The return bitmap - * @param[out] distanceFieldOut The return depth field alpha map - */ - void GenerateCircle( const Dali::Size& size, std::vector& distanceFieldOut ); - - /** * Creates the logo. * * @param[in] imagePath The path to the image file to load @@ -309,23 +250,6 @@ private: // Application callbacks & implementation Dali::Toolkit::ImageView CreateLogo( std::string imagePath ); /** - * Timer handler for ending background animation - * - * @return Return value for timer handler - */ - bool PauseBackgroundAnimation(); - - /** - * Pause all animations - */ - void PauseAnimation(); - - /** - * Resume all animations - */ - void PlayAnimation(); - - /** * Callback when the keyboard focus is going to be changed. * * @param[in] current The current focused actor @@ -362,13 +286,6 @@ private: // Application callbacks & implementation */ void OnButtonsPageRelayout( const Dali::Actor& actor ); - /** - * @brief Callback called to set up background actors - * - * @param[in] actor The actor raising the callback - */ - void InitialiseBackgroundActors( Dali::Actor actor ); - private: Dali::Application& mApplication; ///< Application instance. @@ -382,20 +299,17 @@ private: Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler Dali::Toolkit::RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler Dali::Actor mPressedActor; ///< The currently pressed actor. - Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information std::vector< Dali::Actor > mPages; ///< List of pages. - AnimationList mBackgroundAnimations; ///< List of background bubble animations ExampleList mExampleList; ///< List of examples. int mTotalPages; ///< Total pages within scrollview. bool mScrolling:1; ///< Flag indicating whether view is currently being scrolled bool mSortAlphabetically:1; ///< Sort examples alphabetically. - bool mBackgroundAnimsPlaying:1; ///< Are background animations playing }; -#endif // __DALI_DEMO_H__ +#endif // DALI_DEMO_H diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index e80c88b..81aacaf 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -387,7 +387,7 @@ public: Actor MenuItem(const std::string& text) { TextLabel label = TextLabel::New( ShortName( text ) ); - label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "builderlabel" ); + label.SetStyleName( "BuilderLabel" ); label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); // Hook up tap detector diff --git a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp index 7cdc4a6..f13617a 100644 --- a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp +++ b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp @@ -45,9 +45,8 @@ const char* const SAMPLING_BUTTON_ID = "SAMPLING_BUTTON"; const char* const FITTING_BUTTON_TEXT = "Fitting"; const char* const SAMPLING_BUTTON_TEXT = "Sampling"; -const char* const STYLE_LABEL_TEXT = "grouplabel"; -const char* const STYLE_BUTTON_TEXT = "buttonlabel"; - +const char* const STYLE_LABEL_TEXT = "ImageScalingGroupLabel"; +const char* const STYLE_BUTTON_TEXT = "ImageScalingButton"; const char* IMAGE_PATHS[] = { @@ -336,7 +335,7 @@ public: fittingModeGroup.SetFitHeight( 1 ); TextLabel label = TextLabel::New( "Image fitting mode:" ); - label.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_LABEL_TEXT ); + label.SetStyleName( STYLE_LABEL_TEXT ); fittingModeGroup.Add( label ); Toolkit::PushButton button = CreateButton( FITTING_BUTTON_ID, StringFromScalingMode( mFittingMode ) ); @@ -357,7 +356,7 @@ public: samplingModeGroup.SetFitHeight( 1 ); TextLabel label = TextLabel::New( "Image sampling mode:" ); - label.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_LABEL_TEXT ); + label.SetStyleName( STYLE_LABEL_TEXT ); samplingModeGroup.Add( label ); Toolkit::PushButton button = CreateButton( SAMPLING_BUTTON_ID, StringFromFilterMode( mSamplingMode ) ); @@ -371,7 +370,7 @@ public: Toolkit::PushButton CreateButton( const char * id, const char * label ) { Toolkit::PushButton button = Toolkit::PushButton::New(); - button.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); + button.SetStyleName( STYLE_BUTTON_TEXT ); button.SetName( id ); button.SetLabelText( label ); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); diff --git a/examples/primitive-shapes/primitive-shapes-example.cpp b/examples/primitive-shapes/primitive-shapes-example.cpp index 9329371..89ff58c 100644 --- a/examples/primitive-shapes/primitive-shapes-example.cpp +++ b/examples/primitive-shapes/primitive-shapes-example.cpp @@ -318,7 +318,7 @@ public: //Visual map for model mVisualMap.Clear(); mVisualMap[ Visual::Property::TYPE ] = Visual::PRIMITIVE; - mVisualMap[ PrimitiveVisual::Property::COLOR ] = mColor; + mVisualMap[ PrimitiveVisual::Property::MIX_COLOR ] = mColor; } //Sets the 3D model to a sphere and modifies the sliders appropriately. diff --git a/examples/styling/styling-application.cpp b/examples/styling/styling-application.cpp index b37279c..c885987 100644 --- a/examples/styling/styling-application.cpp +++ b/examples/styling/styling-application.cpp @@ -135,7 +135,7 @@ void StylingApplication::Create( Application& application ) mTitle = TextLabel::New( "Styling Example" ); mTitle.SetName( "Title" ); - mTitle.SetStyleName("title"); + mTitle.SetStyleName("Title"); mTitle.SetAnchorPoint( AnchorPoint::TOP_CENTER ); mTitle.SetParentOrigin( ParentOrigin::TOP_CENTER ); mTitle.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); @@ -246,7 +246,7 @@ void StylingApplication::Create( Application& application ) channelSliderLayout.SetCellAlignment( TableView::CellPosition( i, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); TextLabel label = TextLabel::New( checkboxLabels[i] ); - std::ostringstream labelStyleName; labelStyleName << "colorLabel" << i+1; + std::ostringstream labelStyleName; labelStyleName << "ColorLabel" << i+1; label.SetName( labelStyleName.str() ); label.SetStyleName( labelStyleName.str() ); label.SetParentOrigin( ParentOrigin::CENTER ); @@ -258,7 +258,7 @@ void StylingApplication::Create( Application& application ) channelSliderLayout.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); mChannelSliders[i] = Slider::New(); - std::ostringstream sliderStyleName; sliderStyleName << "colorSlider" << i+1; + std::ostringstream sliderStyleName; sliderStyleName << "ColorSlider" << i+1; mChannelSliders[i].SetName( sliderStyleName.str() ); mChannelSliders[i].SetStyleName( sliderStyleName.str() ); mChannelSliders[i].SetParentOrigin( ParentOrigin::CENTER ); @@ -302,7 +302,7 @@ void StylingApplication::Create( Application& application ) TextLabel label = TextLabel::New( "Theme: "); label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - label.SetStyleName("themelabel"); + label.SetStyleName("ThemeLabel"); label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); label.SetParentOrigin( ParentOrigin::TOP_CENTER ); themeButtonLayout.AddChild( label, TableView::CellPosition( 0, 0 ) ); @@ -386,7 +386,7 @@ Popup StylingApplication::CreateResetPopup() TextLabel text = TextLabel::New( "This will reset the channel data to full value. Are you sure?" ); text.SetName( "PopupContentText" ); - text.SetStyleName( "popupBody" ); + text.SetStyleName( "PopupBody" ); text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); text.SetProperty( TextLabel::Property::MULTI_LINE, true ); @@ -442,7 +442,7 @@ TextLabel StylingApplication::CreateTitle( std::string title ) { TextLabel titleActor = TextLabel::New( title ); titleActor.SetName( "titleActor" ); - titleActor.SetStyleName( "popupTitle" ); + titleActor.SetStyleName( "PopupTitle" ); titleActor.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); titleActor.SetProperty( TextLabel::Property::MULTI_LINE, false ); diff --git a/examples/text-fonts/text-fonts-example.cpp b/examples/text-fonts/text-fonts-example.cpp index 9cc4d8e..be78963 100644 --- a/examples/text-fonts/text-fonts-example.cpp +++ b/examples/text-fonts/text-fonts-example.cpp @@ -185,7 +185,7 @@ public: CreateTextLabel ( mLabel, LABEL_TEXT, Color::WHITE ); CreateTextLabel ( mLabel2, LABEL_TEXT, Color::WHITE ); - mLabel2.SetStyleName("textlabel-Rosemary"); + mLabel2.SetStyleName("TextLabelRosemary"); CreateTextLabel ( mLabel3, LABEL_TEXT, Color::WHITE ); mLabel3.SetProperty( TextLabel::Property::FONT_FAMILY, "SamsungOneUI" ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 0df8b31..aad06e0 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.2.3 +Version: 1.2.4 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/style/demo-theme.json.in b/resources/style/demo-theme.json.in index 21e0f2e..8cf572d 100644 --- a/resources/style/demo-theme.json.in +++ b/resources/style/demo-theme.json.in @@ -17,50 +17,52 @@ { "styles": { - "confirmationpopup":{ + "ConfirmationPopup":{ "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/00_popup_bg.9.png" }, - "textlabel-Rosemary": + "TextLabelRosemary": { "fontFamily":"Rosemary" }, - "textlabel": + "TextLabel": { "fontStyle":"Regular", "pointSize":18 }, - "launcherlabel": + "LauncherLabel": { "pointSize":18 }, - "toolbarlabel": + "ToolbarLabel": { "pointSize":18 }, - "builderlabel": + "BuilderLabel": { "pointSize":13 }, - "scrollview": + "ScrollView": { "overshootEffectColor":"B018" }, - "grouplabel": + "ImageScalingGroupLabel": { "pointSize":9 }, - "buttonlabel": + "ImageScalingButton": { - "pointSize":11 + "label":{ + "pointSize":11 + } }, - "launcherbackground": + "LauncherBackground": { "background": { diff --git a/resources/style/images/00_popup_bg.9.png b/resources/style/images/00_popup_bg.9.png new file mode 100644 index 0000000..f0e84ff --- /dev/null +++ b/resources/style/images/00_popup_bg.9.png diff --git a/resources/style/mobile/demo-theme.json.in b/resources/style/mobile/demo-theme.json.in index 86a6b57..f8b5099 100644 --- a/resources/style/mobile/demo-theme.json.in +++ b/resources/style/mobile/demo-theme.json.in @@ -18,67 +18,67 @@ { "styles": { - "textlabel-Rosemary": + "TextLabelRosemary": { "fontFamily":"Rosemary" }, - "textlabel": + "TextLabel": { "fontStyle":"Regular", "pointSize":18 }, - "textlabelFontSize0": + "TextLabelFontSize0": { "pointSize":8 }, - "textlabelFontSize1": + "TextLabelFontSize1": { "pointSize":10 }, - "textlabelFontSize2": + "TextLabelFontSize2": { "pointSize":15 }, - "textlabelFontSize3": + "TextLabelFontSize3": { "pointSize":19 }, - "textlabelFontSize4": + "TextLabelFontSize4": { "pointSize":25 }, - "launcherlabel": + "Launcherlabel": { "pointSize":8 }, - "toolbarlabel": + "ToolbarLabel": { "pointSize":10 }, - "builderlabel": + "BuilderLabel": { "pointSize":10 }, - "scrollview": + "ScrollView": { "overshootEffectColor":"B018" }, - "grouplabel": + "GroupLabel": { "pointSize":6 }, - "buttonlabel": + "ButtonLabel": { "pointSize":8 }, - "launcherbackground": + "LauncherBackground": { "background": { diff --git a/resources/style/style-example-theme-one.json.in b/resources/style/style-example-theme-one.json.in index e84d423..29b628c 100644 --- a/resources/style/style-example-theme-one.json.in +++ b/resources/style/style-example-theme-one.json.in @@ -1,7 +1,7 @@ { "styles": { - "title":{ + "Title":{ "textColor":"#0000ff", "background": { @@ -9,58 +9,58 @@ "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] } }, - "tableview":{ + "TableView":{ "background": { "visualType":"COLOR", "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] } }, - "flexcontainer":{ + "FlexContainer":{ "background": { "visualType":"COLOR", "mixColor": [ 1.0, 1.0, 1.0, 0.1 ] } }, - "radiobutton":{ + "RadioButton":{ "label":{ "textColor": [1,1,1,1] } }, - "checkboxbutton":{ + "CheckBoxButton":{ "label":{ "textColor": [1,1,1,1] } }, - "colorLabel1":{ + "ColorLabel1":{ "textColor": [1,0,0,1] }, - "colorLabel2":{ + "ColorLabel2":{ "textColor": [0,1,0,1] }, - "colorLabel3":{ + "ColorLabel3":{ "textColor": [0.3,0.3,1,1] }, - "themelabel":{ + "ThemeLabel":{ "textColor":[0,1,1,1] }, - "popupTitle":{ + "PopupTitle":{ "textColor":[1,1,1,1] }, - "popupBody":{ + "PopupBody":{ "textColor":[1,1,0,1] }, - "textlabel":{ + "TextLabel":{ "textColor":[0,0,0,1] }, - "colorSlider1":{ - "styles":["slider"] + "ColorSlider1":{ + "styles":["Slider"] }, - "colorSlider2":{ + "ColorSlider2":{ "styles":["slider"] }, - "colorSlider3":{ + "ColorSlider3":{ "styles":["slider"] } } diff --git a/resources/style/style-example-theme-three.json.in b/resources/style/style-example-theme-three.json.in index c50ca22..f6feabb 100644 --- a/resources/style/style-example-theme-three.json.in +++ b/resources/style/style-example-theme-three.json.in @@ -1,7 +1,7 @@ { "styles": { - "title":{ + "Title":{ "textColor":"#0000ff", "background": { @@ -9,42 +9,42 @@ "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] } }, - "tableview":{ + "TableView":{ "background": { "visualType":"COLOR", "mixColor": [ 1.0, 1.0, 1.0, 0.03 ] } }, - "radiobutton":{ + "RadioButton":{ "label":{ "textColor": [1,1,1,1] } }, - "checkboxbutton":{ + "CheckboxButton":{ "label":{ "textColor": [1,1,1,1] } }, - "colorLabel1":{ + "ColorLabel1":{ "textColor": [1,0,0,1] }, - "colorLabel2":{ + "ColorLabel2":{ "textColor": [0,1,0,1] }, - "colorLabel3":{ + "ColorLabel3":{ "textColor": [0.3,0.3,1,1] }, - "themelabel":{ + "ThemeLabel":{ "textColor":[0,1,1,1] }, - "popupTitle":{ + "PopupTitle":{ "textColor":[1,1,1,1] }, - "popupBody":{ + "PopupBody":{ "textColor":[1,1,0,1] }, - "textlabel":{ + "TextLabel":{ "textColor":[0,0,0,1] } } diff --git a/resources/style/style-example-theme-two.json.in b/resources/style/style-example-theme-two.json.in index 61c78a9..77a8586 100644 --- a/resources/style/style-example-theme-two.json.in +++ b/resources/style/style-example-theme-two.json.in @@ -5,7 +5,7 @@ }, "styles": { - "title":{ + "Title":{ "textColor":"#0000ff", "background": { @@ -13,7 +13,7 @@ "mixColor": [ 1.0, 1.0, 1.0, 1.0 ] } }, - "tableview":{ + "TableView":{ "background": { "visualType":"GRADIENT", @@ -24,7 +24,7 @@ }, // Change an icon size, see if it gets properly re-sized - "radiobutton":{ + "RadioButton":{ "unselectedStateImage":"{STYLE_DIR}/images/radio-button-unselected.png", "selectedStateImage":"{STYLE_DIR}/images/radio-button-selected.png", "disabledStateImage":"{STYLE_DIR}/images/radio-button-unselected-disabled.png", @@ -58,11 +58,11 @@ }, // Note, this overrides any non-renamed label styles, e.g. those in a button. - "textlabel":{ + "TextLabel":{ //"textColor":[0,0,0,1] }, - "thinslider":{ + "ThinSlider":{ "styles": ["slider"], "showPopup":true, "showValue":false, @@ -75,19 +75,19 @@ }, "enabled":true }, - "colorSlider1":{ - "styles":["thinslider"], + "ColorSlider1":{ + "styles":["ThinSlider"], "progressVisual":{ "url":"{STYLE_DIR}/images/slider-skin-progress-red.9.png" } }, - "colorSlider2":{ - "styles":["thinslider"], + "ColorSlider2":{ + "styles":["ThinSlider"], "progressVisual":{ "url":"{STYLE_DIR}/images/slider-skin-progress-green.9.png" } }, - "colorSlider3":{ + "ColorSlider3":{ "styles":["thinslider"], "progressVisual":{ "url":"{STYLE_DIR}/images/slider-skin-progress-blue.9.png" diff --git a/shared/view.h b/shared/view.h index cc7ca8f..29e1012 100644 --- a/shared/view.h +++ b/shared/view.h @@ -94,7 +94,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, { Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New(); label.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); - label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" ); + label.SetStyleName( "ToolbarLabel" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::TEXT, title ); label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -168,7 +168,7 @@ Dali::Layer CreateView( Dali::Application& application, Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string& text ) { Dali::Toolkit::TextLabel label = Dali::Toolkit::TextLabel::New( text ); - label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "toolbarlabel" ); + label.SetStyleName( "ToolbarLabel" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT );