[dali_1.2.43] Merge branch 'devel/master' 91/133291/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 9 Jun 2017 12:53:36 +0000 (13:53 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 9 Jun 2017 12:53:36 +0000 (13:53 +0100)
Change-Id: I25f44c4135a2a802f3d5f713a52301e17e4b48b4

14 files changed:
build/tizen/CMakeLists.txt
examples/mesh-visual/mesh-visual-example.cpp
examples/primitive-shapes/primitive-shapes-example.cpp
examples/text-editor/text-editor-example.cpp
examples/text-scrolling/text-scrolling-example.cpp
examples/transitions/shadow-button-impl.cpp
examples/visual-transitions/beat-control-impl.cpp
examples/visual-transitions/beat-control-impl.h
examples/visual-transitions/transition-application.cpp
packaging/com.samsung.dali-demo.spec
resources/style/.gitignore
resources/style/mobile/text-editor-example-theme.json.in [new file with mode: 0644]
resources/style/text-editor-example-theme.json.in [new file with mode: 0644]
shared/multi-language-strings.h

index 90b1349..509afef 100644 (file)
@@ -117,6 +117,7 @@ CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE
 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json )
 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/tooltip-example-theme.json.in ${LOCAL_STYLE_DIR}/tooltip-example-theme.json )
 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/basic-light-theme.json.in ${LOCAL_STYLE_DIR}/basic-light-theme.json )
+CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/text-editor-example-theme.json.in ${LOCAL_STYLE_DIR}/text-editor-example-theme.json )
 MESSAGE("Configured ${LOCAL_STYLE_DIR}/style-example-theme<>.json files")
 
 FILE(GLOB LOCAL_STYLES_LIST "${LOCAL_STYLE_DIR}/*.json")
index 341a72c..4b9fb23 100644 (file)
@@ -1,5 +1,7 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/public-api/object/property-map.h>
+#include <dali-toolkit/devel-api/align-enums.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -321,6 +323,9 @@ public:
     //Create mesh property map
     Property::Map map;
     map.Insert( Visual::Property::TYPE,  Visual::MESH );
+    map.Insert( DevelVisual::Property::TRANSFORM,
+                Property::Map().Add( DevelVisual::Transform::Property::ORIGIN, Align::CENTER )
+                               .Add( DevelVisual::Transform::Property::ANCHOR_POINT, Align::CENTER ) );
     map.Insert( MeshVisual::Property::OBJECT_URL, MODEL_FILE_TABLE[mModelIndex] );
     map.Insert( MeshVisual::Property::MATERIAL_URL, MATERIAL_FILE_TABLE[mModelIndex] );
     map.Insert( MeshVisual::Property::TEXTURES_PATH, TEXTURES_PATH );
index cc762be..cce4f3c 100644 (file)
@@ -17,7 +17,9 @@
 
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/public-api/object/property-map.h>
+#include <dali-toolkit/devel-api/align-enums.h>
 #include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include <dali-toolkit/public-api/controls/slider/slider.h>
 
 using namespace Dali;
@@ -355,6 +357,9 @@ public:
     mVisualMap.Clear();
     mVisualMap[ Visual::Property::TYPE           ] = Visual::PRIMITIVE;
     mVisualMap[ PrimitiveVisual::Property::MIX_COLOR ] = mColor;
+    mVisualMap[ DevelVisual::Property::TRANSFORM ] =
+        Property::Map().Add( DevelVisual::Transform::Property::ORIGIN, Align::CENTER )
+                       .Add( DevelVisual::Transform::Property::ANCHOR_POINT, Align::CENTER );
   }
 
   //Sets the 3D model to a sphere and modifies the sliders appropriately.
index 23d9dbb..44b08c8 100644 (file)
@@ -34,6 +34,7 @@ using namespace Dali::Toolkit;
 namespace
 {
 
+const char * const THEME_PATH( DEMO_STYLE_DIR "text-editor-example-theme.json" ); ///< The theme used for this example
 const Vector4 BACKGROUND_COLOR( 0.04f, 0.345f, 0.392f, 1.0f );      ///< The background color.
 const char*   TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png";         ///< The tool-bar image.
 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:
     mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged );
 
     contents.Add( mEditor );
+    StyleManager styleManager = StyleManager::Get();
+    styleManager.ApplyTheme( THEME_PATH );
   }
 
   void CreateButtonContainer()
