Commit f391811faf0b99b43abb358791b85a658dfc7b30

Authored by Richard Huang
2 parents 40844807 2f41a309

[dali_1.2.10] Merge branch 'devel/master'

Change-Id: Ifa98519084d36ef1121682fcdc9ca29d9c8ce8ea
examples/builder/examples.cpp
... ... @@ -26,6 +26,8 @@
26 26 #include <dali-toolkit/devel-api/builder/tree-node.h>
27 27 #include <dali-toolkit/devel-api/builder/json-parser.h>
28 28 #include <dali-toolkit/devel-api/controls/popup/popup.h>
  29 +#include <dali-toolkit/devel-api/controls/navigation-view/navigation-view.h>
  30 +
29 31 #include <map>
30 32 #include <string>
31 33 #include <fstream>
... ... @@ -136,6 +138,7 @@ const std::string ShortName( const std::string&amp; name )
136 138  
137 139 if( pos != std::string::npos )
138 140 {
  141 + pos++;
139 142 return name.substr( pos );
140 143 }
141 144 else
... ... @@ -249,44 +252,23 @@ public:
249 252 mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
250 253 }
251 254  
252   - bool OnToolSelectLayout( Toolkit::Button button )
  255 + bool OnBackButtonPressed( Toolkit::Button button )
253 256 {
254   - bool on = mItemView.IsVisible();
255   -
256   - if( on )
257   - {
258   - LeaveSelection();
259   - }
260   - else
261   - {
262   - EnterSelection();
263   - }
264   -
  257 + OnQuitOrBack();
265 258 return true;
266 259 }
267 260  
268   - void LeaveSelection()
269   - {
270   -
271   - }
272   -
273   - void EnterSelection()
  261 + void SetUpItemView()
274 262 {
275 263 Stage stage = Stage::GetCurrent();
276   - stage.SetBackgroundColor( Color::WHITE );
277 264  
278 265 mTapDetector = TapGestureDetector::New();
279 266 mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap );
280 267  
281   - if( mItemView )
282   - {
283   - stage.Remove( mItemView );
284   - }
285   -
286 268 mFiles.clear();
287 269  
288 270 mItemView = ItemView::New(*this);
289   - stage.Add( mItemView );
  271 +
290 272 mItemView.SetParentOrigin(ParentOrigin::CENTER);
291 273 mItemView.SetAnchorPoint(AnchorPoint::CENTER);
292 274 mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
... ... @@ -354,28 +336,11 @@ public:
354 336 }
355 337 }
356 338  
357   - // Display item view on the stage
358   - stage.Add( mItemView );
359   -
360   - mItemView.SetVisible( true );
361   - mBuilderLayer.SetVisible( false );
362   -
363   - SetTitle("Select");
364   -
365 339 // Activate the layout
366 340 Vector3 size(stage.GetSize());
367 341 mItemView.ActivateLayout(0, size, 0.0f/*immediate*/);
368 342 }
369 343  
370   - void ExitSelection()
371   - {
372   - mTapDetector.Reset();
373   -
374   - mItemView.SetVisible( false );
375   - mBuilderLayer.SetVisible( true );
376   -
377   - SetTitle("View");
378   - }
379 344  
380 345 void OnTap( Actor actor, const TapGesture& tap )
381 346 {
... ... @@ -411,7 +376,7 @@ public:
411 376 Stage stage = Stage::GetCurrent();
412 377  
413 378 builder = Builder::New();
414   - builder.QuitSignal().Connect( this, &ExampleApp::OnBuilderQuit );
  379 + builder.QuitSignal().Connect( this, &ExampleApp::OnQuitOrBack );
415 380  
416 381 Property::Map defaultDirs;
417 382 defaultDirs[ TOKEN_STRING(DEMO_IMAGE_DIR) ] = DEMO_IMAGE_DIR;
... ... @@ -485,10 +450,7 @@ public:
485 450 size.y -= DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;
486 451 mBuilderLayer.SetSize( size );
487 452  
488   - mBuilderLayer.LowerToBottom();
489   - Stage::GetCurrent().GetRootLayer().RaiseToTop();
490   -
491   - ExitSelection();
  453 + mNavigationView.Push( mBuilderLayer );
492 454 }
493 455  
494 456 void Create(Application& app)
... ... @@ -504,21 +466,43 @@ public:
504 466 TOOLBAR_IMAGE,
505 467 "" );
506 468  
507   - SetTitle("Builder");
  469 + SetTitle("Select Example");
