Modified style sheets to use capitalized names for the styles to aid
readability.
Match algorithm changes control / style name to lower case, then
compares it to the style names that are also down-cased.
Change-Id: I048da5a7b8d00350669d11d797fab93f148dbdac
Signed-off-by: David Steele <david.steele@samsung.com>
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
*
* 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>
// EXTERNAL INCLUDES
#include <cstring>
// INTERNAL INCLUDES
#include "dali-toolkit/devel-api/builder/tree-node.h"
#include "dali-toolkit/internal/builder/tree-node-manipulator.h"
// 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
+
+
return mIntValue == 1 ? true : false;
}
return mIntValue == 1 ? true : false;
}
size_t TreeNode::Size() const
{
size_t c = 0;
size_t TreeNode::Size() const
{
size_t c = 0;
+
+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)
const TreeNode* TreeNode::Find(const std::string& childName) const
{
if(mName && std::string(mName) == childName)
#define __DALI_SCRIPT_TREE_NODE_H__
/*
#define __DALI_SCRIPT_TREE_NODE_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
bool HasSubstitution() const;
/*
bool HasSubstitution() const;
/*
- * Gets a child of the node
- * @param name The name of the child
+ * Gets a child of the node (using case sensitive matching)
+ * @param name The name of the child.
* @return The child if found, else NULL
*/
const TreeNode* GetChild(const std::string& name) const;
/*
* @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
* Recursively search for a child of the node
* @param name The name of the child
* @return The child if found, else NULL
#define __DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL__
/*
#define __DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+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 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 )
inline OptionalString IsString(const OptionalChild& node)
{
if( node && (*node).GetType() == TreeNode::STRING )
{
if( OptionalString styleName = IsString( (*iter).second ) )
{
{
if( OptionalString styleName = IsString( (*iter).second ) )
{
- if( OptionalChild node = IsChild( stylesCollection, *styleName) )
+ if( OptionalChild node = IsChildIgnoreCase( stylesCollection, *styleName) )
{
styleList.push_back( &(*node) );
{
styleList.push_back( &(*node) );
DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
OptionalChild styles = IsChild( *mParser.GetRoot(), KEYNAME_STYLES );
DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
OptionalChild styles = IsChild( *mParser.GetRoot(), KEYNAME_STYLES );
- OptionalChild style = IsChild( *styles, styleName );
+
+ std::string styleNameLower(styleName);
+ OptionalChild style = IsChildIgnoreCase( *styles, styleNameLower );
// todo Move this to adaptor??
#define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
// 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)
const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR( Dali::Vector4( 0.24f, 0.72f, 0.8f, 1.0f ) );
#if defined(DEBUG_ENABLED)
} // namespace Toolkit
} // namespace Dali
} // namespace Toolkit
} // namespace Dali
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const char* LANDSCAPE_QUALIFIER = "landscape";
const char* PORTRAIT_QUALIFIER = "portrait";
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";
const char* DEFAULT_THEME = DALI_STYLE_DIR "dali-toolkit-default-theme.json";
if( styleName.empty() )
{
if( styleName.empty() )
{
- // Convert control name to lower case
styleName = control.GetTypeName();
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)
}
// Apply the style after choosing the correct actual style (e.g. landscape or portrait)
{
"pointSize":108,
"enableAutoScroll":false,
{
"pointSize":108,
"enableAutoScroll":false,
{
"pointSize":120,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
{
"pointSize":120,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
{
"popupMaxSize":[1700,100],
"optionDividerSize":[2,0],
{
"popupMaxSize":[1700,100],
"optionDividerSize":[2,0],
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
- "textselectionpopupbutton":
+ "TextSelectionPopupButton":
"fontStyle":"{\"weight\":\"light\"}"
}
},
"fontStyle":"{\"weight\":\"light\"}"
}
},
- "textselectiontoolbar":
+ "TextSelectionToolbar":
{
"enableOvershoot":true,
"scrollView":
{
"enableOvershoot":true,
"scrollView":
"overshootSize":[1920.0,130.0]
}
},
"overshootSize":[1920.0,130.0]
}
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":960.0,
"overshootSize":[1920.0,130.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":960.0,
"overshootSize":[1920.0,130.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":960.0,
"overshootSize":[1920.0,130.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":960.0,
"overshootSize":[1920.0,130.0]
},
{
"pointSize":120,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
{
"pointSize":120,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
{
"pointSize":18,
"enableAutoScroll":false,
{
"pointSize":18,
"enableAutoScroll":false,
{
"unselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected.png",
"selectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected.png",
{
"unselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected.png",
"selectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected.png",
"disabledSelectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
},
"disabledSelectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
},
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
{
"popupMaxSize":[400,100],
"optionDividerSize":[2,0],
{
"popupMaxSize":[400,100],
"optionDividerSize":[2,0],
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
- "textselectionpopupbutton":
+ "TextSelectionPopupButton":
"fontStyle":"{\"weight\":\"light\"}"
}
},
"fontStyle":"{\"weight\":\"light\"}"
}
},
- "textselectiontoolbar":
+ "TextSelectionToolbar":
{
"enableOvershoot":true,
"scrollView":
{
"enableOvershoot":true,
"scrollView":
"overshootSize":[480.0,42.0]
}
},
"overshootSize":[480.0,42.0]
}
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":120.0,
"overshootSize":[480.0,42.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":120.0,
"overshootSize":[480.0,42.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":120.0,
"overshootSize":[480.0,42.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":120.0,
"overshootSize":[480.0,42.0]
},
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
{
"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" }
},
"selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
{
"showPopup": true,
"showValue": true,
{
"showPopup": true,
"showValue": true,
{
"pointSize":18,
"enableAutoScroll":false,
{
"pointSize":18,
"enableAutoScroll":false,
{
"unselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected.png",
"selectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected.png",
{
"unselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected.png",
"selectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected.png",
"disabledSelectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
},
"disabledSelectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
},
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
{
"popupMaxSize":[656,72],
"optionDividerSize":[2,0],
{
"popupMaxSize":[656,72],
"optionDividerSize":[2,0],
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
- "textselectionpopupbutton":
+ "TextSelectionPopupButton":
"fontStyle":"{\"weight\":\"light\"}"
}
},
"fontStyle":"{\"weight\":\"light\"}"
}
},
- "textselectiontoolbar":
+ "TextSelectionToolbar":
{
"enableOvershoot":true,
"scrollView":
{
"enableOvershoot":true,
"scrollView":
"overshootSize":[720.0,130.0]
}
},
"overshootSize":[720.0,130.0]
}
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":360.0,
"overshootSize":[720.0,130.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":360.0,
"overshootSize":[720.0,130.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":360.0,
"overshootSize":[720.0,130.0]
},
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":360.0,
"overshootSize":[720.0,130.0]
},
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
{
"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" }
},
"selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
{
"showPopup": true,
"showValue": true,
{
"showPopup": true,
"showValue": true,