Commit 3b1f0cb34f2a4d93167b78f62280d0e0758cead2

Authored by Adeel Kazmi
2 parents de1fd913 707b58e4

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

Change-Id: I25f44c4135a2a802f3d5f713a52301e17e4b48b4
build/tizen/CMakeLists.txt
... ... @@ -117,6 +117,7 @@ CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE
117 117 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json )
118 118 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/tooltip-example-theme.json.in ${LOCAL_STYLE_DIR}/tooltip-example-theme.json )
119 119 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/basic-light-theme.json.in ${LOCAL_STYLE_DIR}/basic-light-theme.json )
  120 +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/text-editor-example-theme.json.in ${LOCAL_STYLE_DIR}/text-editor-example-theme.json )
120 121 MESSAGE("Configured ${LOCAL_STYLE_DIR}/style-example-theme<>.json files")
121 122  
122 123 FILE(GLOB LOCAL_STYLES_LIST "${LOCAL_STYLE_DIR}/*.json")
... ...
examples/mesh-visual/mesh-visual-example.cpp
1 1 #include <dali-toolkit/dali-toolkit.h>
2 2 #include <dali/public-api/object/property-map.h>
  3 +#include <dali-toolkit/devel-api/align-enums.h>
  4 +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
3 5  
4 6 using namespace Dali;
5 7 using namespace Dali::Toolkit;
... ... @@ -321,6 +323,9 @@ public:
321 323 //Create mesh property map
322 324 Property::Map map;
323 325 map.Insert( Visual::Property::TYPE, Visual::MESH );
  326 + map.Insert( DevelVisual::Property::TRANSFORM,
  327 + Property::Map().Add( DevelVisual::Transform::Property::ORIGIN, Align::CENTER )
  328 + .Add( DevelVisual::Transform::Property::ANCHOR_POINT, Align::CENTER ) );
324 329 map.Insert( MeshVisual::Property::OBJECT_URL, MODEL_FILE_TABLE[mModelIndex] );
325 330 map.Insert( MeshVisual::Property::MATERIAL_URL, MATERIAL_FILE_TABLE[mModelIndex] );
326 331 map.Insert( MeshVisual::Property::TEXTURES_PATH, TEXTURES_PATH );
... ...
examples/primitive-shapes/primitive-shapes-example.cpp
... ... @@ -17,7 +17,9 @@
17 17  
18 18 #include <dali-toolkit/dali-toolkit.h>
19 19 #include <dali/public-api/object/property-map.h>
  20 +#include <dali-toolkit/devel-api/align-enums.h>
20 21 #include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
  22 +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
21 23 #include <dali-toolkit/public-api/controls/slider/slider.h>
22 24  
23 25 using namespace Dali;
... ... @@ -355,6 +357,9 @@ public:
355 357 mVisualMap.Clear();
356 358 mVisualMap[ Visual::Property::TYPE ] = Visual::PRIMITIVE;
357 359 mVisualMap[ PrimitiveVisual::Property::MIX_COLOR ] = mColor;
  360 + mVisualMap[ DevelVisual::Property::TRANSFORM ] =
  361 + Property::Map().Add( DevelVisual::Transform::Property::ORIGIN, Align::CENTER )
  362 + .Add( DevelVisual::Transform::Property::ANCHOR_POINT, Align::CENTER );
358 363 }
359 364  
360 365 //Sets the 3D model to a sphere and modifies the sliders appropriately.
... ...
examples/text-editor/text-editor-example.cpp
... ... @@ -34,6 +34,7 @@ using namespace Dali::Toolkit;
34 34 namespace
35 35 {
36 36  
  37 +const char * const THEME_PATH( DEMO_STYLE_DIR "text-editor-example-theme.json" ); ///< The theme used for this example
37 38 const Vector4 BACKGROUND_COLOR( 0.04f, 0.345f, 0.392f, 1.0f ); ///< The background color.
38 39 const char* TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png"; ///< The tool-bar image.
39 40 const float TOOLBAR_BUTTON_PERCENTAGE = 0.1f; ///< The button's space width as a percentage of the toolbar's width.
... ... @@ -182,6 +183,8 @@ public:
182 183 mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged );
183 184  
184 185 contents.Add( mEditor );
  186 + StyleManager styleManager = StyleManager::Get();
  187 + styleManager.ApplyTheme( THEME_PATH );