508 470  
509 471 mBuilderLayer = Layer::New();
510   - stage.GetRootLayer().Add(mBuilderLayer);
511   -
512 472  
513 473 // Create an edit mode button. (left of toolbar)
514   - Toolkit::PushButton editButton = Toolkit::PushButton::New();
515   - editButton.SetUnselectedImage( EDIT_IMAGE );
516   - editButton.SetSelectedImage( EDIT_IMAGE_SELECTED );
517   - editButton.ClickedSignal().Connect( this, &ExampleApp::OnToolSelectLayout);
518   - editButton.SetLeaveRequired( true );
519   - mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
520   -
521   - EnterSelection();
  474 + Toolkit::PushButton backButton = Toolkit::PushButton::New();
  475 + backButton.SetUnselectedImage( EDIT_IMAGE );
  476 + backButton.SetSelectedImage( EDIT_IMAGE_SELECTED );
  477 + backButton.ClickedSignal().Connect( this, &ExampleApp::OnBackButtonPressed);
  478 + backButton.SetLeaveRequired( true );
  479 + mToolBar.AddControl( backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
  480 +
  481 + mNavigationView = Toolkit::NavigationView::New();
  482 + mNavigationView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  483 + mNavigationView.SetAnchorPoint( AnchorPoint::TOP_LEFT);
  484 +
  485 + stage.Add( mNavigationView );
  486 +
  487 + // Set up the background gradient.
  488 + Property::Array stopOffsets;
  489 + stopOffsets.PushBack( 0.0f );
  490 + stopOffsets.PushBack( 1.0f );
  491 + Property::Array stopColors;
  492 + stopColors.PushBack( Color::WHITE );
  493 + stopColors.PushBack( Vector4( 0.45f, 0.70f, 0.80f, 1.0f ) ); // Medium bright, pastel blue
  494 + const float percentageStageHeight = stage.GetSize().height * 0.6f;
  495 +
  496 + mNavigationView.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
  497 + .Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT )
  498 + .Add( Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets )
  499 + .Add( Toolkit::GradientVisual::Property::STOP_COLOR, stopColors )
  500 + .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageStageHeight ) )
  501 + .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageStageHeight ) )
  502 + .Add( Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE ) );
  503 +
  504 + SetUpItemView();
  505 + mNavigationView.Push( mItemView );
522 506  
523 507 mTimer = Timer::New( 500 ); // ms
524 508 mTimer.TickSignal().Connect( this, &ExampleApp::OnTimer);
... ... @@ -546,14 +530,7 @@ public:
546 530 {
547 531 if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
548 532 {
549   - if ( mItemView.IsVisible() )
550   - {
551   - mApp.Quit();
552   - }
553   - else
554   - {
555   - EnterSelection();
556   - }
  533 + OnQuitOrBack();
557 534 }
558 535 }
559 536 }
... ... @@ -561,15 +538,15 @@ public:
561 538 /**
562 539 * Event handler when Builder wants to quit (we only want to close the shown json unless we're at the top-level)
563 540 */
564   - void OnBuilderQuit()
  541 + void OnQuitOrBack()
565 542 {
566   - if ( mItemView.IsVisible() )
  543 + if ( mItemView.OnStage() )
567 544 {
568 545 mApp.Quit();
569 546 }
570 547 else
571 548 {
572   - EnterSelection();
  549 + mNavigationView.Pop();
573 550 }
574 551 }
575 552  
... ... @@ -578,12 +555,13 @@ private:
578 555  
579 556 ItemLayoutPtr mLayout;
580 557 ItemView mItemView;
  558 + Toolkit::NavigationView mNavigationView;
581 559  
582 560 Toolkit::Control mView;
583 561 unsigned int mOrientation;
584 562  
585 563 Toolkit::ToolBar mToolBar;
586   - TextLabel mTitleActor; ///< The Toolbar's Title.
  564 + TextLabel mTitleActor;
587 565  
588 566 Layer mBuilderLayer;
589 567  
... ...
examples/buttons/buttons-example.cpp
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -306,6 +306,7 @@ class ButtonsController: public ConnectionTracker
306 306 mCheckboxButton1.SetName( "checkbox1" );
307 307 mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" );
308 308 mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
  309 + mCheckboxButton1.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
309 310  
310 311 checkBoxBackground.Add( mCheckboxButton1 );
311 312 }
... ... @@ -316,6 +317,7 @@ class ButtonsController: public ConnectionTracker
316 317 mCheckboxButton2.SetLabelText( "CheckBox2 is selected" );
317 318 mCheckboxButton2.SetSelected( true );
318 319 mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
  320 + mCheckboxButton2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
