diff --git a/builder/dali-builder.cpp b/builder/dali-builder.cpp index 1ce2ec4..d423d85 100644 --- a/builder/dali-builder.cpp +++ b/builder/dali-builder.cpp @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 78c2aae..cc0f9ef 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -31,7 +31,7 @@ int main(int argc, char **argv) textdomain(DALI_DEMO_DOMAIN_LOCAL); setlocale(LC_ALL, DALI_LANG); - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); // Create the demo launcher DaliTableView demo(app); diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 8175c94..7188db9 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include // INTERNAL INCLUDES #include "shared/view.h" @@ -65,6 +68,8 @@ const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap 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 int NUM_BACKGROUND_IMAGES = 18; const float BACKGROUND_SWIPE_SCALE = 0.025f; const float BACKGROUND_SPREAD_SCALE = 1.5f; @@ -80,19 +85,6 @@ const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); const float BUBBLE_MIN_Z = -1.0; const float BUBBLE_MAX_Z = 0.0f; -// 3D Effect constants -const Vector2 ANGLE_SWING_3DEFFECT( Math::PI_2 * 0.75, Math::PI_2 * 0.75f ); ///< Angle Swing in radians -const Vector2 POSITION_SWING_3DEFFECT( 0.55f, 0.4f ); ///< Position Swing relative to stage size. -const Vector3 ANCHOR_3DEFFECT_STYLE0( -105.0f, 30.0f, -240.0f ); ///< Rotation Anchor position for 3D Effect (Style 0) -const Vector3 ANCHOR_3DEFFECT_STYLE1( 65.0f, -70.0f, -500.0f ); ///< Rotation Anchor position for 3D Effect (Style 1) - -Vector3 ScalePointSize(const Vector3& vec) -{ - return Vector3( DemoHelper::ScalePointSize( vec.x ), DemoHelper::ScalePointSize( vec.y ), DemoHelper::ScalePointSize( vec.z ) ); -} - -#define DP(x) DemoHelper::ScalePointSize(x) - /** * Creates the background image */ @@ -140,7 +132,7 @@ public: // Bubbles X position moves parallax to horizontal // panning by a scale factor unique to each bubble. - position.x = mInitialX + ( inputs[0]->GetVector3().x * mScale ); + position.x = mInitialX + ( inputs[0]->GetVector2().x * mScale ); } private: @@ -212,8 +204,6 @@ void DaliTableView::SortAlphabetically( bool sortAlphabetically ) void DaliTableView::Initialize( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent ); const Vector2 stageSize = Stage::GetCurrent().GetSize(); @@ -318,7 +308,7 @@ void DaliTableView::Initialize( Application& application ) Populate(); // Remove constraints for inner cube effect - ApplyCubeEffectToActors(); + ApplyCubeEffectToPages(); Dali::Window winHandle = application.GetWindow(); winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT ); @@ -327,12 +317,10 @@ void DaliTableView::Initialize( Application& application ) winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); // Set initial orientation - Dali::Orientation orientation = winHandle.GetOrientation(); - - unsigned int degrees = winHandle.GetOrientation().GetDegrees(); + unsigned int degrees = 0; Rotate( degrees ); - orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged ); + //orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged ); winHandle.ShowIndicator( Dali::Window::INVISIBLE ); @@ -346,21 +334,14 @@ void DaliTableView::Initialize( Application& application ) KeyboardFocusManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated ); } -void DaliTableView::ApplyCubeEffectToActors() +void DaliTableView::ApplyCubeEffectToPages() { - for( ActorIter pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter ) + ScrollViewPagePathEffect effect = ScrollViewPagePathEffect::DownCast( mScrollViewEffect ); + unsigned int pageCount(0); + for( std::vector< Actor >::iterator pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter ) { Actor page = *pageIter; - - for( unsigned int i = 0, numChildren = page.GetChildCount(); i < numChildren; ++i) - { - // Remove old effect's manual constraints. - Actor child = page.GetChildAt(i); - if( child ) - { - ApplyCubeEffectToActor( child ); - } - } + effect.ApplyToPage( page, pageCount++ ); } } @@ -446,9 +427,9 @@ void DaliTableView::Populate() } // Update Ruler info. - mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x ); + mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f ); mScrollRulerY = new DefaultRuler(); - mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * TABLE_RELATIVE_SIZE.x, true ) ); + mScrollRulerX->SetDomain( RulerDomain( 0.0f, (mTotalPages+1) * stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f, true ) ); mScrollRulerY->Disable(); mScrollView.SetRulerX( mScrollRulerX ); mScrollView.SetRulerY( mScrollRulerY ); @@ -637,14 +618,14 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source ) } } -void DaliTableView::OnScrollStart( const Dali::Vector3& position ) +void DaliTableView::OnScrollStart( const Dali::Vector2& position ) { mScrolling = true; PlayAnimation(); } -void DaliTableView::OnScrollComplete( const Dali::Vector3& position ) +void DaliTableView::OnScrollComplete( const Dali::Vector2& position ) { mScrolling = false; @@ -681,21 +662,29 @@ void DaliTableView::ApplyScrollViewEffect() void DaliTableView::SetupInnerPageCubeEffect() { - mScrollViewEffect = ScrollViewCubeEffect::New(); - mScrollView.SetScrollSnapDuration( EFFECT_SNAP_DURATION ); - mScrollView.SetScrollFlickDuration( EFFECT_FLICK_DURATION ); - mScrollView.RemoveConstraintsFromChildren(); -} - -void DaliTableView::ApplyCubeEffectToActor( Actor actor ) -{ - actor.RemoveConstraints(); + const Vector2 stageSize = Stage::GetCurrent().GetSize(); - ScrollViewCubeEffect cubeEffect = ScrollViewCubeEffect::DownCast(mScrollViewEffect); - cubeEffect.ApplyToActor( actor, - ScalePointSize( ( rand() & 1 ) ? ANCHOR_3DEFFECT_STYLE0 : ANCHOR_3DEFFECT_STYLE1 ), - ANGLE_SWING_3DEFFECT, - POSITION_SWING_3DEFFECT * Vector2(Stage::GetCurrent().GetSize())); + Dali::Path path = Dali::Path::New(); + Dali::Property::Array points; + points.Resize(3); + points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f); + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f); + path.SetProperty( Path::Property::POINTS, points ); + + Dali::Property::Array controlPoints; + controlPoints.Resize(4); + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f ); + controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f ); + controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f ); + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f ); + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); + + + mScrollViewEffect = ScrollViewPagePathEffect::New(path, + Vector3(-1.0f,0.0f,0.0f), + Toolkit::ScrollView::Property::SCROLL_FINAL_X, + Vector3(stageSize.x*TABLE_RELATIVE_SIZE.x,stageSize.y*TABLE_RELATIVE_SIZE.y,0.0f),mTotalPages); } void DaliTableView::OnKeyEvent( const KeyEvent& event ) diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index 05640ef..55b5d41 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -22,6 +22,7 @@ #include #include +#include class Example; @@ -217,14 +218,14 @@ private: // Application callbacks & implementation * * @param[in] position The current position of the scroll contents. */ - void OnScrollStart(const Dali::Vector3& position); + void OnScrollStart(const Dali::Vector2& position); /** * Signal emitted when scrolling has completed. * * @param[in] position The current position of the scroll contents. */ - void OnScrollComplete(const Dali::Vector3& position); + void OnScrollComplete(const Dali::Vector2& position); /** * Signal emitted when any Sensitive Actor has been touched @@ -245,7 +246,7 @@ private: // Application callbacks & implementation /** * Apply the cube effect to all the page actors */ - void ApplyCubeEffectToActors(); + void ApplyCubeEffectToPages(); /** * Setup the inner cube effect @@ -253,11 +254,6 @@ private: // Application callbacks & implementation void SetupInnerPageCubeEffect(); /** - * Apply the cube effect to an actor - */ - void ApplyCubeEffectToActor( Dali::Actor actor ); - - /** * Apply a shader effect to a table tile */ void ApplyEffectToTile(Dali::Actor tile); @@ -410,9 +406,9 @@ private: Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information Dali::Vector3 mButtonsPageRelativeSize; ///< Size of a buttons page relative to the stage size - Dali::ActorContainer mPages; ///< List of pages. - Dali::ActorContainer mTableViewImages; ///< Offscreen render of tableview - Dali::ActorContainer mBackgroundActors; ///< List of background actors used in the effect + std::vector< Dali::Actor > mPages; ///< List of pages. + std::vector< Dali::Actor > mTableViewImages; ///< Offscreen render of tableview + std::vector< Dali::Actor > mBackgroundActors; ///< List of background actors used in the effect AnimationList mBackgroundAnimations; ///< List of background bubble animations ExampleList mExampleList; ///< List of examples. ExampleMap mExampleMap; ///< Map LUT for examples. diff --git a/examples/animated-shapes/animated-shapes-example.cpp b/examples/animated-shapes/animated-shapes-example.cpp index 0c59827..b9c3755 100644 --- a/examples/animated-shapes/animated-shapes-example.cpp +++ b/examples/animated-shapes/animated-shapes-example.cpp @@ -17,6 +17,9 @@ #include #include +#include +#include +#include #include "shared/view.h" @@ -49,8 +52,6 @@ public: // The Init signal is received once (only) during the Application lifetime void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - // Get a handle to the stage Stage stage = Stage::GetCurrent(); @@ -373,7 +374,7 @@ void RunTest( Application& application ) int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); return 0; diff --git a/examples/atlas/atlas-example.cpp b/examples/atlas/atlas-example.cpp index 6d45fd8..5cce8fb 100644 --- a/examples/atlas/atlas-example.cpp +++ b/examples/atlas/atlas-example.cpp @@ -16,6 +16,8 @@ */ #include +#include + #include "shared/view.h" #include #include @@ -224,7 +226,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - gApplication = Application::New( &argc, &argv ); + gApplication = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( gApplication ); diff --git a/examples/blocks/blocks-example.cpp b/examples/blocks/blocks-example.cpp index 23775b2..20a3e93 100644 --- a/examples/blocks/blocks-example.cpp +++ b/examples/blocks/blocks-example.cpp @@ -226,8 +226,6 @@ public: */ void Create(Application& application) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); // Creates a default view with a default tool bar. @@ -841,7 +839,7 @@ void RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/bubble-effect/bubble-effect-example.cpp b/examples/bubble-effect/bubble-effect-example.cpp index 4575ee2..5e4e304 100644 --- a/examples/bubble-effect/bubble-effect-example.cpp +++ b/examples/bubble-effect/bubble-effect-example.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "shared/view.h" using namespace Dali; @@ -91,8 +92,6 @@ private: // The Init signal is received once (only) during the Application lifetime void Create(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); Vector2 stageSize = stage.GetSize(); @@ -101,9 +100,8 @@ private: // Creates a default view with a default tool bar. // The view is added to the stage. Toolkit::ToolBar toolBar; - Toolkit::Control view; Layer content = DemoHelper::CreateView( app, - view, + mBackground, toolBar, "", TOOLBAR_IMAGE, @@ -141,15 +139,14 @@ private: content.Add( bubbleRoot ); // Add the background image actor to stage - view.SetBackgroundImage( mBackgroundImage ); - mBackgroundActor = ImageActor::DownCast( view.GetBackgroundActor() ); + mBackground.SetBackgroundImage( mBackgroundImage ); // Set up the timer to emit bubble regularly when the finger is touched down but not moved mTimerForBubbleEmission = Timer::New( mTimerInterval ); mTimerForBubbleEmission.TickSignal().Connect(this, &BubbleEffectExample::OnTimerTick); // Connect the callback to the touch signal on the background - mBackgroundActor.TouchedSignal().Connect( this, &BubbleEffectExample::OnTouch ); + mBackground.TouchedSignal().Connect( this, &BubbleEffectExample::OnTouch ); } @@ -256,7 +253,7 @@ private: mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta ); - mBackgroundActor.SetImage( mBackgroundImage ); + mBackground.SetBackgroundImage( mBackgroundImage ); } else if( button == mChangeBubbleShapeButton ) { @@ -283,7 +280,7 @@ private: Application& mApp; Image mBackgroundImage; - ImageActor mBackgroundActor; + Dali::Toolkit::Control mBackground; Toolkit::BubbleEmitter mBubbleEmitter; Vector3 mHSVDelta; @@ -319,7 +316,7 @@ RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index 65964dc..79f50a1 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -20,11 +20,12 @@ // //------------------------------------------------------------------------------ -#include "dali.h" +#include #include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -36,6 +37,7 @@ #include "sys/stat.h" #include +#include #include #include "shared/view.h" @@ -141,11 +143,6 @@ const std::string ShortName( const std::string& name ) } } -static Vector3 SetItemSize(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing) -{ - return Vector3(layoutWidth, 50, 1); -} - //------------------------------------------------------------------------------ // // @@ -291,17 +288,12 @@ public: stage.Add( mItemView ); mItemView.SetParentOrigin(ParentOrigin::CENTER); mItemView.SetAnchorPoint(AnchorPoint::CENTER); - mGridLayout = GridLayout::New(); - mGridLayout->SetNumberOfColumns(1); + mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST ); - mGridLayout->SetItemSizeFunction(SetItemSize); + mLayout->SetItemSize( Vector3( stage.GetSize().width, 50, 1 ) ); - mGridLayout->SetTopMargin(DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight); + mItemView.AddLayout( *mLayout ); - mItemView.AddLayout(*mGridLayout); - - Vector3 size(stage.GetSize()); - mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); mItemView.SetKeyboardFocusable( true ); mFiles.clear(); @@ -369,9 +361,9 @@ public: SetTitle("Select"); - // Itemview renderes the previous items unless its scrolled. Not sure why at the moment so we force a scroll - mItemView.ScrollToItem(0, 0); - + // Activate the layout + Vector3 size(stage.GetSize()); + mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); } void ExitSelection() @@ -501,8 +493,6 @@ public: void Create(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent); @@ -585,7 +575,7 @@ public: private: Application& mApp; - GridLayoutPtr mGridLayout; + ItemLayoutPtr mLayout; ItemView mItemView; Toolkit::Control mView; @@ -626,7 +616,7 @@ int main(int argc, char **argv) } } - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); ExampleApp dali_app(app); diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index 739d357..1dea9c4 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -96,8 +96,6 @@ class ButtonsController: public ConnectionTracker { // The Init signal is received once (only) during the Application lifetime - DemoHelper::RequestThemeChange(); - // Respond to key events Stage::GetCurrent().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent); @@ -527,7 +525,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/cluster/cluster-example.cpp b/examples/cluster/cluster-example.cpp index 7dd8673..f9df49d 100644 --- a/examples/cluster/cluster-example.cpp +++ b/examples/cluster/cluster-example.cpp @@ -21,6 +21,9 @@ #include "shared/view.h" #include #include +#include +#include +#include #include "cluster.h" #include "cluster-style.h" @@ -38,7 +41,7 @@ const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); const char * const APPLICATION_TITLE( "Clusters" ); const char * const LAYOUT_NONE_IMAGE( DALI_IMAGE_DIR "icon-cluster-none.png" ); -const char * const LAYOUT_WOBBLE_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" ); +const char * const LAYOUT_MOTION_BLUR_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" ); const char * const LAYOUT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-cluster-carousel.png" ); const char * const LAYOUT_SPHERE_IMAGE( DALI_IMAGE_DIR "icon-cluster-sphere.png" ); @@ -134,9 +137,6 @@ const float CLUSTER_GROUP_DELAY_BOTTOM = 0.0f; ///< Delay for botto const float CLUSTER_COLUMN_INDENT = 0.1f; ///< Left Indentation in screen coordinates. const float CLUSTER_ROW_INDENT = 0.13f; ///< Top Indentation in screen coordinates. -const Vector3 SHEAR_EFFECT_ANCHOR_POINT(0.5f, 1.0f, 0.5f); ///< Anchor Point used for the shear effect (extends outside of Cluster) -const float SHEAR_EFFECT_MAX_OVERSHOOT = 30.0f; ///< Max Overshoot for shear effect (in degrees). - const float UI_MARGIN = 10.0f; ///< Screen Margin for placement of UI buttons const float CAROUSEL_EFFECT_RADIUS = 500.0f; ///< In Carousel Effect mode: Radius of carousel (Z peak depth) @@ -152,7 +152,7 @@ const float SPHERE_EFFECT_VERTICAL_DOMAIN = 0.15f; ///< In Sphere Effec enum ExampleEffectType { NO_EFFECT, - WOBBLE_EFFECT, + MOTION_BLUR_EFFECT, CAROUSEL_EFFECT, SPHERE_EFFECT, TOTAL_EFFECTS @@ -161,10 +161,10 @@ enum ExampleEffectType /** * List of effect type names that appear on the Effect button. */ -const char* EXAMPLE_EFFECT_LABEL[] = { "NONE", - "WOBBLE", - "CAROUSEL", - "SPHERE", +const char* EXAMPLE_EFFECT_LABEL[] = { "None", + "Motion Blur", + "Carousel", + "Sphere", }; /** @@ -205,96 +205,6 @@ struct CarouselEffectOrientationConstraint }; /** - * ShearEffectConstraint - * - * Constrains ShearEffect's tilt to be a function of scrollview's - * horizontal overshoot amount. - */ -struct ShearEffectConstraint -{ - /** - * @param[in] stageSize The stage size (not subject to orientation) - * @param[in] maxOvershoot Maximum amount overshoot can affect shear. - * @param[in] componentMask Whether constraint should take the X shear - * or the Y shear component. - */ - ShearEffectConstraint(Vector2 stageSize, float maxOvershoot, Vector2 componentMask) - : mStageSize(stageSize), - mMaxOvershoot(maxOvershoot), - mComponentMask(componentMask) - { - } - - /** - * @param[in,out] current The current shear effect Angle. - * @param[in] inputs Contains the overshoot property from ScrollView and the orientation of the view e.g. Portrait, Landscape. - * @return angle to provide ShearShaderEffect - */ - void operator()( float& current, const PropertyInputContainer& inputs ) - { - float f = inputs[0]->GetVector3().x; - - float mag = fabsf(f); - float halfWidth = mStageSize.x * 0.5f; - - // inverse exponential tail-off - float overshoot = 1.0f - halfWidth / (halfWidth + mag); - if (f > 0.0f) - { - overshoot = -overshoot; - } - - // Channel this shear value into either the X or Y axis depending on - // the component mask passed in. - Vector3 axis; - Radian angle; - inputs[1]->GetQuaternion().ToAxisAngle( axis, angle ); - Vector2 direction( cosf(angle), sinf(angle) ); - float yield = direction.x * mComponentMask.x + direction.y * mComponentMask.y; - - current = overshoot * mMaxOvershoot * yield; - } - - Vector2 mStageSize; - float mMaxOvershoot; - Vector2 mComponentMask; -}; - -/** - * ShearEffectCenterConstraint - * - * Sets ShearEffect's center to be a function of the - * screen orientation (portrait or landscape). - */ -struct ShearEffectCenterConstraint -{ - /** - * @param[in] stageSize The stage size (not subject to orientation) - * @param[in] center Shear Center position based on initial orientation. - */ - ShearEffectCenterConstraint(Vector2 stageSize, Vector2 center) - : mStageSize(stageSize), - mCenter(center) - { - } - - /** - * @param[in,out] current The current center - * @param[in] inputs Contains the current view size - * @return vector to provide ShearShaderEffect - */ - void operator()( Vector2& current, const PropertyInputContainer& inputs ) - { - float f = inputs[0]->GetVector3().width / mStageSize.width; - current.x = f * mCenter.x; - current.y = mCenter.y; - } - - Vector2 mStageSize; - Vector2 mCenter; -}; - -/** * SphereEffectOffsetConstraint * * Sets SphereEffect's center to be a function of the @@ -450,8 +360,6 @@ public: */ void Create(Application& application) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &ClusterController::OnKeyEvent); // The Init signal is received once (only) during the Application lifetime @@ -470,7 +378,7 @@ public: // Create a effect toggle button. (right of toolbar) mLayoutButtonImages[ NO_EFFECT ] = ResourceImage::New( LAYOUT_NONE_IMAGE ); - mLayoutButtonImages[ WOBBLE_EFFECT ] = ResourceImage::New( LAYOUT_WOBBLE_IMAGE ); + mLayoutButtonImages[ MOTION_BLUR_EFFECT ] = ResourceImage::New( LAYOUT_MOTION_BLUR_IMAGE ); mLayoutButtonImages[ CAROUSEL_EFFECT ] = ResourceImage::New( LAYOUT_CAROUSEL_IMAGE ); mLayoutButtonImages[ SPHERE_EFFECT ] = ResourceImage::New( LAYOUT_SPHERE_IMAGE ); @@ -482,10 +390,6 @@ public: mScrollView = ScrollView::New(); mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - // attach Wobble Effect to ScrollView - mScrollViewEffect = ScrollViewWobbleEffect::New(); - mScrollView.ApplyEffect(mScrollViewEffect); - // anchor the scroll view from its center point to the middle of its parent mScrollView.SetAnchorPoint(AnchorPoint::CENTER); mScrollView.SetParentOrigin(ParentOrigin::CENTER); @@ -506,7 +410,7 @@ public: AddCluster( MUSIC, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle2) ); AddCluster( MAGAZINE, ClusterStyleStandard::New(ClusterStyleStandard::ClusterStyle3) ); - SetEffect(WOBBLE_EFFECT); + SetEffect(MOTION_BLUR_EFFECT); } /** @@ -627,7 +531,7 @@ public: pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. + // Create cluster actors and add them to scroll view Vector3 clusterSize; Cluster cluster = CreateClusterActor( clusterType, style, clusterSize ); cluster.SetParentOrigin(ParentOrigin::TOP_LEFT); @@ -642,6 +546,39 @@ public: } /** + * Sets motion blur effect to a cluster and all its children + * + * @param[in] actor Cluster control to which the effect will be applied + */ + void SetMotionBlurEffect( Actor actor ) + { + // only do something if the actor and effect are valid + if( actor ) + { + // first remove from this actor + RenderableActor renderable = RenderableActor::DownCast( actor ); + if( renderable ) + { + MotionBlurEffect shaderEffect = MotionBlurEffect::New(); + shaderEffect.SetSpeedScalingFactor(0.1f); + + Dali::Property::Index uModelProperty = shaderEffect.GetPropertyIndex( "uModelLastFrame" ); + Constraint constraint = Constraint::New( shaderEffect, uModelProperty, EqualToConstraint() ); + constraint.AddSource( Source( actor , Actor::Property::WORLD_MATRIX ) ); + constraint.Apply(); + renderable.SetShaderEffect( shaderEffect ); + } + // then all children recursively + const unsigned int count = actor.GetChildCount(); + for( unsigned int index = 0; index < count; ++index ) + { + Actor child( actor.GetChildAt( index ) ); + SetMotionBlurEffect( child ); + } + } + } + + /** * Resets ScrollView and Clusters settings * to reflect the new ExampleEffectType * @@ -691,8 +628,8 @@ public: // Apply new shader-effects. // Move Y to origin incase we came from an effect where user could free pan in y axis. - const Vector3 currentScrollPosition(mScrollView.GetCurrentScrollPosition()); - mScrollView.ScrollTo(Vector3(currentScrollPosition.x, 0.0f, 0.0f)); + const Vector2 currentScrollPosition(mScrollView.GetCurrentScrollPosition()); + mScrollView.ScrollTo(Vector2(currentScrollPosition.x, 0.0f)); switch(type) { @@ -701,42 +638,11 @@ public: break; } - case WOBBLE_EFFECT: + case MOTION_BLUR_EFFECT: { for( std::vector::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) { - Cluster cluster = i->mCluster; - Vector3 position = i->mPosition; - Vector3 size = i->mSize; - - ShearEffect shaderEffect = ShearEffect::New(); - Vector3 shearAnchor = SHEAR_EFFECT_ANCHOR_POINT; - - Vector2 shearCenter( Vector2(position.x + size.width * shearAnchor.x, position.y + size.height * shearAnchor.y) ); - Property::Index centerProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetCenterPropertyName()); - Constraint constraint = Constraint::New( shaderEffect, centerProperty, ShearEffectCenterConstraint(stageSize, shearCenter) ); - constraint.AddSource( Source(mView, Actor::Property::SIZE) ); - - constraint.Apply(); - - SetShaderEffectRecursively( cluster,shaderEffect ); - - // Apply Constraint to Shader Effect - Property::Index scrollOvershootProperty = /*targetGroup*/mScrollView.GetPropertyIndex(ScrollViewWobbleEffect::EFFECT_OVERSHOOT); - Property::Index angleXAxisProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetAngleXAxisPropertyName()); - Property::Index angleYAxisProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetAngleYAxisPropertyName()); - - constraint = Constraint::New( shaderEffect, angleXAxisProperty, ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) ); - constraint.AddSource( Source(mScrollView, scrollOvershootProperty) ); - constraint.AddSource( Source(mView, Actor::Property::ORIENTATION) ); - constraint.Apply(); - - constraint = Constraint::New( shaderEffect, angleYAxisProperty, ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS ) ); - constraint.AddSource( Source(mScrollView, scrollOvershootProperty) ); - constraint.AddSource( Source(mView, Actor::Property::ORIENTATION) ); - constraint.Apply(); - - + SetMotionBlurEffect( i->mCluster ); } break; } @@ -852,7 +758,6 @@ private: Layer mContentLayer; ///< Content layer (scrolling cluster content) ScrollView mScrollView; ///< The ScrollView container for all clusters - ScrollViewWobbleEffect mScrollViewEffect; ///< ScrollView Wobble effect Image mClusterBorderImage; ///< The border frame that appears on each image std::vector mClusterInfo; ///< Keeps track of each cluster's information. @@ -874,7 +779,7 @@ void RunTest(Application& app) // int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/cluster/cluster-impl.cpp b/examples/cluster/cluster-impl.cpp index 00b91f9..0edda67 100644 --- a/examples/cluster/cluster-impl.cpp +++ b/examples/cluster/cluster-impl.cpp @@ -23,7 +23,7 @@ #include // for strcmp #include #include -#include +#include #include // INTERNAL INCLUDES @@ -92,7 +92,7 @@ void Cluster::OnInitialize() { } -void Cluster::OnControlSizeSet( const Vector3& targetSize ) +void Cluster::OnSizeSet( const Vector3& targetSize ) { mClusterSize = targetSize; GetImpl(mClusterStyle).SetClusterSize(targetSize); diff --git a/examples/cluster/cluster-impl.h b/examples/cluster/cluster-impl.h index f57c221..7c8a408 100644 --- a/examples/cluster/cluster-impl.h +++ b/examples/cluster/cluster-impl.h @@ -253,15 +253,15 @@ public: private: // From Control /** - * @copydoc Demo::Control::OnInitialize() + * @copydoc Control::OnInitialize() */ virtual void OnInitialize(); /** * - * @copydoc Demo::Control::OnControlSizeSet( const Vector3& targetSize ) + * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize ) */ - virtual void OnControlSizeSet( const Vector3& targetSize ); + virtual void OnSizeSet( const Vector3& targetSize ); protected: diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp index 5961390..73da808 100644 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -23,6 +23,11 @@ #include #include +#include +#include +#include +#include + using namespace Dali; @@ -219,8 +224,6 @@ CubeTransitionApp::~CubeTransitionApp() void CubeTransitionApp::OnInit( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent); // Creates a default view with a default tool bar, the view is added to the stage. @@ -430,7 +433,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) // Entry point for Linux & Tizen applications int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); CubeTransitionApp test( application ); application.MainLoop(); diff --git a/examples/dissolve-effect/dissolve-effect-example.cpp b/examples/dissolve-effect/dissolve-effect-example.cpp index ebbe4c9..bb39943 100644 --- a/examples/dissolve-effect/dissolve-effect-example.cpp +++ b/examples/dissolve-effect/dissolve-effect-example.cpp @@ -23,6 +23,7 @@ #include #include +#include using namespace Dali; @@ -203,8 +204,6 @@ DissolveEffectApp::~DissolveEffectApp() void DissolveEffectApp::OnInit( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &DissolveEffectApp::OnKeyEvent); // Creates a default view with a default tool bar, the view is added to the stage. @@ -429,7 +428,7 @@ bool DissolveEffectApp::OnTimerTick() // Entry point for Linux & Tizen applications int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); DissolveEffectApp test( application ); application.MainLoop(); 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 882687a..a49d306 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 @@ -17,6 +17,7 @@ #include #include +#include #include "shared/view.h" #include @@ -169,9 +170,6 @@ public: // The Init signal is received once (only) during the Application lifetime void Create( Application& application ) { - // Apply the default theme: - DemoHelper::RequestThemeChange(); - // Get a handle to the stage Stage stage = Stage::GetCurrent(); @@ -730,7 +728,7 @@ void RunTest( Application& application ) // Entry point for Linux & Tizen applications int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/image-scaling-irregular-grid/grid-flags.h b/examples/image-scaling-irregular-grid/grid-flags.h index 68453b2..01bb44f 100644 --- a/examples/image-scaling-irregular-grid/grid-flags.h +++ b/examples/image-scaling-irregular-grid/grid-flags.h @@ -17,6 +17,7 @@ * */ #include +#include #include /** Controls the output of application logging. */ diff --git a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp index d921645..6d77a2e 100644 --- a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp +++ b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp @@ -287,8 +287,6 @@ public: { std::cout << "ImageScalingIrregularGridController::Create" << std::endl; - DemoHelper::RequestThemeChange(); - // Get a handle to the stage: Stage stage = Stage::GetCurrent(); @@ -335,13 +333,11 @@ public: mScrollView.ScrollStartedSignal().Connect( this, &ImageScalingIrregularGridController::OnScrollStarted ); mScrollView.ScrollCompletedSignal().Connect( this, &ImageScalingIrregularGridController::OnScrollCompleted ); - mScrollView.EnableScrollComponent( Scrollable::VerticalScrollBar ); - mScrollView.EnableScrollComponent( Scrollable::HorizontalScrollBar ); - mScrollView.SetAnchorPoint(AnchorPoint::CENTER); mScrollView.SetParentOrigin(ParentOrigin::CENTER); - mScrollView.SetSize( stageSize );//Vector2( stageSize.width, fieldHeight ) );//stageSize ); + mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + mScrollView.SetAxisAutoLock( true ); mScrollView.SetAxisAutoLockGradient( 1.0f ); @@ -351,7 +347,7 @@ public: rulerX->SetDomain( RulerDomain( stageSize.width * -0.125f, stageSize.width * 1.125f ) ); //< Scroll slightly left/right of image field. mScrollView.SetRulerX ( rulerX ); - RulerPtr rulerY = new DefaultRuler(); //stageSize.height ); //< Snap in multiples of a screen / stage height + RulerPtr rulerY = new DefaultRuler(); //< Snap in multiples of a screen / stage height rulerY->SetDomain( RulerDomain( - fieldHeight * 0.5f + stageSize.height * 0.5f - GRID_CELL_PADDING, fieldHeight * 0.5f + stageSize.height * 0.5f + GRID_CELL_PADDING ) ); mScrollView.SetRulerY ( rulerY ); @@ -359,8 +355,31 @@ public: mScrollView.Add( imageField ); mGridActor = imageField; + // Create the scroll bar + mScrollBarVertical = ScrollBar::New(Toolkit::ScrollBar::Vertical); + mScrollBarVertical.SetParentOrigin(ParentOrigin::TOP_RIGHT); + mScrollBarVertical.SetAnchorPoint(AnchorPoint::TOP_RIGHT); + mScrollBarVertical.SetResizePolicy(Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT); + mScrollBarVertical.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::WIDTH); + mScrollView.Add(mScrollBarVertical); + + mScrollBarHorizontal = ScrollBar::New(Toolkit::ScrollBar::Horizontal); + mScrollBarHorizontal.SetParentOrigin(ParentOrigin::BOTTOM_LEFT); + mScrollBarHorizontal.SetAnchorPoint(AnchorPoint::TOP_LEFT); + mScrollBarHorizontal.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::WIDTH); + mScrollBarHorizontal.SetOrientation(Quaternion(Radian( 1.5f * Math::PI ), Vector3::ZAXIS)); + mScrollView.Add(mScrollBarHorizontal); + + mScrollView.OnRelayoutSignal().Connect( this, &ImageScalingIrregularGridController::OnScrollViewRelayout ); + // Scroll to top of grid so first images loaded are on-screen: - mScrollView.ScrollTo( Vector3( 0, -1000000, 0 ) ); + mScrollView.ScrollTo( Vector2( 0, -1000000 ) ); + } + + void OnScrollViewRelayout(Actor actor) + { + // Make the height of the horizontal scroll bar to be the same as the width of scroll view. + mScrollBarHorizontal.SetSize(Vector2(0.0f, mScrollView.GetRelayoutSize( Dimension::WIDTH) )); } /** @@ -549,7 +568,7 @@ public: * note this state (mScrolling = true) * @param[in] position Current Scroll Position */ - void OnScrollStarted( const Vector3& position ) + void OnScrollStarted( const Vector2& position ) { mScrolling = true; } @@ -559,7 +578,7 @@ public: * note this state (mScrolling = false). * @param[in] position Current Scroll Position */ - void OnScrollCompleted( const Vector3& position ) + void OnScrollCompleted( const Vector2& position ) { mScrolling = false; } @@ -573,6 +592,8 @@ private: TextLabel mTitleActor; ///< The Toolbar's Title. Actor mGridActor; ///< The container for the grid of images ScrollView mScrollView; ///< ScrollView UI Component + ScrollBar mScrollBarVertical; + ScrollBar mScrollBarHorizontal; bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) std::map mFittingModes; ///< Stores the current scaling mode of each image, keyed by image actor id. std::map mSizes; ///< Stores the current size of each image, keyed by image actor id. @@ -588,7 +609,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index 6a0a6e2..c3b858d 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -25,6 +25,7 @@ #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -103,16 +104,6 @@ const unsigned int IMAGE_WIDTH = 256; const unsigned int IMAGE_HEIGHT = 256; const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8; -AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunction(AlphaFunction::LINEAR), - AlphaFunction(AlphaFunction::EASE_IN), - AlphaFunction(AlphaFunction::EASE_OUT) }; - -const unsigned int NUM_ALPHA_FUNCTIONS = sizeof(ALPHA_FUNCTIONS) / sizeof(AlphaFunction); - -const char* ALPHA_FUNCTIONS_TEXT[] = { "Linear", - "EaseIn", - "EaseOut" }; - const char* BACKGROUND_IMAGE( "" ); const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); const char* EDIT_IMAGE( DALI_IMAGE_DIR "icon-edit.png" ); @@ -138,20 +129,10 @@ const float ITEM_IMAGE_BORDER_RIGHT = 13.0f; const float ITEM_IMAGE_BORDER_TOP = 13.0f; const float ITEM_IMAGE_BORDER_BOTTOM = 13.0f; -const unsigned int DEPTH_LAYOUT_ROWS_PORTRAIT = 26; -const unsigned int DEPTH_LAYOUT_ROWS_LANDSCAPE = 16; -const float DEPTH_LAYOUT_TILT_ANGLE_PORTRAIT = 25.0f; -const float DEPTH_LAYOUT_TILT_ANGLE_LANDSCAPE = 21.0f; -const float DEPTH_LAYOUT_ROW_SPACING_FACTOR = 0.1f; const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT = 1.0f; const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE = 0.8f; -const float DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_PORTRAIT = 0.2f; -const float DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_LANDSCAPE = 0.1f; +const float DEPTH_LAYOUT_COLUMNS = 3.0f; -const float SPIRAL_LAYOUT_REVOLUTION_NUMBER_PORTRAIT = 4.5f; -const float SPIRAL_LAYOUT_REVOLUTION_NUMBER_LANDSCAPE = 2.5f; - -const float DEPTH_LAYOUT_HEIGHT_SCALE = 20.0f; const float MIN_SWIPE_DISTANCE = 15.0f; const float MIN_SWIPE_SPEED = 5.0f; @@ -162,33 +143,23 @@ const float LABEL_TEXT_SIZE_Y = 20.0f; const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f ); -static Vector3 DepthLayoutItemSizeFunctionPortrait(unsigned int numberOfColumns, float layoutWidth) +static Vector3 DepthLayoutItemSizeFunctionPortrait( float layoutWidth ) { - float width = (layoutWidth / static_cast(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT; + float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT; // 1x1 aspect ratio return Vector3(width, width, width); } -static Vector3 DepthLayoutItemSizeFunctionLandscape(unsigned int numberOfColumns, float layoutWidth) +static Vector3 DepthLayoutItemSizeFunctionLandscape( float layoutWidth ) { - float width = (layoutWidth / static_cast(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE; + float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE; // 1x1 aspect ratio return Vector3(width, width, width); } -static float DepthLayoutBottomMarginFunctionPortrait(float layoutHeight) -{ - return layoutHeight * DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_PORTRAIT; -} - -static float DepthLayoutBottomMarginFunctionLandscape(float layoutHeight) -{ - return layoutHeight * DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_LANDSCAPE; -} - -} +} // unnamed namespace /** * This example shows how to use ItemView UI control. @@ -219,11 +190,9 @@ public: ItemViewExample( Application& application ) : mApplication( application ), mMode( MODE_NORMAL ), - mMenuShown( false ), mOrientation( 0 ), mCurrentLayout( SPIRAL_LAYOUT ), - mDurationSeconds( 1.0f ), - mAlphaFuncIndex( 0u ) + mDurationSeconds( 0.25f ) { // Connect to the Application's Init signal mApplication.InitSignal().Connect(this, &ItemViewExample::OnInit); @@ -234,8 +203,6 @@ public: */ void OnInit(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Dali::Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent); @@ -253,7 +220,7 @@ public: TOOLBAR_IMAGE, "" ); - app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &ItemViewExample::OnOrientationChanged ); + //app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &ItemViewExample::OnOrientationChanged ); // Create an edit mode button. (left of toolbar) Toolkit::PushButton editButton = Toolkit::PushButton::New(); @@ -321,9 +288,9 @@ public: stage.Add( mItemView ); // Create the layouts - mSpiralLayout = SpiralLayout::New(); - mDepthLayout = DepthLayout::New(); - mGridLayout = GridLayout::New(); + mSpiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL ); + mDepthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH ); + mGridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID ); // Add the layouts to item view mItemView.AddLayout(*mSpiralLayout); @@ -334,7 +301,7 @@ public: mItemView.SetMinimumSwipeSpeed(MIN_SWIPE_SPEED); // Activate the spiral layout - UseLayout(mCurrentLayout, 0.0f); + SetLayout( mCurrentLayout ); mItemView.SetKeyboardFocusable( true ); KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &ItemViewExample::OnKeyboardPreFocusChange ); @@ -357,49 +324,45 @@ public: } /** + * Animate to a different layout + */ + void ChangeLayout() + { + Animation animation = Animation::New( mDurationSeconds ); + animation.FinishedSignal().Connect( this, &ItemViewExample::AnimationFinished ); + animation.AnimateTo( Property( mItemView, Actor::Property::COLOR_ALPHA ), 0.0f ); + animation.Play(); + } + + void AnimationFinished( Animation& ) + { + SetLayout( mCurrentLayout ); + + Animation animation = Animation::New( mDurationSeconds ); + animation.AnimateTo( Property( mItemView, Actor::Property::COLOR_ALPHA ), 1.0f ); + animation.Play(); + } + + /** * Switch to a different item view layout */ - void UseLayout(int layoutId, float duration) + void SetLayout( int layoutId ) { // Set the new orientation to the layout mItemView.GetLayout(layoutId)->SetOrientation(static_cast(mOrientation / 90)); Vector2 stageSize = Stage::GetCurrent().GetSize(); - if(layoutId == SPIRAL_LAYOUT) - { - mSpiralLayout->SetRevolutionDistance(stageSize.height / Stage::GetCurrent().GetDpi().y * 45.0f); - } - - if(layoutId == GRID_LAYOUT) - { - // Set up the grid layout according to the new orientation - float layoutWidth = Toolkit::IsHorizontal(mGridLayout->GetOrientation()) ? stageSize.height : stageSize.width; - float gridItemSize = (layoutWidth / mGridLayout->GetNumberOfColumns()) * 0.5f; - mGridLayout->SetScrollSpeedFactor(mGridLayout->GetNumberOfColumns() / gridItemSize); - - float toolbarHeight = mToolBar.GetCurrentSize().y; - mGridLayout->SetTopMargin(toolbarHeight + mGridLayout->GetRowSpacing()); - } - if(layoutId == DEPTH_LAYOUT) { // Set up the depth layout according to the new orientation if(Toolkit::IsVertical(mDepthLayout->GetOrientation())) { - mDepthLayout->SetRowSpacing(stageSize.height * DEPTH_LAYOUT_ROW_SPACING_FACTOR); - mDepthLayout->SetNumberOfRows(DEPTH_LAYOUT_ROWS_PORTRAIT); - mDepthLayout->SetTiltAngle( Degree( DEPTH_LAYOUT_TILT_ANGLE_PORTRAIT - mDepthLayout->GetNumberOfColumns() ) ); - mDepthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunctionPortrait); - mDepthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunctionPortrait); + mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionPortrait( stageSize.width ) ); } else { - mDepthLayout->SetRowSpacing(stageSize.width * DEPTH_LAYOUT_ROW_SPACING_FACTOR); - mDepthLayout->SetNumberOfRows(DEPTH_LAYOUT_ROWS_LANDSCAPE); - mDepthLayout->SetTiltAngle( Degree( DEPTH_LAYOUT_TILT_ANGLE_LANDSCAPE - mDepthLayout->GetNumberOfColumns() ) ); - mDepthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunctionLandscape); - mDepthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunctionLandscape); + mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionLandscape( stageSize.height ) ); } } @@ -407,7 +370,7 @@ public: mItemView.SetAnchoring(layoutId == DEPTH_LAYOUT); // Activate the layout - mItemView.ActivateLayout(layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), duration); + mItemView.ActivateLayout( layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f ); } /** @@ -424,7 +387,7 @@ public: // Remember orientation mOrientation = angle; - UseLayout(mCurrentLayout, mDurationSeconds); + SetLayout( mCurrentLayout ); } } @@ -433,7 +396,7 @@ public: // Switch to the next layout mCurrentLayout = (mCurrentLayout + 1) % mItemView.GetLayoutCount(); - UseLayout(mCurrentLayout, mDurationSeconds); + ChangeLayout(); SetLayoutTitle(); SetLayoutImage(); @@ -973,100 +936,6 @@ private: mTitleActor.SetProperty( TextLabel::Property::TEXT, title ); } - void ShowMenu() - { - Stage stage = Stage::GetCurrent(); - const float popupWidth = stage.GetSize().x * 0.75f; - - mMenu = Toolkit::Popup::New(); - mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); - mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); - mMenu.SetSize( popupWidth, MENU_OPTION_HEIGHT * 2 ); - mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu ); - - TableView tableView = TableView::New( 0, 0 ); - tableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - mMenu.Add( tableView ); - - Slider slider = Slider::New(); - slider.SetProperty( Slider::Property::LOWER_BOUND, 0.0f ); - slider.SetProperty( Slider::Property::UPPER_BOUND, 3.0f ); - slider.SetProperty( Slider::Property::VALUE, mDurationSeconds ); - slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 ); - slider.SetProperty( Slider::Property::SHOW_POPUP, true ); - slider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange ); - tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) ); - - TextLabel text = TextLabel::New( "Duration" ); - text.SetAnchorPoint( ParentOrigin::TOP_LEFT ); - text.SetParentOrigin( ParentOrigin::TOP_LEFT ); - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); - text.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); - text.SetSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) ); - slider.Add( text ); - - Actor textContainer = Actor::New(); - textContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); - mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); - mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER ); - textContainer.Add( mAlphaFunctionText ); - tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) ); - - mTapDetector = TapGestureDetector::New(); - mTapDetector.Attach(mAlphaFunctionText); - mTapDetector.DetectedSignal().Connect( this, &ItemViewExample::ChangeAlphaFunctionOnTap ); - - text = TextLabel::New( "Alpha Function" ); - text.SetAnchorPoint( ParentOrigin::TOP_LEFT ); - text.SetParentOrigin( ParentOrigin::TOP_LEFT ); - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); - text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); - textContainer.Add( text ); - - mMenu.Show(); - mMenuShown = true; - } - - bool SliderValueChange( Toolkit::Slider slider, float value ) - { - mDurationSeconds = value; - - return true; - } - - void ChangeAlphaFunctionOnTap( Actor actor, const TapGesture& tap ) - { - if( NUM_ALPHA_FUNCTIONS <= ++mAlphaFuncIndex ) - { - mAlphaFuncIndex = 0; - } - - if( mAlphaFunctionText ) - { - mAlphaFunctionText.SetProperty( TextLabel::Property::TEXT, std::string(ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex]) ); - } - - if( mItemView ) - { - mItemView.GetActiveLayout()->SetAlphaFunction( ALPHA_FUNCTIONS[mAlphaFuncIndex] ); - } - } - - void HideMenu() - { - mTapDetector.Reset(); - - if( mMenu ) - { - mMenu.Hide(); - mMenu.Reset(); - } - - mMenuShown = false; - } - /** * Main key event handler */ @@ -1074,27 +943,9 @@ private: { if(event.state == KeyEvent::Down) { - if( IsKey( event, DALI_KEY_MENU ) ) + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) { - if( mMenuShown ) - { - HideMenu(); - } - else - { - ShowMenu(); - } - } - else if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) - { - if( mMenuShown ) - { - HideMenu(); - } - else - { - mApplication.Quit(); - } + mApplication.Quit(); } } } @@ -1103,7 +954,6 @@ private: Application& mApplication; Mode mMode; - bool mMenuShown; Toolkit::Control mView; unsigned int mOrientation; @@ -1117,11 +967,9 @@ private: unsigned int mCurrentLayout; float mDurationSeconds; - SpiralLayoutPtr mSpiralLayout; - DepthLayoutPtr mDepthLayout; - GridLayoutPtr mGridLayout; - - Toolkit::Popup mMenu; + ItemLayoutPtr mSpiralLayout; + ItemLayoutPtr mDepthLayout; + ItemLayoutPtr mGridLayout; TapGestureDetector mTapDetector; Toolkit::PushButton mLayoutButton; @@ -1129,8 +977,6 @@ private: Toolkit::PushButton mInsertButton; Toolkit::PushButton mReplaceButton; - unsigned int mAlphaFuncIndex; - TextLabel mAlphaFunctionText; BufferImage mWhiteImage; }; @@ -1143,7 +989,7 @@ void RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index a37fcb4..5169629 100644 --- a/examples/logging/logging-example.cpp +++ b/examples/logging/logging-example.cpp @@ -18,7 +18,7 @@ #include "shared/view.h" #include #include - +#include #include using namespace Dali; @@ -144,8 +144,6 @@ class LoggingController: public ConnectionTracker { // The Init signal is received once (only) during the Application lifetime - DemoHelper::RequestThemeChange(); - mCurrentLogger = 0; mPerformanceLoggers.reserve( NUM_LOGGERS ); mPerformanceLoggers.resize( NUM_LOGGERS ); @@ -755,7 +753,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/magnifier/magnifier-example.cpp b/examples/magnifier/magnifier-example.cpp index 08c107e..10f104a 100644 --- a/examples/magnifier/magnifier-example.cpp +++ b/examples/magnifier/magnifier-example.cpp @@ -21,7 +21,7 @@ #include "shared/view.h" #include - +#include using namespace Dali; namespace @@ -193,8 +193,6 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); mStageSize = Stage::GetCurrent().GetSize(); @@ -415,7 +413,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/motion-blur/motion-blur-example.cpp b/examples/motion-blur/motion-blur-example.cpp index ccc056c..d783a3b 100644 --- a/examples/motion-blur/motion-blur-example.cpp +++ b/examples/motion-blur/motion-blur-example.cpp @@ -21,6 +21,8 @@ #include "shared/view.h" #include #include +#include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -189,8 +191,8 @@ public: winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); // set initial orientation - winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionBlurExampleApp::OnOrientationChanged ); - unsigned int degrees = winHandle.GetOrientation().GetDegrees(); + // winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionBlurExampleApp::OnOrientationChanged ); + unsigned int degrees = 0; Rotate( static_cast< DeviceOrientation >( degrees ) ); @@ -559,7 +561,7 @@ void RunTest(Application& app) // int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/motion-stretch/motion-stretch-example.cpp b/examples/motion-stretch/motion-stretch-example.cpp index b9c4a75..ebfa809 100644 --- a/examples/motion-stretch/motion-stretch-example.cpp +++ b/examples/motion-stretch/motion-stretch-example.cpp @@ -21,6 +21,7 @@ #include "shared/view.h" #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -124,8 +125,6 @@ public: { // The Init signal is received once (only) during the Application lifetime - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &MotionStretchExampleApp::OnKeyEvent); // Creates a default view with a default tool bar. @@ -166,8 +165,8 @@ public: winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); - winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionStretchExampleApp::OnOrientationChanged ); - unsigned int degrees = winHandle.GetOrientation().GetDegrees(); + // winHandle.GetOrientation().ChangedSignal().Connect( this, &MotionStretchExampleApp::OnOrientationChanged ); + unsigned int degrees = 0; Rotate( static_cast< DeviceOrientation >( degrees ) ); @@ -441,7 +440,7 @@ void RunTest(Application& app) // int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/new-window/new-window-example.cpp b/examples/new-window/new-window-example.cpp index 3533cd2..9282c8c 100644 --- a/examples/new-window/new-window-example.cpp +++ b/examples/new-window/new-window-example.cpp @@ -15,6 +15,13 @@ */ #include +#include +#include +#include +#include +#include + + #include "shared/view.h" #include #include @@ -116,8 +123,6 @@ NewWindowController::NewWindowController( Application& application ) void NewWindowController::Create( Application& app ) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); stage.SetBackgroundColor(Color::YELLOW); @@ -457,7 +462,7 @@ void RunTest(Application& app) int main(int argc, char **argv) { - gApplication = Application::New(&argc, &argv); + gApplication = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(gApplication); return 0; diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index 3596034..39e329e 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -17,6 +17,12 @@ #include #include +#include +#include +#include +#include +#include + #include #include #include @@ -221,8 +227,6 @@ void PageTurnController::OnInit( Application& app ) { // The Init signal is received once ( only ) during the Application lifetime - DemoHelper::RequestThemeChange(); - Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnController::OnKeyEvent); Stage stage = Stage::GetCurrent(); @@ -242,7 +246,7 @@ void PageTurnController::OnInit( Application& app ) winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); // view will response to orientation change to display portrait or landscape views - app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); + //app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize ); mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) ); @@ -342,7 +346,7 @@ void PageTurnController::OnPageFinishedPan( PageTurnView pageTurnView ) // Entry point for applications int main( int argc, char **argv ) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); PageTurnController test ( app ); app.MainLoop(); diff --git a/examples/path-animation/path-animation.cpp b/examples/path-animation/path-animation.cpp index 06b3cf0..f1b1dd3 100644 --- a/examples/path-animation/path-animation.cpp +++ b/examples/path-animation/path-animation.cpp @@ -21,6 +21,12 @@ // EXTERNAL INCLUDES #include +#include +#include +#include +#include + + // INTERNAL INCLUDES #include "shared/view.h" @@ -62,7 +68,7 @@ public: * @param[in] size The size of the slider * @param[in] callback Pointer to the callback function to be called when user moves the slider */ - Actor CreateVectorComponentControl( const std::string& label, const Vector3& size, bool(PathController::*callback)(Slider,float) ) + Actor CreateVectorComponentControl( const std::string& label, const Vector3& size, bool(PathController::*callback)(Dali::Toolkit::Slider,float) ) { TextLabel text = TextLabel::New(label); text.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); @@ -79,7 +85,7 @@ public: float mark = -1.0f; for(unsigned short i(0); i<21; ++i ) { - marks.push_back( mark ); + marks.PushBack( mark ); mark += 0.1f; } @@ -435,8 +441,6 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - // Get a handle to the stage: Stage stage = Stage::GetCurrent(); @@ -506,7 +510,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/radial-menu/radial-menu-example.cpp b/examples/radial-menu/radial-menu-example.cpp index c98a6ef..6f21081 100644 --- a/examples/radial-menu/radial-menu-example.cpp +++ b/examples/radial-menu/radial-menu-example.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "shared/view.h" #include "radial-sweep-view.h" #include "radial-sweep-view-impl.h" @@ -121,8 +122,6 @@ RadialMenuExample::~RadialMenuExample() void RadialMenuExample::OnInit(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Dali::Stage::GetCurrent(); // The Init signal is received once (only) during the Application lifetime @@ -290,7 +289,7 @@ void RunTest(Application app) // Entry point for Linux & Tizen applications int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/radial-menu/radial-sweep-view-impl.h b/examples/radial-menu/radial-sweep-view-impl.h index f659dc3..81a9883 100644 --- a/examples/radial-menu/radial-sweep-view-impl.h +++ b/examples/radial-menu/radial-sweep-view-impl.h @@ -19,6 +19,10 @@ */ #include +#include +#include +#include + #include "radial-sweep-view.h" diff --git a/examples/radial-menu/radial-sweep-view.cpp b/examples/radial-menu/radial-sweep-view.cpp index 66f4102..6792711 100644 --- a/examples/radial-menu/radial-sweep-view.cpp +++ b/examples/radial-menu/radial-sweep-view.cpp @@ -18,6 +18,10 @@ #include "radial-sweep-view.h" #include "radial-sweep-view-impl.h" +// EXTERNAL INCLUDES +#include + + using namespace Dali; RadialSweepView::RadialSweepView() diff --git a/examples/refraction-effect/refraction-effect-example.cpp b/examples/refraction-effect/refraction-effect-example.cpp index 61bae03..a220490 100644 --- a/examples/refraction-effect/refraction-effect-example.cpp +++ b/examples/refraction-effect/refraction-effect-example.cpp @@ -17,10 +17,15 @@ #include #include +#include +#include +#include + #include "shared/view.h" #include #include +#include using namespace Dali; @@ -315,8 +320,6 @@ private: // The Init signal is received once (only) during the Application lifetime void Create(Application& application) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); mStageHalfSize = stage.GetSize() * 0.5f; @@ -653,7 +656,7 @@ RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/scripting/launcher.cpp b/examples/scripting/launcher.cpp index 9c48b3f..5c81a9b 100644 --- a/examples/scripting/launcher.cpp +++ b/examples/scripting/launcher.cpp @@ -48,7 +48,6 @@ Launcher::Launcher( Dali::Application application, std::string layoutFileName, s mJSONFileName(layoutFileName ), mJavaScriptFileName( scriptFileName ) { - mApplication.InitSignal().Connect( this, &Launcher::Create ); } @@ -58,8 +57,6 @@ Launcher::~Launcher() void Launcher::Create( Dali::Application& application ) { - DemoHelper::RequestThemeChange(); - TextLabel textActor = TextLabel::New( "JSON & JavaScript Launcher..." ); // Reposition the actor diff --git a/examples/scripting/launcher.h b/examples/scripting/launcher.h index dc56b42..0b5f97f 100644 --- a/examples/scripting/launcher.h +++ b/examples/scripting/launcher.h @@ -21,6 +21,8 @@ // EXTERNAL INCLUDES #include #include +#include +#include /** * Example app that can load both JSON and JavaScript files from command line diff --git a/examples/scripting/scripting-example.cpp b/examples/scripting/scripting-example.cpp index 6a9c4b9..a09a3d8 100644 --- a/examples/scripting/scripting-example.cpp +++ b/examples/scripting/scripting-example.cpp @@ -88,7 +88,7 @@ int main( int argc, char* argv[] ) } - Launcher daliApplication( Dali::Application::New( &argc, &argv ), jSONFileName, javaScriptFileName ); + Launcher daliApplication( Dali::Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ), jSONFileName, javaScriptFileName ); daliApplication.MainLoop(); diff --git a/examples/scroll-view/scroll-view-example.cpp b/examples/scroll-view/scroll-view-example.cpp index da7a64b..0485cad 100644 --- a/examples/scroll-view/scroll-view-example.cpp +++ b/examples/scroll-view/scroll-view-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,18 +31,15 @@ namespace const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" ); const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); const char * const APPLICATION_TITLE( "ScrollView" ); -const char * const EFFECT_DEPTH_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-depth.png" ); -const char * const EFFECT_INNER_CUBE_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-inner-cube.png" ); const char * const EFFECT_CAROUSEL_IMAGE( DALI_IMAGE_DIR "icon-scroll-view-carousel.png" ); const Vector3 ICON_SIZE(100.0f, 100.0f, 0.0f); const char* EFFECT_MODE_NAME[] = { - "Depth", - "Cube", "PageCarousel", "PageCube", - "PageSpiral" + "PageSpiral", + "PageWave" }; const char * const IMAGE_PATHS[] = { @@ -119,25 +116,6 @@ const int PAGE_COLUMNS = 10; ///< const int PAGE_ROWS = 1; ///< Number of Pages going down (rows) const int IMAGE_ROWS = 5; ///< Number of Images going down (rows) with a Page -// 3D Effect constants -const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.2f, Math::PI * 0.2f, 0.0f); ///< Cube page rotates as if it has ten sides with the camera positioned inside -const Vector2 ANGLE_CUSTOM_CUBE_SWING(-Math::PI * 0.45f, -Math::PI * 0.45f); ///< outer cube pages swing 90 degrees as they pan offscreen -const Vector2 ANGLE_SPIRAL_SWING_IN(Math::PI * 0.45f, Math::PI * 0.45f); -const Vector2 ANGLE_SPIRAL_SWING_OUT(Math::PI * 0.3f, Math::PI * 0.3f); - -// Depth Effect constants -const Vector2 POSITION_EXTENT_DEPTH_EFFECT(0.5f, 2.5f); ///< Extent of X & Y position to alter function exponent. -const Vector2 OFFSET_EXTENT_DEPTH_EFFECT(1.0f, 1.0f); ///< Function exponent offset constant. -const float POSITION_SCALE_DEPTH_EFFECT(1.5f); ///< Position scaling. -const float SCALE_EXTENT_DEPTH_EFFECT(0.5f); ///< Maximum scale factor when Actors scrolled one page away (50% size) - -// 3D Effect constants -const Vector2 ANGLE_SWING_3DEFFECT(Math::PI_2 * 0.75, Math::PI_2 * 0.75f); ///< Angle Swing in radians -const Vector2 POSITION_SWING_3DEFFECT(0.25f, 0.25f); ///< Position Swing relative to stage size. -const Vector3 ANCHOR_3DEFFECT_STYLE0(-105.0f, 30.0f, -240.0f); ///< Rotation Anchor position for 3D Effect (Style 0) -const Vector3 ANCHOR_3DEFFECT_STYLE1(65.0f, -70.0f, -300.0f); ///< Rotation Anchor position for 3D Effect (Style 1) - - const unsigned int IMAGE_THUMBNAIL_WIDTH = 256; ///< Width of Thumbnail Image in texels const unsigned int IMAGE_THUMBNAIL_HEIGHT = 256; ///< Height of Thumbnail Image in texels @@ -163,7 +141,7 @@ public: : mApplication( application ), mView(), mScrolling(false), - mEffectMode(CubeEffect) + mEffectMode(PageCarouselEffect) { // Connect to the Application's Init and orientation changed signal mApplication.InitSignal().Connect(this, &ExampleController::OnInit); @@ -179,8 +157,6 @@ public: */ void OnInit(Application& app) { - DemoHelper::RequestThemeChange(); - Stage stage = Dali::Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); @@ -196,11 +172,10 @@ public: TOOLBAR_IMAGE, "" ); - mEffectIcon[ DepthEffect ] = ResourceImage::New( EFFECT_DEPTH_IMAGE ); - mEffectIcon[ CubeEffect ] = ResourceImage::New( EFFECT_INNER_CUBE_IMAGE ); mEffectIcon[ PageCarouselEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); mEffectIcon[ PageCubeEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); mEffectIcon[ PageSpiralEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); + mEffectIcon[ PageWaveEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); // Create a effect change button. (right of toolbar) mEffectChangeButton = Toolkit::PushButton::New(); @@ -274,23 +249,11 @@ private: // apply new Effect to ScrollView ApplyEffectToScrollView(); - - for(ActorIter pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter) + unsigned int pageCount(0); + for( std::vector< Actor >::iterator pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter) { Actor page = *pageIter; - ApplyEffectToPage( page ); - - unsigned int numChildren = (*pageIter).GetChildCount(); - for(unsigned int i=0; iSetDomain(RulerDomain(0.0f, stageSize.x * PAGE_COLUMNS, !wrap)); + rulerY->Disable(); + + Dali::Path path = Dali::Path::New(); + Dali::Property::Array points; + points.Resize(3); + Dali::Property::Array controlPoints; + controlPoints.Resize(4); + Vector3 forward; + if( mEffectMode == PageCarouselEffect) { - case DepthEffect: - { - mScrollViewEffect = ScrollViewDepthEffect::New(); - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); - mScrollView.RemoveConstraintsFromChildren(); - break; - } - case CubeEffect: - { - mScrollViewEffect = ScrollViewCubeEffect::New(); - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT_BACK); - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT_BACK); - mScrollView.RemoveConstraintsFromChildren(); - break; - } + points[0] = Vector3( stageSize.x*0.75, 0.0f, -stageSize.x*0.75f); + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); + points[2] = Vector3( -stageSize.x*0.75f, 0.0f, -stageSize.x*0.75f); + path.SetProperty( Path::Property::POINTS, points ); - case PageCarouselEffect: - { - mScrollViewEffect = ScrollViewPageCarouselEffect::New(); - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); - mScrollView.RemoveConstraintsFromChildren(); - break; - } + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); + controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f ); + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f ); + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); - case PageCubeEffect: - { - mScrollViewEffect = ScrollViewPageCubeEffect::New(); - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); - mScrollView.RemoveConstraintsFromChildren(); - break; - } + forward = Vector3::ZERO; + } + else if( mEffectMode == PageCubeEffect) + { + points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f); + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f); + path.SetProperty( Path::Property::POINTS, points ); + + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f ); + controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f ); + controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f ); + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f ); + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); + + forward = Vector3(-1.0f,0.0f,0.0f); + } + else if( mEffectMode == PageSpiralEffect) + { + points[0] = Vector3( stageSize.x*0.5, 0.0f, -stageSize.x*0.5f); + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); + points[2] = Vector3( -stageSize.x*0.5f, 0.0f, -stageSize.x*0.5f); + path.SetProperty( Path::Property::POINTS, points ); + + controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); + controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f ); + controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f ); + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); + + forward = Vector3(-1.0f,0.0f,0.0f); + } + else if( mEffectMode == PageWaveEffect) + { + points[0] = Vector3( stageSize.x, 0.0f, -stageSize.x); + points[1] = Vector3( 0.0f, 0.0f, 0.0f ); + points[2] = Vector3( -stageSize.x, 0.0f, -stageSize.x); + path.SetProperty( Path::Property::POINTS, points ); + + controlPoints[0] = Vector3( 0.0f, 0.0f, -stageSize.x ); + controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f ); + controlPoints[2] = Vector3( -stageSize.x*0.5f, 0.0f, 0.0f); + controlPoints[3] = Vector3(0.0f, 0.0f,-stageSize.x ); + path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints ); + + forward = Vector3(-1.0f,0.0f,0.0f); + } - case PageSpiralEffect: - { - mScrollViewEffect = ScrollViewPageSpiralEffect::New(); - mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); - mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); - mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); - mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); - mScrollView.RemoveConstraintsFromChildren(); - break; - } + mScrollViewEffect = ScrollViewPagePathEffect::New(path, forward,Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(stageSize.x,stageSize.y,0.0f),PAGE_COLUMNS); + mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION); + mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION); + mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT); + mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT); + mScrollView.RemoveConstraintsFromChildren(); - default: - { - break; - } + rulerX = CreateRuler(snap ? stageSize.width * 0.5f : 0.0f); + if( wrap ) + { + rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * 0.5f * PAGE_COLUMNS, !wrap)); + } + else + { + rulerX->SetDomain(RulerDomain(0.0f, stageSize.x*0.5f* (PAGE_COLUMNS+1), !wrap)); } + unsigned int currentPage = mScrollView.GetCurrentPage(); if( mScrollViewEffect ) { mScrollView.ApplyEffect(mScrollViewEffect); } mScrollView.SetWrapMode(wrap); - - RulerPtr rulerX = CreateRuler(snap ? stageSize.width : 0.0f); - RulerPtr rulerY = new DefaultRuler; - rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * PAGE_COLUMNS, !wrap)); - rulerY->Disable(); - mScrollView.SetRulerX( rulerX ); mScrollView.SetRulerY( rulerY ); + + mScrollView.ScrollTo( currentPage, 0.0f ); } /** @@ -449,110 +436,16 @@ private: * * @param[in] page The page Actor to apply effect to. */ - void ApplyEffectToPage(Actor page) + void ApplyEffectToPage(Actor page, unsigned int pageOrder ) { page.RemoveConstraints(); page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - switch( mEffectMode ) - { - case PageCarouselEffect: - { - ScrollViewPageCarouselEffect effect = ScrollViewPageCarouselEffect::DownCast( mScrollViewEffect ); - effect.ApplyToPage( page ); - break; - } - - case PageCubeEffect: - { - ScrollViewPageCubeEffect effect = ScrollViewPageCubeEffect::DownCast( mScrollViewEffect ); - effect.ApplyToPage( page, ANGLE_SWING_3DEFFECT ); - break; - } - - case PageSpiralEffect: - { - ScrollViewPageSpiralEffect effect = ScrollViewPageSpiralEffect::DownCast( mScrollViewEffect ); - effect.ApplyToPage( page, ANGLE_SWING_3DEFFECT ); - break; - } - - default: - { - break; - } - } + ScrollViewPagePathEffect effect = ScrollViewPagePathEffect::DownCast( mScrollViewEffect ); + effect.ApplyToPage( page, pageOrder ); } /** - * [Actor] - * Applies effect to child which resides in page (which in turn resides in scrollview) - * - * @note Page is typically the Parent of child, although in - * some scenarios Page is simply a container which has a child as - * a descendent. - * - * @param[in] child The child actor to apply effect to - * @param[in] page The page which this child is inside - */ - void ApplyEffectToActor( Actor child, Actor page ) - { - switch( mEffectMode ) - { - case DepthEffect: - { - ApplyDepthEffectToActor( child ); - break; - } - - case CubeEffect: - { - ApplyCubeEffectToActor( child ); - break; - } - - default: - { - break; - } - } - } - - /** - * Applies depth effect to the child which resides in page (which in turn resides in scrollview) - * - * @param[in] child The child actor to apply depth effect to - */ - void ApplyDepthEffectToActor( Actor child ) - { - ScrollViewDepthEffect depthEffect = ScrollViewDepthEffect::DownCast(mScrollViewEffect); - depthEffect.ApplyToActor( child, - POSITION_EXTENT_DEPTH_EFFECT, - OFFSET_EXTENT_DEPTH_EFFECT, - POSITION_SCALE_DEPTH_EFFECT, - SCALE_EXTENT_DEPTH_EFFECT ); - } - - void ApplyCubeEffectToActor( Actor child ) - { - Vector3 anchor; - if(rand()&1) - { - anchor = ANCHOR_3DEFFECT_STYLE0; - } - else - { - anchor = ANCHOR_3DEFFECT_STYLE1; - } - - ScrollViewCubeEffect cubeEffect = ScrollViewCubeEffect::DownCast(mScrollViewEffect); - cubeEffect.ApplyToActor( child, - anchor, - ANGLE_SWING_3DEFFECT, - POSITION_SWING_3DEFFECT * Vector2(Stage::GetCurrent().GetSize())); - } - - /** * Creates an Image (Helper) * * @param[in] filename the path of the image. @@ -577,7 +470,7 @@ private: * note this state (mScrolling = true) * @param[in] position Current Scroll Position */ - void OnScrollStarted( const Vector3& position ) + void OnScrollStarted( const Vector2& position ) { mScrolling = true; } @@ -587,7 +480,7 @@ private: * note this state (mScrolling = false) * @param[in] position Current Scroll Position */ - void OnScrollCompleted( const Vector3& position ) + void OnScrollCompleted( const Vector2& position ) { mScrolling = false; } @@ -666,18 +559,17 @@ private: ScrollView mScrollView; ///< ScrollView UI Component bool mScrolling; ///< ScrollView scrolling state (true = scrolling, false = stationary) ScrollViewEffect mScrollViewEffect; ///< ScrollView Effect instance. - ActorContainer mPages; ///< Keeps track of all the pages for applying effects. + std::vector< Actor > mPages; ///< Keeps track of all the pages for applying effects. /** * Enumeration of different effects this scrollview can operate under. */ enum EffectMode { - DepthEffect, ///< Depth Effect - CubeEffect, ///< Cube effect PageCarouselEffect, ///< Page carousel effect PageCubeEffect, ///< Page cube effect PageSpiralEffect, ///< Page spiral effect + PageWaveEffect, ///< Page wave effect Total }; @@ -690,7 +582,7 @@ private: int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); ExampleController test(app); app.MainLoop(); return 0; diff --git a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp b/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp index 7e3a22a..49e6142 100644 --- a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp +++ b/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp @@ -20,6 +20,8 @@ #include #include +#include + #include using namespace Dali; @@ -120,8 +122,6 @@ public: */ void Create(Application& app) { - DemoHelper::RequestThemeChange(); - srand(0); // Want repeatable path Stage::GetCurrent().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent); @@ -501,7 +501,7 @@ RunTest(Application& app) int main(int argc, char **argv) { - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); RunTest(app); diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index 60ee45d..d2a92b9 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -18,6 +18,7 @@ #include "shared/view.h" #include #include +#include using namespace Dali; @@ -157,8 +158,6 @@ public: { // The Init signal is received once (only) during the Application lifetime - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); // Respond to key events @@ -193,17 +192,13 @@ public: mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); // Use a grid layout for tests - Toolkit::GridLayoutPtr gridLayout = Toolkit::GridLayout::New(); - gridLayout->SetNumberOfColumns( 2 ); - gridLayout->SetTopMargin( DP(TOOLBAR_HEIGHT) + DP(20.0f) ); - gridLayout->SetBottomMargin( DP(100.0f) ); - gridLayout->SetRowSpacing( DP(20.0f) ); - mItemView.AddLayout( *gridLayout ); - Vector2 stageSize = stage.GetSize(); - float layoutWidth = Toolkit::IsHorizontal( gridLayout->GetOrientation() ) ? stageSize.height : stageSize.width; - float gridItemSize = ( layoutWidth / gridLayout->GetNumberOfColumns() ) * 0.5f; - gridLayout->SetScrollSpeedFactor( gridLayout->GetNumberOfColumns() / gridItemSize * 0.5f ); + Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST ); + Vector3 itemSize; + gridLayout->GetItemSize( 0, Vector3( stageSize ), itemSize ); + itemSize.height = stageSize.y / 10; + gridLayout->SetItemSize( itemSize ); + mItemView.AddLayout( *gridLayout ); mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f ); @@ -1302,7 +1297,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-field/text-field-example.cpp b/examples/text-field/text-field-example.cpp index 89c8b58..59725d3 100644 --- a/examples/text-field/text-field-example.cpp +++ b/examples/text-field/text-field-example.cpp @@ -22,7 +22,7 @@ // EXTERNAL INCLUDES #include -#include +#include // INTERNAL INCLUDES #include "shared/multi-language-strings.h" @@ -96,8 +96,6 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); mTapGestureDetector = TapGestureDetector::New(); @@ -239,7 +237,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-label-emojis/text-label-emojis.cpp b/examples/text-label-emojis/text-label-emojis.cpp index 751cb26..7ec8f1e 100644 --- a/examples/text-label-emojis/text-label-emojis.cpp +++ b/examples/text-label-emojis/text-label-emojis.cpp @@ -17,7 +17,6 @@ // EXTERNAL INCLUDES #include -#include #include // INTERNAL INCLUDES @@ -143,7 +142,7 @@ void RunTest( Application& application ) // int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-label-multi-language/text-label-multi-language-example.cpp b/examples/text-label-multi-language/text-label-multi-language-example.cpp index 3706b81..61af222 100644 --- a/examples/text-label-multi-language/text-label-multi-language-example.cpp +++ b/examples/text-label-multi-language/text-label-multi-language-example.cpp @@ -22,7 +22,6 @@ // EXTERNAL INCLUDES #include -#include // INTERNAL INCLUDES #include "shared/multi-language-strings.h" @@ -57,8 +56,6 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent); @@ -147,7 +144,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-label/text-label-example.cpp b/examples/text-label/text-label-example.cpp index a24e3aa..1219290 100644 --- a/examples/text-label/text-label-example.cpp +++ b/examples/text-label/text-label-example.cpp @@ -22,7 +22,7 @@ // EXTERNAL INCLUDES #include -#include +#include // INTERNAL INCLUDES #include "shared/multi-language-strings.h" @@ -97,8 +97,6 @@ public: */ void Create( Application& application ) { - DemoHelper::RequestThemeChange(); - Stage stage = Stage::GetCurrent(); stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent); @@ -285,7 +283,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/examples/text-message-field/text-message-field-example.cpp b/examples/text-message-field/text-message-field-example.cpp index 37eb6a1..d801c3b 100644 --- a/examples/text-message-field/text-message-field-example.cpp +++ b/examples/text-message-field/text-message-field-example.cpp @@ -22,7 +22,6 @@ // EXTERNAL INCLUDES #include -#include using namespace Dali; using namespace Dali::Toolkit; @@ -159,7 +158,7 @@ void RunTest( Application& application ) /** Entry point for Linux & Tizen applications */ int main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv ); + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); RunTest( application ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 49866ef..d170265 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.0.41 +Version: 1.0.42 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/scripts/navigation.json b/resources/scripts/navigation.json deleted file mode 100644 index d09feac..0000000 --- a/resources/scripts/navigation.json +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014 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. - * - */ -{ - "stage": [{ - "type": "NavigationControl", - "name": "navigation", - "parent-origin": "CENTER", - "signals": [{ - "name": "on-stage", - "actor": "navigation", - "action": "push", - "parameters": ["page1"] - }], - "actors": [{ - "type": "Page", - "name": "page1", - "title": "title", - "sub-title": "sub title", - "actors": [{ - "type": "TextLabel", // styles can be additive - "parent-origin": [0.5, 0.5, 0], - "anchor-point": [0.5, 0.5, 0], - "size": [200, 200, 1], - "text": "Touch to push new item!", - "signals": [{ - "name": "touched", - "actor": "navigation", - "action": "push", - "parameters": ["page2"] - }] - }] - }, { - "type": "Page", - "name": "page2", - "actors": [{ - "type": "TextLabel", // styles can be additive - "parent-origin": [0.5, 0.5, 0.5], - "anchor-point": [0.5, 0.5, 0.5], - "size": [200, 200, 1], - "text": "Hello World!" - }, { - "type": "TextLabel", // styles can be additive - "parent-origin": [0.0, 0.0, 0.5], - "anchor-point": [0.0, 0.0, 0.5], - "size": [200, 200, 1], - "text": "Back", - "signals": [{ - "name": "touched", - "actor": "navigation", - "action": "pop" - }] - }, { - "type": "TextLabel", // styles can be additive - "parent-origin": [1.0, 1.0, 0.5], - "anchor-point": [1.0, 1.0, 0.5], - "size": [200, 200, 1], - "text": "Quit", - "signals": [{ - "name": "touched", - "action": "quit" - }] - }] - }] - }] -} diff --git a/shared/view.h b/shared/view.h index 44b6663..dcf8e9a 100644 --- a/shared/view.h +++ b/shared/view.h @@ -19,6 +19,9 @@ */ #include +#include +#include + namespace DemoHelper { @@ -50,13 +53,6 @@ const float DEFAULT_TEXT_STYLE_POINT_SIZE( 8.0f ); const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f); const Dali::Toolkit::Alignment::Padding DEFAULT_MODE_SWITCH_PADDING(8.0f, 8.0f, 8.0f, 8.0f); -void RequestThemeChange() -{ - // Provide the stylesheet - Dali::Toolkit::StyleManager styleManager = Dali::Toolkit::StyleManager::Get(); - styleManager.RequestThemeChange( DALI_DEMO_THEME_PATH ); -} - float ScalePointSize(int pointSize) { Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi(); @@ -83,16 +79,12 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, // Tool bar Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); - Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image ); - toolBarBackground.SetName( "TOOLBAR_BACKGROUND" ); - toolBarBackground.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); toolBar = Dali::Toolkit::ToolBar::New(); toolBar.SetName( "TOOLBAR" ); - toolBar.SetBackground( toolBarBackground ); + toolBar.SetBackgroundImage( image ); toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); toolBar.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); - toolBarBackground.SetSortModifier(1.0f); // Add the tool bar to the too bar layer. toolBarLayer.Add( toolBar );