185 188 }
186 189  
187 190 void CreateButtonContainer()
... ...
examples/text-scrolling/text-scrolling-example.cpp
... ... @@ -36,6 +36,14 @@ const Vector2 SCROLLING_BOX_SIZE( Vector2(330.0f, 40.0f ) );
36 36 const float MAX_OFFSCREEN_RENDERING_SIZE = 2048.f;
37 37 const float SCREEN_BORDER = 5.0f; // Border around screen that Popups and handles will not exceed
38 38  
  39 +const char * ALIGNMENT_TABLE[] =
  40 +{
  41 + "BEGIN",
  42 + "CENTER",
  43 + "END"
  44 +};
  45 +const unsigned int ALIGNMENT_TABLE_COUNT = sizeof( ALIGNMENT_TABLE ) / sizeof( ALIGNMENT_TABLE[ 0 ] );
  46 +
39 47 enum Labels
40 48 {
41 49 SMALL = 1u,
... ... @@ -172,7 +180,7 @@ public:
172 180 boxC.SetPosition( 0.0f, -300.0f, 1.0f );
173 181 Toolkit::PushButton scrollSmallButton = Toolkit::PushButton::New();
174 182 scrollSmallButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedSmall );
175   - CreateLabel( mSmallLabel, "A Quick Brown Fox", boxC , true, scrollSmallButton );
  183 + CreateLabel( mSmallLabel, "Hello Text", boxC , true, scrollSmallButton );
176 184 mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
177 185 mSmallLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
178 186 mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::CYAN );
... ... @@ -209,6 +217,25 @@ public:
209 217 colorButton.SetSize(BOX_SIZE.height,BOX_SIZE.height);
210 218 colorButton.ClickedSignal().Connect( this, &TextScrollingExample::OnColorButtonClicked );
211 219 rootActor.Add( colorButton );
  220 +
  221 + for( unsigned int i = 0; i < ALIGNMENT_TABLE_COUNT; ++i )
  222 + {
  223 + Toolkit::RadioButton alignButton = Toolkit::RadioButton::New( ALIGNMENT_TABLE[ i ] );
  224 + alignButton.ClickedSignal().Connect( this, &TextScrollingExample::OnAlignButtonClicked );
  225 + alignButton.SetName( ALIGNMENT_TABLE[ i ] );
  226 +
  227 + // Place first button to left aligned, second center aligned and third right aligned
  228 + alignButton.SetAnchorPoint( Vector3( i * 0.5f, 0.0f, 0.5f ) );
  229 + alignButton.SetParentOrigin( Vector3( i * 0.5f, 0.0f, 0.5f ) );
  230 +
  231 + rootActor.Add( alignButton );
  232 +
  233 + if( i == 0 )
  234 + {
  235 + // Set the first button as selected
  236 + alignButton.SetProperty( Button::Property::SELECTED, true );
  237 + }
  238 + }
212 239 }
213 240  
214 241 void EnableScrolling( Labels labels )
... ... @@ -281,26 +308,45 @@ public:
281 308 }
282 309  
283 310 bool OnColorButtonClicked( Toolkit::Button button )
284   - {
285   - Vector4 color = Color::RED;
286   -
287   - if ( mToggleColor )
288 311 {
289   - color = Color::BLACK;
290   - mToggleColor = false;
291   - }
292   - else
293   - {
294   - mToggleColor = true;
  312 + Vector4 color = Color::RED;
  313 +
  314 + if ( mToggleColor )
  315 + {
  316 + color = Color::BLACK;
  317 + mToggleColor = false;
  318 + }
  319 + else
  320 + {
  321 + mToggleColor = true;
  322 + }
  323 +
  324 + mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
  325 + mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
  326 + mRtlLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
  327 + mLargeLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
  328 + mRtlLongLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
  329 +
  330 + return true;
295 331 }
296 332  
297   - mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
298   - mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
299   - mLargeLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
300   - mRtlLongLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
  333 + bool OnAlignButtonClicked( Toolkit::Button button )
  334 + {
  335 + for( unsigned int index = 0; index < ALIGNMENT_TABLE_COUNT; ++index )
  336 + {
  337 + const std::string& buttonName = button.GetName();
  338 + if( buttonName == ALIGNMENT_TABLE[ index ] )
  339 + {
  340 + mSmallLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, ALIGNMENT_TABLE[ index ] );
  341 + mRtlLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, ALIGNMENT_TABLE[ index ] );
  342 + mLargeLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, ALIGNMENT_TABLE[ index ] );
  343 + mRtlLongLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, ALIGNMENT_TABLE[ index ] );
  344 + break;
  345 + }
  346 + }
