Revert "[3.0] Changed styles to use case-insensitive matching" 43/97743/1
authordongsug.song <dongsug.song@samsung.com>
Tue, 15 Nov 2016 02:43:55 +0000 (11:43 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Tue, 15 Nov 2016 02:43:58 +0000 (11:43 +0900)
This reverts commit 800335ecf72d6813cccb0ceae9daad04dcfbd900.

Change-Id: I2ef573be163ef264e4fccfc90749af2cf9063498

dali-toolkit/devel-api/builder/tree-node.cpp
dali-toolkit/devel-api/builder/tree-node.h
dali-toolkit/internal/builder/builder-get-is.inl.h
dali-toolkit/internal/builder/builder-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/styling/style-manager-impl.cpp
dali-toolkit/styles/1920x1080/dali-toolkit-default-theme.json
dali-toolkit/styles/480x800/dali-toolkit-default-theme.json
dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json

index 6b0f6b3..302c7a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 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.
 
 // EXTERNAL INCLUDES
 #include <cstring>
-#include <algorithm>
 
 // INTERNAL INCLUDES
 #include "dali-toolkit/devel-api/builder/tree-node.h"
 #include "dali-toolkit/internal/builder/tree-node-manipulator.h"
 
-namespace
-{
-
-bool CaseInsensitiveCharacterCompare( unsigned char a, unsigned char b )
-{
-  // Converts to lower case in the current locale.
-  return std::tolower( a ) == std::tolower( b );
-}
-
-/**
- * return true if the lower cased ASCII strings are equal.
- */
-bool CaseInsensitiveStringCompare( const std::string& a, const std::string& b )
-{
-  bool result = false;
-  if( a.length() == b.length() )
-  {
-    result = std::equal( a.begin(), a.end(), b.begin(), CaseInsensitiveCharacterCompare );
-  }
-  return result;
-}
-
-} // anonymous namespace
-
-
 namespace Dali
 {
 
@@ -106,6 +80,7 @@ bool TreeNode::GetBoolean() const
   return mIntValue == 1 ? true : false;
 }
 
+
 size_t TreeNode::Size() const
 {
   size_t c = 0;
@@ -145,25 +120,6 @@ const TreeNode* TreeNode::GetChild(const std::string& childName) const
   return NULL;
 }
 
-
-const TreeNode* TreeNode::GetChildIgnoreCase(const std::string& childName) const
-{
-  const TreeNode* p = mFirstChild;
-  while(p)
-  {
-    if(p->mName)
-    {
-      std::string nodeName(p->mName);
-      if( CaseInsensitiveStringCompare( nodeName, childName) )
-      {
-        return p;
-      }
-    }
-    p = p->mNextSibling;
-  }
-  return NULL;
-}
-
 const TreeNode* TreeNode::Find(const std::string& childName) const
 {
   if(mName && std::string(mName) == childName)
index c63bf1f..3e47aea 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_SCRIPT_TREE_NODE_H__
 
 /*
- * Copyright (c) 2016 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.
@@ -182,20 +182,13 @@ public:
   bool HasSubstitution() const;
 
   /*
-   * Gets a child of the node (using case sensitive matching)
-   * @param name The name of the child.
+   * Gets a child of the node
+   * @param name The name of the child
    * @return The child if found, else NULL
    */
   const TreeNode* GetChild(const std::string& name) const;
 
   /*
-   * Gets a child of the node (using case insensitive matching)
-   * @param name The name of the child in lower case
-   * @return The child if found, else NULL
-   */
-  const TreeNode* GetChildIgnoreCase(const std::string& name) const;
-
-  /*
    * Recursively search for a child of the node
    * @param name The name of the child
    * @return The child if found, else NULL
index ae17837..d13b70b 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL__
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
@@ -41,36 +41,11 @@ inline OptionalChild IsChild(const TreeNode* node, const std::string& childName)
   }
 }
 
-inline OptionalChild IsChildIgnoreCase(const TreeNode* node, const std::string& childName)
-{
-  if( node )
-  {
-    const TreeNode* c = node->GetChildIgnoreCase(childName);
-    if( NULL != c )
-    {
-      return OptionalChild( *c );
-    }
-    else
-    {
-      return OptionalChild();
-    }
-  }
-  else
-  {
-    return OptionalChild();
-  }
-}
-
 inline OptionalChild IsChild(const TreeNode& node, const std::string& childName)
 {
   return IsChild(&node, childName);
 }
 
-inline OptionalChild IsChildIgnoreCase(const TreeNode& node, const std::string& childName)
-{
-  return IsChildIgnoreCase(&node, childName);
-}
-
 inline OptionalString IsString(const OptionalChild& node)
 {
   if( node && (*node).GetType() == TreeNode::STRING )
index 5afd53f..1d648c3 100644 (file)
@@ -117,7 +117,7 @@ void CollectAllStyles( const TreeNode& stylesCollection, const TreeNode& style,
     {
       if( OptionalString styleName = IsString( (*iter).second ) )
       {
-        if( OptionalChild node = IsChildIgnoreCase( stylesCollection, *styleName) )
+        if( OptionalChild node = IsChild( stylesCollection, *styleName) )
         {
           styleList.push_back( &(*node) );
 
@@ -1231,9 +1231,7 @@ bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Re
   DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
 
   OptionalChild styles = IsChild( *mParser.GetRoot(), KEYNAME_STYLES );
-
-  std::string styleNameLower(styleName);
-  OptionalChild style  = IsChildIgnoreCase( *styles, styleNameLower );
+  OptionalChild style  = IsChild( *styles, styleName );
 
   if( styles && style )
   {
index 2248668..1633dc9 100644 (file)
@@ -49,7 +49,7 @@ namespace
 // todo Move this to adaptor??
 #define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
 
-const std::string TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME( "TextSelectionPopupButton" );
+const std::string TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME( "textselectionpopupbutton" );
 const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR( Dali::Vector4( 0.24f, 0.72f, 0.8f, 1.0f ) );
 
 #if defined(DEBUG_ENABLED)
@@ -836,3 +836,5 @@ TextSelectionPopup::~TextSelectionPopup()
 } // namespace Toolkit
 
 } // namespace Dali
+
+
index af19622..71baa96 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
@@ -34,7 +34,7 @@ namespace
 
 const char* LANDSCAPE_QUALIFIER = "landscape";
 const char* PORTRAIT_QUALIFIER  = "portrait";
-const char* FONT_SIZE_QUALIFIER = "fontsize";
+const char* FONT_SIZE_QUALIFIER = "FontSize";
 
 const char* DEFAULT_THEME = DALI_STYLE_DIR "dali-toolkit-default-theme.json";
 
@@ -329,7 +329,9 @@ void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control contro
 
   if( styleName.empty() )
   {
+    // Convert control name to lower case
     styleName = control.GetTypeName();
+    std::transform( styleName.begin(), styleName.end(), styleName.begin(), ::tolower );
   }
 
   // Apply the style after choosing the correct actual style (e.g. landscape or portrait)
index 8f472d8..a6ded0d 100644 (file)
@@ -28,7 +28,7 @@
 {
   "styles":
   {
-    "TextLabel":
+    "textlabel":
     {
       "pointSize":108,
       "enableAutoScroll":false,
       "autoScrollSpeed":80
     },
 
-    "TextLabelFontSize0":
+    "textlabelFontSize0":
     {
       "pointSize":84
     },
-    "TextLabelFontSize1":
+    "textlabelFontSize1":
     {
       "pointSize":96
     },
-    "TextLabelFontSize2":
+    "textlabelFontSize2":
     {
       "pointSize":108
     },
-    "TextLabelFontSize3":
+    "textlabelFontSize3":
     {
       "pointSize":120
     },
-    "TextLabelFontSize4":
+    "textlabelFontSize4":
     {
       "pointSize":132
     },
 
-    "TextField":
+    "textfield":
     {
       "pointSize":120,
       "primaryCursorColor":[0.0,0.72,0.9,1.0],
       "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
     },
 
-    "TextFieldFontSize0":
+    "textfieldFontSize0":
     {
       "pointSize":120
     },
-    "TextFieldFontSize1":
+    "textfieldFontSize1":
     {
       "pointSize":120
     },
-    "TextFieldFontSize2":
+    "textfieldFontSize2":
     {
       "pointSize":120
     },
-    "TextFieldFontSize3":
+    "textfieldFontSize3":
     {
       "pointSize":120
     },
-    "TextFieldFontSize4":
+    "textfieldFontSize4":
     {
       "pointSize":120
     },
-    "TextSelectionPopup":
+    "textselectionpopup":
     {
       "popupMaxSize":[1700,100],
       "optionDividerSize":[2,0],
       "popupFadeInDuration":0.25,
       "popupFadeOutDuration":0.25
     },
-    "TextSelectionPopupButton":
+    "textselectionpopupbutton":
     {
       "label":
       {
         "fontStyle":"{\"weight\":\"light\"}"
       }
     },
-    "TextSelectionToolbar":
+    "textselectiontoolbar":
     {
       "enableOvershoot":true,
       "scrollView":
         "overshootSize":[1920.0,130.0]
       }
     },
-    "ScrollView":
+    "scrollview":
     {
       "overshootEffectColor":"B018",
       "overshootAnimationSpeed":960.0,
       "overshootSize":[1920.0,130.0]
     },
-    "ItemView":
+    "itemview":
     {
       "overshootEffectColor":"B018",
       "overshootAnimationSpeed":960.0,
       "overshootSize":[1920.0,130.0]
     },
-    "TextEditor":
+    "texteditor":
     {
       "pointSize":120,
       "primaryCursorColor":[0.0,0.72,0.9,1.0],
index 6d9eb61..fd8e1a4 100644 (file)
@@ -28,7 +28,7 @@
 {
   "styles":
   {
-    "TextLabel":
+    "textlabel":
     {
       "pointSize":18,
       "enableAutoScroll":false,
       "autoScrollSpeed":80
     },
 
-    "TextLabelFontSize0":
+    "textlabelFontSize0":
     {
       "pointSize":8
     },
-    "TextLabelFontSize1":
+    "textlabelFontSize1":
     {
       "pointSize":10
     },
-    "TextLabelFontSize2":
+    "textlabelFontSize2":
     {
       "pointSize":15
     },
-    "TextLabelFontSize3":
+    "textlabelFontSize3":
     {
       "pointSize":19
     },
-    "TextLabelFontSize4":
+    "textlabelFontSize4":
     {
       "pointSize":25
     },
-    "RadioButton":
+    "radiobutton":
     {
       "unselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected.png",
       "selectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected.png",
@@ -65,7 +65,7 @@
       "disabledSelectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
     },
 
-    "TextField":
+    "textfield":
     {
       "pointSize":18,
       "primaryCursorColor":[0.0,0.72,0.9,1.0],
       "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
     },
 
-    "TextFieldFontSize0":
+    "textfieldFontSize0":
     {
       "pointSize":10
     },
-    "TextFieldFontSize1":
+    "textfieldFontSize1":
     {
       "pointSize":10
     },
-    "TextFieldFontSize2":
+    "textfieldFontSize2":
     {
       "pointSize":10
     },
-    "TextFieldFontSize3":
+    "textfieldFontSize3":
     {
       "pointSize":10
     },
-    "TextFieldFontSize4":
+    "textfieldFontSize4":
     {
       "pointSize":10
     },
-    "TextSelectionPopup":
+    "textselectionpopup":
     {
       "popupMaxSize":[400,100],
       "optionDividerSize":[2,0],
       "popupFadeInDuration":0.25,
       "popupFadeOutDuration":0.25
     },
-    "TextSelectionPopupButton":
+    "textselectionpopupbutton":
     {
       "label":
       {
         "fontStyle":"{\"weight\":\"light\"}"
       }
     },
-    "TextSelectionToolbar":
+    "textselectiontoolbar":
     {
       "enableOvershoot":true,
       "scrollView":
         "overshootSize":[480.0,42.0]
       }
     },
-    "ScrollView":
+    "scrollview":
     {
       "overshootEffectColor":"B018",
       "overshootAnimationSpeed":120.0,
       "overshootSize":[480.0,42.0]
     },
-    "ItemView":
+    "itemview":
     {
       "overshootEffectColor":"B018",
       "overshootAnimationSpeed":120.0,
       "overshootSize":[480.0,42.0]
     },
-    "TextEditor":
+    "texteditor":
     {
       "pointSize":18,
       "primaryCursorColor":[0.0,0.72,0.9,1.0],
       "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
       "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
     },
-    "Popup":
+    "popup":
     {
       "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
     },
-    "ConfirmationPopup":
+    "confirmationpopup":
     {
       "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
     },
-    "Slider":
+    "slider":
     {
       "showPopup": true,
       "showValue": true,
index 25b2375..0a6f61f 100644 (file)
@@ -28,7 +28,7 @@
 {
   "styles":
   {
-    "TextLabel":
+    "textlabel":
     {
       "pointSize":18,
       "enableAutoScroll":false,
       "autoScrollSpeed":80
     },
 
-    "TextLabelFontSize0":
+    "textlabelFontSize0":
     {
       "pointSize":8
     },
-    "TextLabelFontSize1":
+    "textlabelFontSize1":
     {
       "pointSize":10
     },
-    "TextLabelFontSize2":
+    "textlabelFontSize2":
     {
       "pointSize":15
     },
-    "TextLabelFontSize3":
+    "textlabelFontSize3":
     {
       "pointSize":19
     },
-    "TextLabelFontSize4":
+    "textlabelFontSize4":
     {
       "pointSize":25
     },
-    "RadioButton":
+    "radiobutton":
     {
       "unselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected.png",
       "selectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected.png",
@@ -65,7 +65,7 @@
       "disabledSelectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
     },
 
-    "TextField":
+    "textfield":
     {
       "pointSize":18,
       "primaryCursorColor":[0.0,0.72,0.9,1.0],
       "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
     },
 
-    "TextFieldFontSize0":
+    "textfieldFontSize0":
     {
       "pointSize":10
     },
-    "TextFieldFontSize1":
+    "textfieldFontSize1":
     {
       "pointSize":10
     },
-    "TextFieldFontSize2":
+    "textfieldFontSize2":
     {
       "pointSize":10
     },
-    "TextFieldFontSize3":
+    "textfieldFontSize3":
     {
       "pointSize":10
     },
-    "TextFieldFontSize4":
+    "textfieldFontSize4":
     {
       "pointSize":10
     },
-    "TextSelectionPopup":
+    "textselectionpopup":
     {
       "popupMaxSize":[656,72],
       "optionDividerSize":[2,0],
       "popupFadeInDuration":0.25,
       "popupFadeOutDuration":0.25
     },
-    "TextSelectionPopupButton":
+    "textselectionpopupbutton":
     {
       "label":
       {
         "fontStyle":"{\"weight\":\"light\"}"
       }
     },
-    "TextSelectionToolbar":
+    "textselectiontoolbar":
     {
       "enableOvershoot":true,
       "scrollView":
         "overshootSize":[720.0,130.0]
       }
     },
-    "ScrollView":
+    "scrollview":
     {
       "overshootEffectColor":"B018",
       "overshootAnimationSpeed":360.0,
       "overshootSize":[720.0,130.0]
     },
-    "ItemView":
+    "itemview":
     {
       "overshootEffectColor":"B018",
       "overshootAnimationSpeed":360.0,
       "overshootSize":[720.0,130.0]
     },
-    "TextEditor":
+    "texteditor":
     {
       "pointSize":18,
       "primaryCursorColor":[0.0,0.72,0.9,1.0],
       "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
       "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
     },
-    "Popup":
+    "popup":
     {
       "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
     },
-    "ConfirmationPopup":
+    "confirmationpopup":
     {
       "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
     },
-    "Slider":
+    "slider":
     {
       "showPopup": true,
       "showValue": true,