319 321  
320 322 checkBoxBackground.Add( mCheckboxButton2 );
321 323 }
... ... @@ -325,6 +327,7 @@ class ButtonsController: public ConnectionTracker
325 327 mCheckboxButton3.SetName( "checkbox3" );
326 328 mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" );
327 329 mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
  330 + mCheckboxButton3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
328 331  
329 332 checkBoxBackground.Add( mCheckboxButton3 );
330 333 }
... ...
examples/page-turn-view/page-turn-view-example.cpp
... ... @@ -17,7 +17,6 @@
17 17  
18 18 #include <dali/dali.h>
19 19 #include <dali-toolkit/dali-toolkit.h>
20   -#include <dali-toolkit/devel-api/image-atlas/image-atlas.h>
21 20 #include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
22 21 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
23 22 #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
... ...
examples/renderer-stencil/renderer-stencil-example.cpp
... ... @@ -119,15 +119,29 @@ private:
119 119 // Hide the indicator bar
120 120 application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
121 121  
122   - // Creates the background image.
  122 + // Use a gradient visual to render the background gradient.
123 123 Toolkit::Control background = Dali::Toolkit::Control::New();
124 124 background.SetAnchorPoint( Dali::AnchorPoint::CENTER );
125 125 background.SetParentOrigin( Dali::ParentOrigin::CENTER );
126 126 background.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
127   - Dali::Property::Map map;
128   - map["rendererType"] = "IMAGE";
129   - map["url"] = BACKGROUND_IMAGE;
130   - background.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
  127 +
  128 + // Set up the background gradient.
  129 + Property::Array stopOffsets;
  130 + stopOffsets.PushBack( 0.0f );
  131 + stopOffsets.PushBack( 1.0f );
  132 + Property::Array stopColors;
  133 + stopColors.PushBack( Vector4( 0.17f, 0.24f, 0.35f, 1.0f ) ); // Dark, medium saturated blue ( top of screen)
  134 + stopColors.PushBack( Vector4( 0.45f, 0.70f, 0.80f, 1.0f ) ); // Medium bright, pastel blue (bottom of screen)
  135 + const float percentageStageHeight = stage.GetSize().height * 0.7f;
  136 +
  137 + background.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
  138 + .Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT )
  139 + .Add( Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets )
  140 + .Add( Toolkit::GradientVisual::Property::STOP_COLOR, stopColors )
  141 + .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageStageHeight ) )
  142 + .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageStageHeight ) )
  143 + .Add( Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE ) );
  144 +
131 145 stage.Add( background );
132 146  
133 147 // Create a TextLabel for the application title.
... ...
examples/size-negotiation/size-negotiation-example.cpp
... ... @@ -19,6 +19,7 @@
19 19 #include <dali/dali.h>
20 20 #include <dali-toolkit/dali-toolkit.h>
21 21 #include <dali-toolkit/devel-api/controls/popup/popup.h>
  22 +#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
22 23  
23 24 using namespace Dali;
24 25  
... ... @@ -112,8 +113,12 @@ public:
112 113 // The Init signal is received once (only) during the Application lifetime
113 114 Stage stage = Stage::GetCurrent();
114 115  
115   - // Respond to key events
116   - stage.KeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent);
  116 + // Respond to key events if not handled
  117 + Toolkit::KeyInputFocusManager keyInputFocusManager = Toolkit::KeyInputFocusManager::Get();
  118 + if( keyInputFocusManager )
  119 + {
  120 + keyInputFocusManager.UnhandledKeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent);
  121 + }
117 122  
118 123 // Creates a default view with a default tool bar.
119 124 // The view is added to the stage.
... ...
examples/video-view/video-view-example.cpp
... ... @@ -28,7 +28,7 @@ namespace
28 28 const int INIT_HEIGHT( 400 );
29 29 const int BUTTON_SIZE( 80 );
30 30  
31   - const char* const PLAY_FILE = DEMO_VIDEO_DIR "big_buck_bunny.mp4";
  31 + const char* const PLAY_FILE = DEMO_VIDEO_DIR "demoVideo.mp4";