301 347  
302   - return true;
303   - }
  348 + return true;
  349 + }
304 350  
305 351 /**
306 352 * Main key event handler
... ...
examples/transitions/shadow-button-impl.cpp
... ... @@ -353,26 +353,22 @@ void ShadowButton::ResetVisual(
353 353 {
354 354 case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
355 355 {
356   - DevelControl::RegisterVisual( *this, index, visual );
357   - visual.SetDepthIndex(0.0f);
  356 + DevelControl::RegisterVisual( *this, index, visual, 0 );
358 357 break;
359 358 }
360 359 case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
361 360 {
362   - DevelControl::RegisterVisual( *this, index, visual );
363   - visual.SetDepthIndex(1.0f);
  361 + DevelControl::RegisterVisual( *this, index, visual, 1 );
364 362 break;
365 363 }
366 364 case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
367 365 {
368   - DevelControl::RegisterVisual( *this, index, visual, mCheckState );
369   - visual.SetDepthIndex(2.0f);
  366 + DevelControl::RegisterVisual( *this, index, visual, mCheckState, 2 );
370 367 break;
371 368 }
372 369 case Demo::ShadowButton::Property::LABEL_VISUAL:
373 370 {
374   - DevelControl::RegisterVisual( *this, index, visual );
375   - visual.SetDepthIndex(1.0f);
  371 + DevelControl::RegisterVisual( *this, index, visual, 1 );
376 372 break;
377 373 }
378 374 }
... ...
examples/visual-transitions/beat-control-impl.cpp
... ... @@ -17,13 +17,10 @@
17 17 #include "beat-control-impl.h"
18 18 #include <dali-toolkit/dali-toolkit.h>
19 19 #include <dali/public-api/object/type-registry-helper.h>
20   -#include <dali-toolkit/devel-api/align-enums.h>
21 20 #include <dali-toolkit/devel-api/controls/control-devel.h>
22 21 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
23 22 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
24 23  
25   -#include <cstdio>
26   -
27 24 using namespace Dali; // Needed for macros
28 25 using namespace Dali::Toolkit;
29 26  
... ... @@ -60,13 +57,18 @@ Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value&amp; valu
60 57 {
61 58 Toolkit::TransitionData transitionData;
62 59  
63   - if( value.GetType() == Property::ARRAY )
  60 + const Property::Array* array = value.GetArray();
  61 + if( array )
64 62 {
65   - transitionData = Toolkit::TransitionData::New( *value.GetArray());
  63 + transitionData = Toolkit::TransitionData::New( *array );
66 64 }
67   - else if( value.GetType() == Property::MAP )
  65 + else
68 66 {
69   - transitionData = Toolkit::TransitionData::New( *value.GetMap() );
  67 + const Property::Map* map = value.GetMap();
  68 + if( map )
  69 + {
  70 + transitionData = Toolkit::TransitionData::New( *map );
  71 + }
70 72 }
71 73 return transitionData;
72 74 }
... ... @@ -77,6 +79,8 @@ Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value&amp; valu
77 79 Internal::BeatControl::BeatControl()
78 80 : Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
79 81 mTransformSize(1.0f, 1.0f),
  82 + mTransformOrigin(Align::CENTER),
  83 + mTransformAnchorPoint(Align::CENTER),
80 84 mAnimationPlaying(0)
81 85 {
82 86 }
... ... @@ -209,6 +213,8 @@ void BeatControl::RelayoutVisuals( const Vector2&amp; targetSize )
209 213 // Make the visual half the size of the control, but leave
210 214 // origin and anchor point at center, position is relative, but Zer0
211 215 transformMap[ DevelVisual::Transform::Property::SIZE ] = mTransformSize;
  216 + transformMap[ DevelVisual::Transform::Property::ORIGIN ] = mTransformOrigin;
  217 + transformMap[ DevelVisual::Transform::Property::ANCHOR_POINT ] = mTransformAnchorPoint;
212 218 mVisual.SetTransformAndSize( transformMap, size );
213 219 }
214 220 }
... ... @@ -249,7 +255,7 @@ void BeatControl::SetProperty( BaseObject* object, Property::Index index, const
249 255 {
250 256 case Demo::BeatControl::Property::BEAT_VISUAL:
251 257 {
252   - bool sizeOnly = false;
  258 + bool sizeAndPositionOnly = false;
253 259  
254 260 // Determine if a transform.size property exists in the map, and
255 261 // save it.
... ... @@ -262,18 +268,47 @@ void BeatControl::SetProperty( BaseObject* object, Property::Index index, const
262 268 Property::Map* transformMap = value->GetMap();
263 269 if( transformMap )
264 270 {
  271 + // We'll increment this whenever SIZE, ORIGIN or ANCHOR_POINT's are modified as we won't need to create a new visual if only these properties are used
  272 + // If there are more properties in the transform map, then we need to create a new visual
  273 + unsigned int sizeAndPositionPropertyCount = 0;
  274 +
265 275 Property::Value* sizeValue = transformMap->Find( DevelVisual::Transform::Property::SIZE, "size" );
266 276 if( sizeValue )
267 277 {
268 278 sizeValue->Get( impl.mTransformSize );
269   - if( map->Count() == 1 && transformMap->Count() == 1 )
  279 + ++sizeAndPositionPropertyCount;
  280 + }
  281 +
  282 + Property::Value* originValue = transformMap->Find( DevelVisual::Transform::Property::ORIGIN, "origin" );
  283 + if( originValue )
  284 + {
  285 + int intValue = 0;
  286 + if( originValue->Get( intValue ) )
270 287 {
271   - sizeOnly = true;
  288 + impl.mTransformOrigin = static_cast< Toolkit::Align::Type >( intValue );
  289 + ++sizeAndPositionPropertyCount;
272 290 }
273 291 }
  292 +
  293 + Property::Value* anchorPointValue = transformMap->Find( DevelVisual::Transform::Property::ANCHOR_POINT, "anchorPoint" );
  294 + if( anchorPointValue )
  295 + {
  296 + int intValue = 0;
  297 + if( anchorPointValue->Get( intValue ) )
  298 + {
  299 + impl.mTransformAnchorPoint = static_cast< Toolkit::Align::Type >( intValue );
  300 + ++sizeAndPositionPropertyCount;
  301 + }
  302 + }
  303 +
  304 + // If the only properties that the application is overriding are the size and the position properties, then we do not need to create another visual.
  305 + if( map->Count() == 1 && transformMap->Count() == sizeAndPositionPropertyCount )
  306 + {
  307 + sizeAndPositionOnly = true;
  308 + }
274 309 }
275 310 }
276   - if( ! sizeOnly )
  311 + if( ! sizeAndPositionOnly )
277 312 {
278 313 // Only register a visual if there is more than just a size setting
279 314 impl.mVisual = Toolkit::VisualFactory::Get().CreateVisual( *map );
... ...
examples/visual-transitions/beat-control-impl.h
... ... @@ -2,7 +2,7 @@
2 2 #define DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H
3 3  
4 4 /*
5   - * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  5 + * Copyright (c) 2017 Samsung Electronics Co., Ltd.
6 6 *
7 7 * Licensed under the Apache License, Version 2.0 (the "License");
8 8 * you may not use this file except in compliance with the License.
... ... @@ -20,6 +20,7 @@
20 20 #include "beat-control.h"
21 21 #include <dali/public-api/animation/animation.h>
22 22 #include <dali-toolkit/public-api/controls/control-impl.h>
  23 +#include <dali-toolkit/devel-api/align-enums.h>
23 24 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
24 25 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
25 26  
... ... @@ -128,6 +129,8 @@ private:
128 129 Dali::Animation mYAnimation;
129 130 Dali::Animation mFadeAnimation;
130 131 Dali::Vector2 mTransformSize;
  132 + Dali::Toolkit::Align::Type mTransformOrigin;
  133 + Dali::Toolkit::Align::Type mTransformAnchorPoint;
131 134 int mAnimationPlaying;
132 135 };
133 136  
... ...
examples/visual-transitions/transition-application.cpp
1 1 /*
2   - * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2017 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.
... ... @@ -124,7 +124,7 @@ void TransitionApplication::Create( Application&amp; application )
124 124 Property::Map map;
125 125 CreateVisualMap( i, map );
126 126 map.Add( DevelVisual::Property::TRANSFORM, Property::Map()
127   - .Add( DevelVisual::Transform::Property::SIZE, Vector2(0.8f, 0.8f) ) );
  127 + .Add( DevelVisual::Transform::Property::SIZE, Vector2(0.8f, 0.8f) ) );
128 128 mVisualButtons[i] = BeatControl::New();
129 129 mVisualButtons[i].SetProperty( BeatControl::Property::BEAT_VISUAL, map );
130 130 mVisualButtons[i].SetName("VisualButton");
... ...
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.42
  5 +Version: 1.2.43
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/style/.gitignore
... ... @@ -7,3 +7,4 @@ style-example-theme-two.json
7 7 style-example-theme-one.json
8 8 tooltip-example-theme.json
9 9 basic-light-theme.json
  10 +text-editor-example-theme.json
... ...
resources/style/mobile/text-editor-example-theme.json.in 0 → 100644
  1 +/*
  2 + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd
  3 + * Licensed under the Apache License, Version 2.0 (the "License");
  4 + * you may not use this file except in compliance with the License.
  5 + * You may obtain a copy of the License at
  6 + *
  7 + * http://www.apache.org/licenses/LICENSE-2.0
  8 + *
  9 + * Unless required by applicable law or agreed to in writing, software
  10 + * distributed under the License is distributed on an "AS IS" BASIS,
  11 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 + * See the License for the specific language governing permissions and
  13 + * limitations under the License.
  14 + *
  15 + */
  16 +
  17 +{
  18 + "styles":
  19 + {
  20 + "ScrollBar":
  21 + {
  22 + "indicatorShowDuration":1.0,
  23 + "indicatorHideDuration":1.0,
  24 + "background": {
  25 + "rendererType": "image",
  26 + "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png"
  27 + }
  28 + },
  29 + "ScrollBarIndicator":
  30 + {
  31 + "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png"
  32 + }
  33 + }
  34 +}