index 709dce0..872f289 100644 (file)
@@ -36,6 +36,14 @@ const Vector2 SCROLLING_BOX_SIZE( Vector2(330.0f, 40.0f ) );
 const float MAX_OFFSCREEN_RENDERING_SIZE = 2048.f;
 const float SCREEN_BORDER = 5.0f; // Border around screen that Popups and handles will not exceed
 
+const char * ALIGNMENT_TABLE[] =
+{
+  "BEGIN",
+  "CENTER",
+  "END"
+};
+const unsigned int ALIGNMENT_TABLE_COUNT = sizeof( ALIGNMENT_TABLE ) / sizeof( ALIGNMENT_TABLE[ 0 ] );
+
 enum Labels
 {
   SMALL = 1u,
@@ -172,7 +180,7 @@ public:
     boxC.SetPosition( 0.0f, -300.0f, 1.0f );
     Toolkit::PushButton scrollSmallButton = Toolkit::PushButton::New();
     scrollSmallButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedSmall );
-    CreateLabel( mSmallLabel, "A Quick Brown Fox", boxC , true, scrollSmallButton );
+    CreateLabel( mSmallLabel, "Hello Text", boxC , true, scrollSmallButton );
     mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
     mSmallLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
     mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::CYAN );
@@ -209,6 +217,25 @@ public:
     colorButton.SetSize(BOX_SIZE.height,BOX_SIZE.height);
     colorButton.ClickedSignal().Connect( this, &TextScrollingExample::OnColorButtonClicked );
     rootActor.Add( colorButton );
+
+    for( unsigned int i = 0; i < ALIGNMENT_TABLE_COUNT; ++i )
+    {
+      Toolkit::RadioButton alignButton = Toolkit::RadioButton::New( ALIGNMENT_TABLE[ i ] );
+      alignButton.ClickedSignal().Connect( this, &TextScrollingExample::OnAlignButtonClicked );
+      alignButton.SetName( ALIGNMENT_TABLE[ i ] );
+
+      // Place first button to left aligned, second center aligned and third right aligned
+      alignButton.SetAnchorPoint( Vector3( i * 0.5f, 0.0f, 0.5f ) );
+      alignButton.SetParentOrigin( Vector3( i * 0.5f, 0.0f, 0.5f ) );
+
+      rootActor.Add( alignButton );
+
+      if( i == 0 )
+      {
+        // Set the first button as selected
+        alignButton.SetProperty( Button::Property::SELECTED, true );
+      }
+    }
   }
 
   void EnableScrolling( Labels labels )
@@ -281,26 +308,45 @@ public:
   }
 
   bool OnColorButtonClicked( Toolkit::Button button )
- {
-   Vector4 color = Color::RED;
-
-  if ( mToggleColor )
   {
-    color = Color::BLACK;
-    mToggleColor = false;
-  }
-  else
-  {
-    mToggleColor = true;
+    Vector4 color = Color::RED;
+
+    if ( mToggleColor )
+    {
+      color = Color::BLACK;
+      mToggleColor = false;
+    }
+    else
+    {
+      mToggleColor = true;
+    }
+
+    mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
+    mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
+    mRtlLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
+    mLargeLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
+    mRtlLongLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
+
+    return true;
   }
 
-  mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
-  mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
-  mLargeLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
-  mRtlLongLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
+  bool OnAlignButtonClicked( Toolkit::Button button )
+  {
+    for( unsigned int index = 0; index < ALIGNMENT_TABLE_COUNT; ++index )
+    {
+      const std::string& buttonName = button.GetName();
+      if( buttonName == ALIGNMENT_TABLE[ index ] )
+      {
+        mSmallLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, ALIGNMENT_TABLE[ index ] );
+        mRtlLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, ALIGNMENT_TABLE[ index ] );
+        mLargeLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, ALIGNMENT_TABLE[ index ] );
+        mRtlLongLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, ALIGNMENT_TABLE[ index ] );
+        break;
+      }
+    }
 