32 32 const char* const PLAY_IMAGE = DEMO_IMAGE_DIR "icon-play.png";
33 33 const char* const PAUSE_IMAGE = DEMO_IMAGE_DIR "Pause.png";
34 34 const char* const STOP_IMAGE = DEMO_IMAGE_DIR "icon-stop.png";
... ... @@ -36,32 +36,6 @@ namespace
36 36 const char* const FORWARD_IMAGE = DEMO_IMAGE_DIR "Forward.png";
37 37 const char* const BACKWARD_IMAGE = DEMO_IMAGE_DIR "Backward.png";
38 38  
39   -const char* DEFAULT_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
40   - varying mediump vec2 vTexCoord;\n
41   - uniform sampler2D sTexture;\n
42   - uniform lowp vec4 uColor;\n
43   - \n
44   - void main()\n
45   - {\n
46   - gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
47   - }\n
48   -);
49   -
50   -const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
51   - precision mediump float;
52   - varying mediump vec2 vTexCoord;\n
53   - uniform sampler2D sTexture;\n
54   - uniform lowp vec4 uColor;\n
55   - \n
56   - void main()\n
57   - {\n
58   - vec2 st = vTexCoord.st;\n
59   - vec3 irgb = texture2D( sTexture, st ).rgb;\n
60   - vec3 negative = vec3( 1., 1., 1. ) - irgb;\n
61   - gl_FragColor = vec4( mix( irgb, negative, 1.0), 1. ) * uColor;\n
62   - }\n
63   -);
64   -
65 39 } // namespace
66 40  
67 41 class VideoViewController: public ConnectionTracker
... ... @@ -73,7 +47,6 @@ class VideoViewController: public ConnectionTracker
73 47 mIsPlay( false ),
74 48 mIsStop( false ),
75 49 mIsFullScreen( false ),
76   - mSetCustomShader( false ),
77 50 mScale( 1.f )
78 51 {
79 52 // Connect to the Application's Init signal
... ... @@ -209,16 +182,6 @@ class VideoViewController: public ConnectionTracker
209 182  
210 183 Stage::GetCurrent().KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent );
211 184  
212   - Property::Map customShader;
213   - customShader.Insert( Visual::Shader::Property::FRAGMENT_SHADER, FRAGMENT_SHADER );
214   - mCustomShader.Insert( Visual::Property::TYPE, Visual::IMAGE );
215   - mCustomShader.Insert( Visual::Property::SHADER, customShader );
216   -
217   - Property::Map defaultShader;
218   - customShader.Insert( Visual::Shader::Property::FRAGMENT_SHADER, DEFAULT_FRAGMENT_SHADER );
219   - mDefaultShader.Insert( Visual::Property::TYPE, Visual::IMAGE );
220   - mDefaultShader.Insert( Visual::Property::SHADER, customShader );
221   -
222 185 mWindowSurfaceTarget.Insert( "RENDERING_TARGET", "windowSurfaceTarget" );
223 186 mNativeImageTarget.Insert( "RENDERING_TARGET", "nativeImageTarget" );
224 187  
... ... @@ -350,17 +313,6 @@ class VideoViewController: public ConnectionTracker
350 313 if( !mIsFullScreen )
351 314 {
352 315 mRotationAnimation.Play();
353   -
354   - if( mSetCustomShader )
355   - {
356   - mSetCustomShader = false;
357   - mVideoView.SetProperty( VideoView::Property::VIDEO, mDefaultShader );
358   - }
359   - else
360   - {
361   - mSetCustomShader = true;
362   - mVideoView.SetProperty( VideoView::Property::VIDEO, mCustomShader );
363   - }
364 316 }
365 317 }
366 318  
... ... @@ -389,7 +341,6 @@ private:
389 341 bool mIsPlay;
390 342 bool mIsStop;
391 343 bool mIsFullScreen;
392   - bool mSetCustomShader;
393 344  
394 345 PushButton mPlayButton;
395 346 PushButton mPauseButton;
... ... @@ -405,8 +356,6 @@ private:
405 356 float mPinchStartScale;
406 357  
407 358 Animation mRotationAnimation;
408   - Property::Map mCustomShader;
409   - Property::Map mDefaultShader;
410 359 Property::Map mWindowSurfaceTarget;
411 360 Property::Map mNativeImageTarget;
412 361 };
... ...
packaging/com.samsung.dali-demo.spec
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Name: com.samsung.dali-demo
4 4 Summary: The OpenGLES Canvas Core Demo
5   -Version: 1.2.9
  5 +Version: 1.2.10
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/videos/big_buck_bunny.mp4 deleted
No preview for this file type
resources/videos/demoVideo.mp4 0 → 100755
No preview for this file type