... ...
resources/style/text-editor-example-theme.json.in 0 → 100644
  1 +/*
  2 + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd
  3 + * Licensed under the Apache License, Version 2.0 (the "License");
  4 + * you may not use this file except in compliance with the License.
  5 + * You may obtain a copy of the License at
  6 + *
  7 + * http://www.apache.org/licenses/LICENSE-2.0
  8 + *
  9 + * Unless required by applicable law or agreed to in writing, software
  10 + * distributed under the License is distributed on an "AS IS" BASIS,
  11 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 + * See the License for the specific language governing permissions and
  13 + * limitations under the License.
  14 + *
  15 + */
  16 +
  17 +{
  18 + "styles":
  19 + {
  20 + "ScrollBar":
  21 + {
  22 + "indicatorShowDuration":1.0,
  23 + "indicatorHideDuration":1.0,
  24 + "background": {
  25 + "rendererType": "image",
  26 + "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png"
  27 + }
  28 + },
  29 + "ScrollBarIndicator":
  30 + {
  31 + "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png"
  32 + }
  33 + }
  34 +}
... ...
shared/multi-language-strings.h
... ... @@ -206,9 +206,14 @@ namespace MultiLanguageStrings
206 206 "(Xhosa)",
207 207 "Molo Lizwe"
208 208 },
  209 + {
  210 + "Amharic",
  211 + "(አማርኛ)",
  212 + "ያስገቡት PIN ትክክለኛ አይደለም። እባክዎ እንደገና ይሞክሩ።"
  213 + }
209 214 };
210 215  
211   - const unsigned int NUMBER_OF_LANGUAGES = 35u;
  216 + const unsigned int NUMBER_OF_LANGUAGES = 36u;
212 217  
213 218 } // MultiLanguageStrings
214 219  
... ...