-  return true;
- }
+    return true;
 }
 
   /**
    * Main key event handler
index edcfbec..135ea16 100644 (file)
@@ -353,26 +353,22 @@ void ShadowButton::ResetVisual(
     {
       case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
       {
-        DevelControl::RegisterVisual( *this, index, visual );
-        visual.SetDepthIndex(0.0f);
+        DevelControl::RegisterVisual( *this, index, visual, 0 );
         break;
       }
       case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
       {
-        DevelControl::RegisterVisual( *this, index, visual );
-        visual.SetDepthIndex(1.0f);
+        DevelControl::RegisterVisual( *this, index, visual, 1 );
         break;
       }
       case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
       {
-        DevelControl::RegisterVisual( *this, index, visual, mCheckState );
-        visual.SetDepthIndex(2.0f);
+        DevelControl::RegisterVisual( *this, index, visual, mCheckState, 2 );
         break;
       }
       case Demo::ShadowButton::Property::LABEL_VISUAL:
       {
-        DevelControl::RegisterVisual( *this, index, visual );
-        visual.SetDepthIndex(1.0f);
+        DevelControl::RegisterVisual( *this, index, visual, 1 );
         break;
       }
     }
index d160e5b..54ae6b0 100644 (file)
 #include "beat-control-impl.h"
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/public-api/object/type-registry-helper.h>
-#include <dali-toolkit/devel-api/align-enums.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 
-#include <cstdio>
-
 using namespace Dali; // Needed for macros
 using namespace Dali::Toolkit;
 
@@ -60,13 +57,18 @@ Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& valu
 {
   Toolkit::TransitionData transitionData;
 
-  if( value.GetType() == Property::ARRAY )
+  const Property::Array* array = value.GetArray();
+  if( array )
   {
-    transitionData = Toolkit::TransitionData::New( *value.GetArray());
+    transitionData = Toolkit::TransitionData::New( *array );
   }
-  else if( value.GetType() == Property::MAP )
+  else
   {
-    transitionData = Toolkit::TransitionData::New( *value.GetMap() );
+    const Property::Map* map = value.GetMap();
+    if( map )
+    {
+      transitionData = Toolkit::TransitionData::New( *map );
+    }
   }
   return transitionData;
 }
@@ -77,6 +79,8 @@ Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& valu
 Internal::BeatControl::BeatControl()
 : Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mTransformSize(1.0f, 1.0f),
+  mTransformOrigin(Align::CENTER),
+  mTransformAnchorPoint(Align::CENTER),
   mAnimationPlaying(0)
 {
 }
@@ -209,6 +213,8 @@ void BeatControl::RelayoutVisuals( const Vector2& targetSize )
       // Make the visual half the size of the control, but leave
       // origin and anchor point at center, position is relative, but Zer0
       transformMap[ DevelVisual::Transform::Property::SIZE ] = mTransformSize;
+      transformMap[ DevelVisual::Transform::Property::ORIGIN ] = mTransformOrigin;
+      transformMap[ DevelVisual::Transform::Property::ANCHOR_POINT ] = mTransformAnchorPoint;
       mVisual.SetTransformAndSize( transformMap, size );
     }
   }
@@ -249,7 +255,7 @@ void BeatControl::SetProperty( BaseObject* object, Property::Index index, const
     {
       case Demo::BeatControl::Property::BEAT_VISUAL:
       {
-        bool sizeOnly = false;
+        bool sizeAndPositionOnly = false;
 
         // Determine if a transform.size property exists in the map, and
         // save it.
@@ -262,18 +268,47 @@ void BeatControl::SetProperty( BaseObject* object, Property::Index index, const
             Property::Map* transformMap = value->GetMap();
             if( transformMap )
             {
+              // 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
+              // If there are more properties in the transform map, then we need to create a new visual
+              unsigned int sizeAndPositionPropertyCount = 0;
+
               Property::Value* sizeValue = transformMap->Find( DevelVisual::Transform::Property::SIZE, "size" );
               if( sizeValue )
               {
                 sizeValue->Get( impl.mTransformSize );
-                if( map->Count() == 1 && transformMap->Count() == 1 )
+                ++sizeAndPositionPropertyCount;
+              }
+
+              Property::Value* originValue = transformMap->Find( DevelVisual::Transform::Property::ORIGIN, "origin" );
+              if( originValue )
+              {
+                int intValue = 0;
+                if( originValue->Get( intValue ) )
                 {
-                  sizeOnly = true;
+                  impl.mTransformOrigin = static_cast< Toolkit::Align::Type >( intValue );
+                  ++sizeAndPositionPropertyCount;
                 }
               }
+
+              Property::Value* anchorPointValue = transformMap->Find( DevelVisual::Transform::Property::ANCHOR_POINT, "anchorPoint" );
+              if( anchorPointValue )
+              {
+                int intValue = 0;
+                if( anchorPointValue->Get( intValue ) )
+                {
+                  impl.mTransformAnchorPoint = static_cast< Toolkit::Align::Type >( intValue );
+                  ++sizeAndPositionPropertyCount;
+                }
+              }
+
+              // 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.
+              if( map->Count() == 1 && transformMap->Count() == sizeAndPositionPropertyCount )
+              {
+                sizeAndPositionOnly = true;
+              }
             }
           }
-          if( ! sizeOnly )
+          if( ! sizeAndPositionOnly )
           {
             // Only register a visual if there is more than just a size setting
             impl.mVisual = Toolkit::VisualFactory::Get().CreateVisual( *map );
index 7138a8e..7e77def 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_DEMO_INTERNAL_BEAT_CONTROL_IMPL_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 #include "beat-control.h"
 #include <dali/public-api/animation/animation.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/devel-api/align-enums.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
 
@@ -128,6 +129,8 @@ private:
   Dali::Animation mYAnimation;
   Dali::Animation mFadeAnimation;
   Dali::Vector2 mTransformSize;
+  Dali::Toolkit::Align::Type mTransformOrigin;
+  Dali::Toolkit::Align::Type mTransformAnchorPoint;
   int mAnimationPlaying;
 };
 
index 7094d14..87a69d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -124,7 +124,7 @@ void TransitionApplication::Create( Application& application )
     Property::Map map;
     CreateVisualMap( i, map );
     map.Add( DevelVisual::Property::TRANSFORM, Property::Map()
-             .Add( DevelVisual::Transform::Property::SIZE, Vector2(0.8f, 0.8f) ) );
+             .Add( DevelVisual::Transform::Property::SIZE, Vector2(0.8f, 0.8f) )  );
     mVisualButtons[i] = BeatControl::New();
     mVisualButtons[i].SetProperty( BeatControl::Property::BEAT_VISUAL, map );
     mVisualButtons[i].SetName("VisualButton");
index e9f5d79..6c30709 100755 (executable)
@@ -2,7 +2,7 @@
 
 Name:       com.samsung.dali-demo
 Summary:    The OpenGLES Canvas Core Demo
-Version:    1.2.42
+Version:    1.2.43
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
index fe1c128..dd5d467 100644 (file)
@@ -7,3 +7,4 @@ style-example-theme-two.json
 style-example-theme-one.json
 tooltip-example-theme.json
 basic-light-theme.json
+text-editor-example-theme.json
diff --git a/resources/style/mobile/text-editor-example-theme.json.in b/resources/style/mobile/text-editor-example-theme.json.in
new file mode 100644 (file)
index 0000000..48470b4
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.
+ *
+ */
+
+{
+  "styles":
+  {
+    "ScrollBar":
+    {
+      "indicatorShowDuration":1.0,
+      "indicatorHideDuration":1.0,
+      "background": {
+        "rendererType": "image",
+        "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png"
+        }
+    },
+    "ScrollBarIndicator":
+    {
+      "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png"
+    }
+  }
+}
diff --git a/resources/style/text-editor-example-theme.json.in b/resources/style/text-editor-example-theme.json.in
new file mode 100644 (file)
index 0000000..48470b4
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.
+ *
+ */
+
+{
+  "styles":
+  {
+    "ScrollBar":
+    {
+      "indicatorShowDuration":1.0,
+      "indicatorHideDuration":1.0,
+      "background": {
+        "rendererType": "image",
+        "url": "{APPLICATION_RESOURCE_PATH}/images/button-disabled.9.png"
+        }
+    },
+    "ScrollBarIndicator":
+    {
+      "resourceUrl":"{APPLICATION_RESOURCE_PATH}/images/button-white-up.9.png"
+    }
+  }
+}
index d19fb66..e9ab491 100644 (file)
@@ -206,9 +206,14 @@ namespace MultiLanguageStrings
       "(Xhosa)",
       "Molo Lizwe"
     },
+    {
+      "Amharic",
+      "(አማርኛ)",
+      "ያስገቡት PIN ትክክለኛ አይደለም። እባክዎ እንደገና ይሞክሩ።"
+    }
   };
 
-  const unsigned int NUMBER_OF_LANGUAGES = 35u;
+  const unsigned int NUMBER_OF_LANGUAGES = 36u;
 
 } // MultiLanguageStrings