From: Adeel Kazmi Date: Wed, 28 May 2014 17:38:58 +0000 (+0900) Subject: Revert "[SRUK] (StyleManager) Create a style manager" X-Git-Tag: dali_1.0.0~82 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=d725a0d2d6b11eff469c9a4d2c13df9e00e6b85f Revert "[SRUK] (StyleManager) Create a style manager" Font change no longer delivered. This reverts commit 9df291f3bec83cbbe26ae2d9b988e688d27a8b84. Change-Id: I44fc0574eb11bac748437f8c78b1502d80effca8 --- diff --git a/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt b/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt index a1e6c7f..46af2cd 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt @@ -49,7 +49,6 @@ SET(TC_SOURCES utc-Dali-KeyboardFocusManager.cpp utc-Dali-ScrollViewEffect.cpp utc-Dali-TextInput.cpp - utc-Dali-StyleManager.cpp ) # Append list of test harness files (Won't get parsed for test cases) diff --git a/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.h b/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.h index 528e51e..f3a27c4 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.h +++ b/automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.h @@ -81,8 +81,6 @@ extern void dali_keyboard_focus_manager_startup(void); extern void dali_keyboard_focus_manager_cleanup(void); extern void dali_scroll_view_effect_startup(void); extern void dali_scroll_view_effect_cleanup(void); -extern void dali_style_manager_startup(void); -extern void dali_style_manager_cleanup(void); extern int UtcDaliAlbumLayoutNew(void); extern int UtcDaliAlbumSetAndGetItemSizeFunction(void); @@ -396,10 +394,6 @@ extern int UtcDaliTextInputGetStyleAtCursor(void); extern int UtcDaliTextInputSetAndGetTextAlignment(void); extern int UtcDaliTextInputSetAndGetMultilinePolicy(void); extern int UtcDaliTextInputSetAndGetExceedEnabled(void); -extern int UtcDaliStyleManagerGet(void); -extern int UtcDaliStyleManagerSetOrientationValue(void); -extern int UtcDaliStyleManagerSetOrientation(void); -extern int UtcDaliStyleManagerSetStyleConstant(void); testcase tc_array[] = { {"UtcDaliAlbumLayoutNew", UtcDaliAlbumLayoutNew, album_layout_startup, album_layout_cleanup}, @@ -714,10 +708,6 @@ testcase tc_array[] = { {"UtcDaliTextInputSetAndGetTextAlignment", UtcDaliTextInputSetAndGetTextAlignment, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, {"UtcDaliTextInputSetAndGetMultilinePolicy", UtcDaliTextInputSetAndGetMultilinePolicy, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, {"UtcDaliTextInputSetAndGetExceedEnabled", UtcDaliTextInputSetAndGetExceedEnabled, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup}, - {"UtcDaliStyleManagerGet", UtcDaliStyleManagerGet, dali_style_manager_startup, dali_style_manager_cleanup}, - {"UtcDaliStyleManagerSetOrientationValue", UtcDaliStyleManagerSetOrientationValue, dali_style_manager_startup, dali_style_manager_cleanup}, - {"UtcDaliStyleManagerSetOrientation", UtcDaliStyleManagerSetOrientation, dali_style_manager_startup, dali_style_manager_cleanup}, - {"UtcDaliStyleManagerSetStyleConstant", UtcDaliStyleManagerSetStyleConstant, dali_style_manager_startup, dali_style_manager_cleanup}, {NULL, NULL} }; diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-StyleManager.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-StyleManager.cpp deleted file mode 100644 index c49762f..0000000 --- a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-StyleManager.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// - -#include -#include -#include -#include -#include -#include - - -using namespace Dali; -using namespace Dali::Toolkit; - -void dali_style_manager_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void dali_style_manager_cleanup(void) -{ - test_return_value = TET_PASS; -} - -int UtcDaliStyleManagerGet(void) -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliStyleManagerGet"); - - // Register Type - TypeInfo type; - type = TypeRegistry::Get().GetTypeInfo( "StyleManager" ); - DALI_TEST_CHECK( type ); - BaseHandle handle = type.CreateInstance(); - DALI_TEST_CHECK( handle ); - - StyleManager manager; - - manager = StyleManager::Get(); - DALI_TEST_CHECK(manager); - - StyleManager newManager = StyleManager::Get(); - DALI_TEST_CHECK(newManager); - - // Check that focus manager is a singleton - DALI_TEST_CHECK(manager == newManager); - END_TEST; -} - -int UtcDaliStyleManagerSetOrientationValue(void) -{ - ToolkitTestApplication application; - - tet_infoline( " UtcDaliStyleManagerSetOrientationValue" ); - - StyleManager manager = StyleManager::Get(); - - int orientation1 = 0; - manager.SetOrientationValue( orientation1 ); - DALI_TEST_CHECK( manager.GetOrientationValue() == orientation1 ); - - int orientation2 = 180; - manager.SetOrientationValue( orientation2 ); - DALI_TEST_CHECK( manager.GetOrientationValue() == orientation2 ); - - END_TEST; -} - -int UtcDaliStyleManagerSetOrientation(void) -{ - ToolkitTestApplication application; - - tet_infoline( " UtcDaliStyleManagerSetOrientation" ); - - StyleManager manager = StyleManager::Get(); - - Orientation orientation; - - manager.SetOrientation( orientation ); - - DALI_TEST_CHECK( manager.GetOrientation() == orientation ); - - END_TEST; -} - -int UtcDaliStyleManagerSetStyleConstant(void) -{ - ToolkitTestApplication application; - - tet_infoline( " UtcDaliStyleManagerSetStyleConstant" ); - - StyleManager manager = StyleManager::Get(); - - std::string key( "key" ); - Property::Value value( 100 ); - - manager.SetStyleConstant( key, value ); - - Property::Value returnedValue; - manager.GetStyleConstant( key, returnedValue ); - - DALI_TEST_CHECK( value.Get() == returnedValue.Get() ); - - std::string key2( "key2" ); - Property::Value returnedValue2; - DALI_TEST_CHECK( !manager.GetStyleConstant( key2, returnedValue2 ) ); - - END_TEST; -} diff --git a/base/dali-toolkit/internal/controls/alignment/alignment-impl.cpp b/base/dali-toolkit/internal/controls/alignment/alignment-impl.cpp index 1514358..e661a87 100644 --- a/base/dali-toolkit/internal/controls/alignment/alignment-impl.cpp +++ b/base/dali-toolkit/internal/controls/alignment/alignment-impl.cpp @@ -623,7 +623,7 @@ void Alignment::OnRelaidOut( Vector2 size, ActorSizeContainer& container ) } Alignment::Alignment( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical ) -: Control( CONTROL_BEHAVIOUR_NONE ), +: Control( false ), // doesn't require touch events mHorizontal( horizontal ), mVertical( vertical ), mScaling( Toolkit::Alignment::ScaleNone ), diff --git a/base/dali-toolkit/internal/controls/buttons/button-impl.cpp b/base/dali-toolkit/internal/controls/buttons/button-impl.cpp index 941ebcc..8536b0b 100644 --- a/base/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/base/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -52,7 +52,7 @@ PropertyRegistration property1( typeRegistration, "dimmed", Toolkit::Button::PRO } // unnamed namespace Button::Button() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ), +: Control( true ), mState( ButtonUp ), mDimmed( false ), mPainter( NULL ) diff --git a/base/dali-toolkit/internal/controls/popup/popup-impl.cpp b/base/dali-toolkit/internal/controls/popup/popup-impl.cpp index 7f3b7c0..47995d4 100755 --- a/base/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/base/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -169,7 +169,7 @@ Dali::Toolkit::Popup Popup::New() } Popup::Popup(PopupStyle& style) -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ), +: Control(true), mShowing(false), mState(Toolkit::Popup::POPUP_NONE), // Initially, the popup state should not be set, it's set in OnInitialize mAlterAddedChild(false), diff --git a/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp index 6c4da93..451895c 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp @@ -61,7 +61,7 @@ const Vector4 Scrollable::DEFAULT_OVERSHOOT_COLOUR(0.0f, 0.64f, 0.85f, 0.6f) /////////////////////////////////////////////////////////////////////////////////////////////////// Scrollable::Scrollable() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ), +: Control(true/*requires touch*/), mPropertyRelativePosition(Property::INVALID_INDEX), mPropertyPositionMin(Property::INVALID_INDEX), mPropertyPositionMax(Property::INVALID_INDEX), diff --git a/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp b/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp index fff8bc4..e2970cc 100644 --- a/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp @@ -794,7 +794,7 @@ void TableView::OnControlChildRemove( Actor& child ) } TableView::TableView( unsigned int initialRows, unsigned int initialColumns ) -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ), +: Control( true ), // requires touch mCellData( initialRows, initialColumns ), mLayoutingChild( false ), mConstraintDuration( DEFAULT_CONSTRAINT_DURATION ) diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp b/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp index 3d79aad..557e2fd 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp @@ -269,7 +269,7 @@ Dali::Toolkit::TextInput TextInput::New() } TextInput::TextInput() -:Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ), +:Control( true ), mState( StateEdit ), mStyledText(), mInputStyle(), diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp index 78c4980..16a8305 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp @@ -1009,7 +1009,7 @@ TextView::RelayoutData& TextView::RelayoutData::operator=( const TextView::Relay } TextView::TextView() -: Control( REQUIRES_THEME_CHANGE_SIGNALS ), +: Control( false ), // doesn't require touch events mCurrentStyledText(), mTextViewProcessorOperations(), mLayoutParameters( Toolkit::TextView::SplitByNewLineChar, diff --git a/base/dali-toolkit/internal/file.list b/base/dali-toolkit/internal/file.list index e09586d..1fa0e57 100644 --- a/base/dali-toolkit/internal/file.list +++ b/base/dali-toolkit/internal/file.list @@ -4,6 +4,7 @@ toolkit_base_src_files = \ $(toolkit_base_src_dir)/controls/relayout-controller.cpp \ $(toolkit_base_src_dir)/controls/relayout-controller-impl.cpp \ $(toolkit_base_src_dir)/controls/relayout-helper.cpp \ + $(toolkit_base_src_dir)/controls/style-change-processor.cpp \ $(toolkit_base_src_dir)/controls/alignment/alignment-impl.cpp \ $(toolkit_base_src_dir)/controls/buttons/button-impl.cpp \ $(toolkit_base_src_dir)/controls/buttons/check-box-button-default-painter-impl.cpp \ @@ -55,14 +56,4 @@ toolkit_base_src_files = \ $(toolkit_base_src_dir)/factory/localized-control-factory-impl.cpp \ $(toolkit_base_src_dir)/focus-manager/focus-manager-impl.cpp \ $(toolkit_base_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \ - $(toolkit_base_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp \ - $(toolkit_base_src_dir)/styling/style-manager-impl.cpp \ - $(toolkit_base_src_dir)/builder/builder-impl.cpp \ - $(toolkit_base_src_dir)/builder/builder-animations.cpp \ - $(toolkit_base_src_dir)/builder/builder-set-property.cpp \ - $(toolkit_base_src_dir)/builder/builder-signals.cpp \ - $(toolkit_base_src_dir)/builder/builder-actor.cpp \ - $(toolkit_base_src_dir)/builder/json-parser-state.cpp \ - $(toolkit_base_src_dir)/builder/json-parser-impl.cpp \ - $(toolkit_base_src_dir)/builder/tree-node-manipulator.cpp \ - $(toolkit_base_src_dir)/builder/replacement.cpp + $(toolkit_base_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp diff --git a/base/dali-toolkit/internal/styling/style-manager-impl.cpp b/base/dali-toolkit/internal/styling/style-manager-impl.cpp deleted file mode 100644 index 56b97f8..0000000 --- a/base/dali-toolkit/internal/styling/style-manager-impl.cpp +++ /dev/null @@ -1,394 +0,0 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// - -// CLASS HEADER -#include "style-manager-impl.h" - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include - -// EXTERNAL INCLUDES -#include -#include -#include - - -namespace -{ - -const char* LANDSCAPE_QUALIFIER = "landscape"; -const char* PORTRAIT_QUALIFIER = "portrait"; - -const char* DEFAULT_THEME = DALI_STYLE_DIR "tizen-default-theme.json"; - -const char* PACKAGE_PATH_KEY = "PACKAGE_PATH"; -const char* DEFAULT_PACKAGE_PATH = DALI_DATA_READ_ONLY_DIR "/toolkit/"; - -} // namespace - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -namespace -{ - -BaseHandle Create() -{ - BaseHandle handle = StyleManager::Get(); - - if ( !handle && Adaptor::IsAvailable() ) - { - Toolkit::StyleManager manager = Toolkit::StyleManager( new Internal::StyleManager() ); - Adaptor::Get().RegisterSingleton( typeid( manager ), manager ); - handle = manager; - } - - return handle; -} -TypeRegistration STYLE_MANAGER_TYPE( typeid(Dali::Toolkit::StyleManager), typeid(Dali::BaseHandle), Create, true /* Create instance at startup */ ); - -/** - * Merge two maps into one - */ -void MergeMaps( const PropertyValueMap& a, const PropertyValueMap& b, PropertyValueMap& out ) -{ - out = a; - for( PropertyValueMap::const_iterator it = b.begin(), itEnd = b.end(); it != itEnd; ++it ) - { - out[ it->first ] = it->second; - } -} - -} // namespace - -Toolkit::StyleManager StyleManager::Get() -{ - Toolkit::StyleManager manager; - - if ( Adaptor::IsAvailable() ) - { - // Check whether the style manager is already created - Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Toolkit::StyleManager ) ); - if( handle ) - { - // If so, downcast the handle of singleton - manager = Toolkit::StyleManager( dynamic_cast< StyleManager* >( handle.GetObjectPtr() ) ); - } - } - - return manager; -} - -StyleManager::StyleManager() - : mOrientationDegrees( 0 ), // Portrait - mSetThemeConnection( false ) -{ - // Add theme builder constants - mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH; - - RequestDefaultTheme(); -} - -StyleManager::~StyleManager() -{ - // Disconnect from signal - SetOrientation( Orientation() ); -} - -void StyleManager::SetOrientationValue( int orientation ) -{ - mOrientationDegrees = orientation; - - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; -} - -int StyleManager::GetOrientationValue() -{ - return mOrientationDegrees; -} - -void StyleManager::SetOrientation( Orientation orientation ) -{ - if( mOrientation ) - { - mOrientation.ChangedSignal().Disconnect( this, &StyleManager::OnOrientationChanged ); - } - - OnOrientationChanged( orientation ); - - if( mOrientation ) - { - mOrientation.ChangedSignal().Connect( this, &StyleManager::OnOrientationChanged ); - } -} - -Orientation StyleManager::GetOrientation() -{ - return mOrientation; -} - -void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value ) -{ - mStyleBuilderConstants[ key ] = value; -} - -bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& valueOut ) -{ - Toolkit::PropertyValueMap::iterator valueIt = mStyleBuilderConstants.find( key ); - if( valueIt != mStyleBuilderConstants.end() ) - { - valueOut = valueIt->second; - return true; - } - - return false; -} - -void StyleManager::OnOrientationChanged( Orientation orientation ) -{ - mOrientation = orientation; - - if( mOrientation ) - { - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; - } -} - -Toolkit::Builder StyleManager::CreateBuilder( const PropertyValueMap& constants ) -{ - Toolkit::Builder builder = Toolkit::Builder::New(); - builder.AddConstants( constants ); - - return builder; -} - -bool StyleManager::LoadJSON( Toolkit::Builder builder, const std::string& jsonFilePath ) -{ - std::string fileString; - if( LoadFile( jsonFilePath, fileString ) ) - { - builder.LoadFromString( fileString ); - return true; - } - else - { - DALI_LOG_WARNING("Error loading file '%s'\n", jsonFilePath.c_str()); - return false; - } -} - -void StyleManager::CollectQualifiers( StringList& qualifiersOut ) -{ - // Append the relevant qualifier for orientation - int orientation = mOrientationDegrees; - - if( mOrientation ) - { - orientation = mOrientation.GetDegrees(); - } - - switch( orientation ) - { - case 90: - case 270: - { - qualifiersOut.push_back( std::string( LANDSCAPE_QUALIFIER ) ); - break; - } - case 180: - case 0: // fall through - default: - { - qualifiersOut.push_back( std::string( PORTRAIT_QUALIFIER ) ); - break; - } - } -} - -void StyleManager::BuildQualifiedStyleName( const std::string& styleName, const StringList& qualifiers, std::string& qualifiedStyleOut ) -{ - qualifiedStyleOut.append( styleName ); - - for( StringList::const_iterator it = qualifiers.begin(), itEnd = qualifiers.end(); it != itEnd; ++it ) - { - const std::string& str = *it; - - qualifiedStyleOut.append( "-" ); - qualifiedStyleOut.append( str ); - } -} - -void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control control ) -{ - // Convert control name to lower case - std::string 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) - StringList qualifiers; - CollectQualifiers( qualifiers ); - - while( true ) - { - std::string qualifiedStyleName; - BuildQualifiedStyleName( styleName, qualifiers, qualifiedStyleName ); - - // Break if style found or we have tried the root style name (qualifiers is empty) - if( builder.ApplyStyle( qualifiedStyleName, control ) || qualifiers.size() == 0 ) - { - break; - } - - // Remove the last qualifier in an attempt to find a style that is valid - qualifiers.pop_back(); - } -} - -void StyleManager::ApplyThemeStyle( Toolkit::Control control ) -{ - if( mThemeBuilder ) - { - ApplyStyle( mThemeBuilder, control ); - } -} - -void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName ) -{ - bool builderReady = false; - - // First look in the cache - Toolkit::Builder builder = FindCachedBuilder( jsonFileName ); - if( builder ) - { - builderReady = true; - } - else - { - // Merge theme and style constants - PropertyValueMap constants; - MergeMaps( mThemeBuilderConstants, mStyleBuilderConstants, constants ); - - // Create it - builder = CreateBuilder( constants ); - - if( LoadJSON( builder, jsonFileName ) ) - { - CacheBuilder( builder, jsonFileName ); - builderReady = true; - } - } - - // Apply the style to the control - if( builderReady ) - { - builder.ApplyStyle( styleName, control ); - } -} - -bool StyleManager::LoadFile( const std::string& filename, std::string& stringOut ) -{ - DALI_ASSERT_DEBUG( 0 != filename.length()); - - std::ifstream in( filename.c_str(), std::ios::in ); - if( in ) - { - std::stringstream buffer; - buffer << in.rdbuf(); - - stringOut = buffer.str(); - - in.close(); - - return true; - } - - return false; -} - -Toolkit::StyleManager::ThemeChangeSignalType& StyleManager::ThemeChangeSignal() -{ - return mThemeChangeSignal; -} - -void StyleManager::EmitThemeChangeSignal() -{ - if( !mThemeChangeSignal.Empty() ) - { - mThemeChangeSignal.Emit( Toolkit::StyleManager::Get() ); - } -} - -void StyleManager::RequestThemeChange( const std::string& themeFile ) -{ - mThemeFile = themeFile; - - Util::ConnectEventProcessingFinishedSignal(); - mSetThemeConnection = true; -} - -void StyleManager::RequestDefaultTheme() -{ - RequestThemeChange( DEFAULT_THEME ); -} - -bool StyleManager::IsThemeRequestPending() -{ - return mSetThemeConnection; -} - -void StyleManager::SetTheme() -{ - mThemeBuilder = CreateBuilder( mThemeBuilderConstants ); - LoadJSON( mThemeBuilder, mThemeFile ); - - mSetThemeConnection = false; - - EmitThemeChangeSignal(); -} - -Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key ) -{ - BuilderMap::iterator builderIt = mBuilderCache.find( key ); - if( builderIt != mBuilderCache.end() ) - { - return builderIt->second; - } - - return Toolkit::Builder(); -} - -void StyleManager::CacheBuilder( Toolkit::Builder builder, const std::string& key ) -{ - mBuilderCache[ key ] = builder; -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/base/dali-toolkit/internal/styling/style-manager-impl.h b/base/dali-toolkit/internal/styling/style-manager-impl.h deleted file mode 100644 index 2c15f89..0000000 --- a/base/dali-toolkit/internal/styling/style-manager-impl.h +++ /dev/null @@ -1,276 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__ -#define __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__ - -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// - -// EXTERNAL INCLUDES -#include -#include - -// INTERNAL INCLUDES - -#include -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ -/** - * @copydoc Toolkit::StyleManager - */ -class StyleManager : public Dali::BaseObject, public ConnectionTracker -{ -public: - - /** - * Singleton access - * - * @return The StyleManager object - */ - static Toolkit::StyleManager Get(); - - /** - * Construct a new StyleManager. - */ - StyleManager(); - - /** - * @copydoc Toolkit::StyleManager::SetOrientationValue - */ - void SetOrientationValue( int orientation ); - - /** - * @copydoc Toolkit::StyleManager::GetOrientationValue - */ - int GetOrientationValue(); - - /** - * @copydoc Toolkit::StyleManager::SetOrientation( Orientation orientation ) - */ - void SetOrientation( Orientation orientation ); - - /** - * @copydoc Toolkit::StyleManager::GetOrientation - */ - Orientation GetOrientation(); - - /** - * @copydoc Toolkit::StyleManager::SetStyleConstant - */ - void SetStyleConstant( const std::string& key, const Property::Value& value ); - - /** - * @copydoc Toolkit::StyleManager::GetStyleConstant - */ - bool GetStyleConstant( const std::string& key, Property::Value& valueOut ); - - /** - * @copydoc Toolkit::StyleManager::RequestThemeChange - */ - void RequestThemeChange( const std::string& themeFile ); - - /** - * @copydoc Toolkit::StyleManager::RequestDefaultTheme - */ - void RequestDefaultTheme(); - - /** - * Determine if a theme change has been requested - * @return Whether a theme request is pending - */ - bool IsThemeRequestPending(); - - /** - * @brief Apply the theme style to a control. - * - * @param[in] control The control to apply style. - */ - void ApplyThemeStyle( Toolkit::Control control ); - - /** - * @copydoc Toolkit::StyleManager::ApplyStyle - */ - void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName ); - -public: - // SIGNALS - - /** - * @copydoc Toolkit::StyleManager::ThemeChangeSignal - */ - Toolkit::StyleManager::ThemeChangeSignalType& ThemeChangeSignal(); - -protected: - - /** - * @brief Destructor - */ - virtual ~StyleManager(); - - -public: - - /** - * @brief Set the current theme. Called only once per event processing cycle. - */ - void SetTheme(); - -private: - - typedef std::list StringList; - - /** - * @brief Internal helper method to read a file from file system. - * @param filename The name of the file to read. - * @param[out] stringOut The string to return the file in - * - * @param Return true if file was found - */ - bool LoadFile(const std::string& filename, std::string& stringOut); - - /** - * @brief Create a new builder. - * - * @param[in] constants A map of constants to be used by the builder - * - * @return Return the newly created builder - */ - Toolkit::Builder CreateBuilder( const PropertyValueMap& constants ); - - /** - * @brief Load a JSON file into given builder - * - * @param[in] builder The builder object to load the theme file - * @param[in] jsonFileName The name of the JSON file to load - * @return Return true if file was loaded - */ - bool LoadJSON( Toolkit::Builder builder, const std::string& jsonFileName ); - - /** - * @brief Collect qualifiers (e.g. Landscape, portrait etc) for a given style - * - * @param[in,out] qualifiersOut The list to populate with qualifiers - */ - void CollectQualifiers( StringList& qualifiersOut ); - - /** - * @brief Construct a qualified style name out of qualifiers - * - * A qualifed style name will be in the format: style-qualifier0-qualifier1-qualifierN - * - * @param[in] styleName The root name of the style - * @param[in] qualifiers List of qualifier names - * @param[out] qualifiedStyleOut The qualified style name - */ - void BuildQualifiedStyleName( const std::string& styleName, const StringList& qualifiers, std::string& qualifiedStyleOut ); - - /** - * @brief Apply a style to the control using the given builder - * - * @param[in] builder The builder to apply the style from - * @param[in] control The control to apply the style to - */ - void ApplyStyle( Toolkit::Builder builder, Toolkit::Control control ); - - /** - * @brief Emit theme changed signal - */ - void EmitThemeChangeSignal(); - - /** - * @brief Callback for orientation changes - * - * @param[in] orientation The orientation object - */ - void OnOrientationChanged( Orientation orientation ); - - /** - * Search for a builder in the cache - * - * @param[in] key The key the builder was cached under - * @return Return the cached builder if found or an empty builder object if not found - */ - Toolkit::Builder FindCachedBuilder( const std::string& key ); - - /** - * Store a given builder in the cache keyed to the given key - * - * @param[in] builder The builder object to store - * @param[in] key The key to store the builder under - */ - void CacheBuilder( Toolkit::Builder builder, const std::string& key ); - - // Undefined - StyleManager(const StyleManager&); - - StyleManager& operator=(const StyleManager& rhs); - -private: - - // Map to store builders keyed by JSON file name - typedef std::map< std::string, Toolkit::Builder > BuilderMap; - - Toolkit::Builder mThemeBuilder; ///< Builder for all default theme properties - - Orientation mOrientation; ///< Handle to application orientation object - int mOrientationDegrees; ///< Directly set value of orientation - - std::string mThemeFile; ///< The full path of the current theme file - - Toolkit::PropertyValueMap mThemeBuilderConstants; ///< Contants to give the theme builder - Toolkit::PropertyValueMap mStyleBuilderConstants; ///< Constants specific to building styles - - BuilderMap mBuilderCache; ///< Cache of builders keyed by JSON file name - - bool mSetThemeConnection; ///< Has the callback to set the theme been set - - // Signals - Toolkit::StyleManager::ThemeChangeSignalType mThemeChangeSignal; ///< Emitted when the theme changes -}; - -} // namespace Internal - -inline Internal::StyleManager& GetImpl( Dali::Toolkit::StyleManager& obj ) -{ - DALI_ASSERT_ALWAYS( obj ); - - Dali::BaseObject& handle = obj.GetBaseObject(); - - return static_cast< Internal::StyleManager& >( handle ); -} - -inline const Internal::StyleManager& GetImpl( const Dali::Toolkit::StyleManager& obj ) -{ - DALI_ASSERT_ALWAYS( obj ); - - const Dali::BaseObject& handle = obj.GetBaseObject(); - - return static_cast< const Internal::StyleManager& >( handle ); -} - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__ - diff --git a/base/dali-toolkit/internal/styling/util.h b/base/dali-toolkit/internal/styling/util.h deleted file mode 100644 index 61901fe..0000000 --- a/base/dali-toolkit/internal/styling/util.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_UTIL_H__ -#define __DALI_TOOLKIT_INTERNAL_UTIL_H__ - -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES - -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -namespace Util -{ - -/** - * @brief Callback that the EventProcessingFinishedSignal signal calls - * - * Priorities calls to managers - */ -inline void EventProcessingFinishedSignalPrioritizer() -{ - // Priority 0: Set all styles - Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); - if( GetImpl(styleManager).IsThemeRequestPending() ) - { - GetImpl(styleManager).SetTheme(); - } - - // Todo: Priority 1: Do relayout after styles have been set -} - -/** - * @brief Connect to the EventProcessingFinishedSignal - * - * Needs to be called only once, but will still operate successfully if called multiple times. - * Makes the assumption that this is the only thing connecting to the EventProcessingFinishedSignal. - */ -inline void ConnectEventProcessingFinishedSignal() -{ - Stage stage = Stage::GetCurrent(); - - // This is only intended for one purpose! - if( stage.EventProcessingFinishedSignal().GetConnectionCount() == 0 ) - { - stage.EventProcessingFinishedSignal().Connect( &EventProcessingFinishedSignalPrioritizer ); - } -} - -} // namespace Util - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__ - diff --git a/base/dali-toolkit/public-api/controls/control-impl.cpp b/base/dali-toolkit/public-api/controls/control-impl.cpp index 018e4f0..9347f6a 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.cpp +++ b/base/dali-toolkit/public-api/controls/control-impl.cpp @@ -21,15 +21,13 @@ #include +#include "dali-toolkit/internal/controls/style-change-processor.h" #include "dali-toolkit/internal/controls/relayout-controller.h" #include "dali-toolkit/internal/controls/relayout-helper.h" #include "dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h" #include "dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h" #include -#include -#include - namespace Dali { @@ -255,8 +253,7 @@ public: mIsKeyboardNavigationSupported(false), mIsKeyboardFocusGroup(false), mKeyEventSignalV2(), - mBackground( NULL ), - mFlags( Control::CONTROL_BEHAVIOUR_NONE ) + mBackground( NULL ) { } @@ -531,8 +528,6 @@ public: // Background Background* mBackground; ///< Only create the background if we use it - ControlBehaviour mFlags; ///< Flags passed in from constructor - // Properties - these need to be members of Internal::Control::Impl as they need to functions within this class. static PropertyRegistration PROPERTY_1; static PropertyRegistration PROPERTY_2; @@ -554,7 +549,7 @@ PropertyRegistration Control::Impl::PROPERTY_7( CONTROL_TYPE, "key-input-focus", Toolkit::Control Control::New() { // Create the implementation, temporarily owned on stack - IntrusivePtr controlImpl = new Control( CONTROL_BEHAVIOUR_NONE ); + IntrusivePtr controlImpl = new Control( false ); // Pass ownership to handle Toolkit::Control handle( *controlImpl ); @@ -568,26 +563,22 @@ Toolkit::Control Control::New() Control::~Control() { + if( mImpl->mInitialized ) + { + // Unregister only if control has been initialized. + Internal::StyleChangeProcessor::Unregister( this ); + } delete mImpl; } void Control::Initialize() { + // Register with the style change processor so we are informed when the default style changes + Internal::StyleChangeProcessor::Register( this ); // Calling deriving classes OnInitialize(); - if( mImpl->mFlags & REQUIRES_THEME_CHANGE_SIGNALS ) - { - Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); - - // Register for font/theme changes - styleManager.ThemeChangeSignal().Connect( this, &ControlImpl::OnThemeChange ); - - // Set theme - GetImpl( styleManager ).ApplyThemeStyle( GetOwner() ); - } - mImpl->mInitialized = true; } @@ -1184,11 +1175,6 @@ void Control::NegotiateSize( Vector2 allocatedSize, ActorSizeContainer& containe Relayout( size, container ); } -void Control::OnThemeChange( Toolkit::StyleManager styleManager ) -{ - GetImpl( styleManager ).ApplyThemeStyle( GetOwner() ); -} - bool Control::EmitKeyEventSignal( const KeyEvent& event ) { // Guard against destruction during signal emission @@ -1232,13 +1218,6 @@ Control::Control( bool requiresTouchEvents ) { } -Control::Control( ControlBehaviour behaviourFlags ) -: CustomActorImpl( behaviourFlags & REQUIRES_TOUCH_EVENTS ), - mImpl(new Impl(*this)) -{ - mImpl->mFlags = behaviourFlags; -} - } // namespace Internal } // namespace Toolkit diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.cpp b/base/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.cpp index 2b089f7..3cd35d4 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.cpp +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.cpp @@ -54,7 +54,7 @@ Toolkit::ScrollConnector ScrollComponentImpl::GetScrollConnector() const } ScrollComponentImpl::ScrollComponentImpl() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ) +: Control(true/*requires touch*/) { } diff --git a/base/dali-toolkit/public-api/file.list b/base/dali-toolkit/public-api/file.list index 089896c..dbca37b 100755 --- a/base/dali-toolkit/public-api/file.list +++ b/base/dali-toolkit/public-api/file.list @@ -48,11 +48,7 @@ public_api_base_src_files = \ $(public_api_base_src_dir)/focus-manager/keyinput-focus-manager.cpp \ $(public_api_base_src_dir)/markup-processor/markup-processor.cpp \ $(public_api_base_src_dir)/shader-effects/image-region-effect.cpp \ - $(public_api_base_src_dir)/shader-effects/bouncing-effect.cpp \ - $(public_api_base_src_dir)/styling/style-manager.cpp \ - $(public_api_base_src_dir)/builder/builder.cpp \ - $(public_api_base_src_dir)/builder/json-parser.cpp \ - $(public_api_base_src_dir)/builder/tree-node.cpp + $(public_api_base_src_dir)/shader-effects/bouncing-effect.cpp # Add public header files here @@ -105,12 +101,3 @@ public_api_base_markup_processor_header_files = public_api_base_shader_effects_header_files = \ $(public_api_base_src_dir)/shader-effects/bouncing-effect.h -public_api_base_styling_header_files = \ - $(public_api_base_src_dir)/styling/style-manager.h - -public_api_base_builder_header_files = \ - $(public_api_base_src_dir)/builder/builder.h \ - $(public_api_base_src_dir)/builder/json-parser.h \ - $(public_api_base_src_dir)/builder/tree-node.h - - diff --git a/base/dali-toolkit/public-api/styling/style-manager.cpp b/base/dali-toolkit/public-api/styling/style-manager.cpp deleted file mode 100644 index bdef3d1..0000000 --- a/base/dali-toolkit/public-api/styling/style-manager.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// - -// CLASS HEADER - -#include - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES - -#include - -namespace Dali -{ - -namespace Toolkit -{ - -StyleManager::StyleManager() -{ -} - -StyleManager::~StyleManager() -{ -} - -StyleManager StyleManager::Get() -{ - return Internal::StyleManager::Get(); -} - -void StyleManager::SetOrientationValue( int orientation ) -{ - GetImpl(*this).SetOrientationValue( orientation ); -} - -int StyleManager::GetOrientationValue() -{ - return GetImpl(*this).GetOrientationValue(); -} - -void StyleManager::SetOrientation( Orientation orientation ) -{ - GetImpl(*this).SetOrientation( orientation ); -} - -Orientation StyleManager::GetOrientation() -{ - return GetImpl(*this).GetOrientation(); -} - -void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value ) -{ - GetImpl(*this).SetStyleConstant( key, value ); -} - -bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& valueOut ) -{ - return GetImpl(*this).GetStyleConstant( key, valueOut ); -} - -void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName ) -{ - GetImpl(*this).ApplyStyle( control, jsonFileName, styleName ); -} - -StyleManager::StyleManager( Internal::StyleManager *impl ) - : BaseHandle( impl ) -{ -} - -StyleManager::ThemeChangeSignalType& StyleManager::ThemeChangeSignal() -{ - return GetImpl( *this ).ThemeChangeSignal(); -} - -void StyleManager::RequestThemeChange( const std::string& themeFile ) -{ - GetImpl(*this).RequestThemeChange( themeFile ); -} - -void StyleManager::RequestDefaultTheme() -{ - GetImpl(*this).RequestDefaultTheme(); -} - -} // namespace Toolkit - -} // namespace Dali - diff --git a/base/dali-toolkit/public-api/styling/style-manager.h b/base/dali-toolkit/public-api/styling/style-manager.h deleted file mode 100644 index 6b42f8d..0000000 --- a/base/dali-toolkit/public-api/styling/style-manager.h +++ /dev/null @@ -1,190 +0,0 @@ -#ifndef __DALI_TOOLKIT_STYLE_MANAGER_H__ -#define __DALI_TOOLKIT_STYLE_MANAGER_H__ - -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES -#include -#include - -namespace Dali DALI_IMPORT_API -{ - -namespace Toolkit -{ - -namespace Internal DALI_INTERNAL -{ -class StyleManager; -} - -/** - * @brief StyleManager provides the following functionalities: - * - * Applies various styles to Controls using the properties system. - * On theme change a signal is raised that controls can be configured to listen to. - * - * The default theme is automatically loaded and applied. - * - * If the application wants to customize the theme, RequestThemeChange needs to be called. - * Also, the default orientation is Portrait, if the application wants to adapt to the orientation change, call SetOrientation or SetOrienationValue. - * @code - * const char* CUSTOM_THEME = DALI_SCRIPT_DIR "tizen-dark-theme.json"; - * - * void OnInit(Application& app) - * { - * Toolkit::StyleManager::Get().RequestThemeChange( CUSTOM_THEME ); - * Toolkit::StyleManager::Get().SetOrientation( app.GetOrientation() ); - * ... - * } - * @endcode - * - * Internal::Control can be configured to register for the signals that are required from StyleManager, - * such as theme change. - */ -class StyleManager : public BaseHandle -{ -public: - - // Signals - typedef SignalV2< void ( StyleManager ) > ThemeChangeSignalType; - - /** - * @brief Create a StyleManager handle; this can be initialised with StyleManager::Get() - * Calling member functions with an uninitialised handle is not allowed. - */ - StyleManager(); - - /** - * @brief Virtual destructor. - */ - virtual ~StyleManager(); - - /** - * @brief Get the singleton of StyleManager object. - * - * @return A handle to the StyleManager control. - */ - static StyleManager Get(); - - /** - * @brief Specify the orientation value directly for the style manager - * - * @param[in] orientation The orientation in degrees - */ - void SetOrientationValue( int orientation ); - - /** - * @brief Return the orientation value - * - * @return The orientation value - */ - int GetOrientationValue(); - - /** - * @brief Set the orientation object. This will take precedence over setting the orientation value. - * - * @param[in] orientation Device orientation - */ - void SetOrientation( Orientation orientation ); - - /** - * @brief Return the orientation object - * - * @return The orientation. - */ - Orientation GetOrientation(); - - /** - * @brief Make a request to set the theme JSON file to one that exists in the Toolkit package. - * - * Multiple requests per event processing cycle can be made, but only the final one will be acted - * on in the event processing finished callback. - * - * @param[in] themeFile This is just the JSON theme file name and not the full path. - */ - void RequestThemeChange( const std::string& themeFile ); - - /** - * @brief Request a change to the default theme - */ - void RequestDefaultTheme(); - - /** - * @brief Set a constant for use when building styles - * - * A constant is used in JSON files e.g. "my-image":"{ROOT_PATH}/mypath/image.jpg" - * where the string "{ROOT_PATH}" is substituted with the value. - * - * @param[in] key The key of the constant - * @param[in] value The value of the constant - */ - void SetStyleConstant( const std::string& key, const Property::Value& value ); - - /** - * @brief Return the style constant set for a specific key - * - * @param[in] key The key of the constant - * @param[out] valueOut The value of the constant if it exists - * - * @return If the constant for key exists then return the constant in valueOut and return true - */ - bool GetStyleConstant( const std::string& key, Property::Value& valueOut ); - - /** - * @brief Apply the specified style to the control. - * - * The JSON file will be cached and subsequent calls using the same JSON file name will - * use the already loaded cached values instead. - * - * @param[in] control The control to apply style. - * @param[in] jsonFileName The name of the JSON style file to apply. - * @param[in] styleName The name of the style within the JSON file to apply. - */ - void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName ); - -public: // Signals - - /** - * @brief This signal is emitted whenever the theme is changed on device - * A callback of the following type may be connected: - * @code - * void YourCallbackName( StyleManager styleManager ); - * @endcode - * @return The signal to connect to. - */ - ThemeChangeSignalType& ThemeChangeSignal(); - -public: - - /** - * @brief Creates a new handle from the implementation. - * - * @param[in] impl A pointer to the object. - */ - explicit DALI_INTERNAL StyleManager( Internal::StyleManager *impl ); - -}; // class StyleManager - -} // namespace Toolkit - -} // namespace Dali - - -#endif /* __DALI_TOOLKIT_STYLE_MANAGER_H__ */ diff --git a/base/dali-toolkit/styles/file.list b/base/dali-toolkit/styles/file.list deleted file mode 100644 index 83a6e26..0000000 --- a/base/dali-toolkit/styles/file.list +++ /dev/null @@ -1,4 +0,0 @@ -# Files to install here - -dali_toolkit_style_files =\ - $(toolkit_base_styles_dir)/*.json diff --git a/base/dali-toolkit/styles/tizen-dark-theme.json b/base/dali-toolkit/styles/tizen-dark-theme.json deleted file mode 100644 index 4f1e5d7..0000000 --- a/base/dali-toolkit/styles/tizen-dark-theme.json +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (c) 2000-2014 Samsung Electronics Co., Ltd All Rights Reserved - -This file is part of Dali Toolkit - -PROPRIETARY/CONFIDENTIAL - -This software is the confidential and proprietary information of -SAMSUNG ELECTRONICS ("Confidential Information"). You shall not -disclose such Confidential Information and shall use it only in -accordance with the terms of the license agreement you entered -into with SAMSUNG ELECTRONICS. - -SAMSUNG make no representations or warranties about the suitability -of the software, either express or implied, including but not limited -to the implied warranties of merchantability, fitness for a particular -purpose, or non-infringement. SAMSUNG shall not be liable for any -damages suffered by licensee as a result of using, modifying or -distributing this software or its derivatives. -*/ - - - -//****************************************************************************** -// -// Default style theme for Tizen dark theme, The values should come from -// UX design document. -// -//****************************************************************************** - -{ - "styles": - { - } -} \ No newline at end of file diff --git a/base/dali-toolkit/styles/tizen-default-theme.json b/base/dali-toolkit/styles/tizen-default-theme.json deleted file mode 120000 index c09c1a1..0000000 --- a/base/dali-toolkit/styles/tizen-default-theme.json +++ /dev/null @@ -1 +0,0 @@ -tizen-dark-theme.json \ No newline at end of file diff --git a/build/slp/dali-toolkit-base/Makefile.am b/build/slp/dali-toolkit-base/Makefile.am index 111aea3..50eaa34 100644 --- a/build/slp/dali-toolkit-base/Makefile.am +++ b/build/slp/dali-toolkit-base/Makefile.am @@ -19,13 +19,11 @@ # Base files toolkit_base_images_dir = ../../../base/dali-toolkit/images toolkit_base_sounds_dir = ../../../base/dali-toolkit/sounds -toolkit_base_styles_dir = ../../../base/dali-toolkit/styles toolkit_base_src_dir = ../../../base/dali-toolkit/internal public_api_base_src_dir = ../../../base/dali-toolkit/public-api include ../../../base/dali-toolkit/images/file.list include ../../../base/dali-toolkit/sounds/file.list -include ../../../base/dali-toolkit/styles/file.list include ../../../base/dali-toolkit/internal/file.list include ../../../base/dali-toolkit/public-api/file.list @@ -35,9 +33,6 @@ include ../../../base/dali-toolkit/public-api/file.list #dalisounddir = ${dataReadOnlyDir}/toolkit/sounds/ #dalisound_DATA = ${dali_toolkit_base_sound_files} -#dalistyledir = ${dataReadOnlyDir}/toolkit/styles/ -#dalistyle_DATA = ${dali_toolkit_style_files} - # The Base library lib_LTLIBRARIES = libdali-toolkit-base.la @@ -48,11 +43,8 @@ libdali_toolkit_base_la_SOURCES = \ libdali_toolkit_base_la_DEPENDENCIES = libdali_toolkit_base_la_CXXFLAGS = -DDALI_COMPILATION \ - -DDALI_TOOLKIT_BASE \ -DDALI_IMAGE_DIR="\"${daliimagedir}\"" \ -DDALI_SOUND_DIR="\"${dalisounddir}\"" \ - -DDALI_STYLE_DIR="\"${dalistyledir}\"" \ - -DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \ -Werror -Wall \ -I../../../base \ -I../../../capi \ diff --git a/build/slp/dali-toolkit/Makefile.am b/build/slp/dali-toolkit/Makefile.am index 3d8c4cc..79f3c62 100644 --- a/build/slp/dali-toolkit/Makefile.am +++ b/build/slp/dali-toolkit/Makefile.am @@ -19,13 +19,11 @@ # Base files toolkit_base_images_dir = ../../../base/dali-toolkit/images toolkit_base_sounds_dir = ../../../base/dali-toolkit/sounds -toolkit_base_styles_dir = ../../../base/dali-toolkit/styles toolkit_base_src_dir = ../../../base/dali-toolkit/internal public_api_base_src_dir = ../../../base/dali-toolkit/public-api include ../../../base/dali-toolkit/images/file.list include ../../../base/dali-toolkit/sounds/file.list -include ../../../base/dali-toolkit/styles/file.list include ../../../base/dali-toolkit/internal/file.list include ../../../base/dali-toolkit/public-api/file.list @@ -60,16 +58,11 @@ libdali_toolkit_la_SOURCES = \ $(toolkit_optional_src_files) \ $(public_api_optional_src_files) -dalistyledir = ${dataReadOnlyDir}/toolkit/styles/ -dalistyle_DATA = ${dali_toolkit_style_files} - libdali_toolkit_la_DEPENDENCIES = libdali_toolkit_la_CXXFLAGS = -DDALI_COMPILATION \ -DDALI_IMAGE_DIR="\"${daliimagedir}\"" \ -DDALI_SOUND_DIR="\"${dalisounddir}\"" \ - -DDALI_STYLE_DIR="\"${dalistyledir}\"" \ - -DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \ -Werror -Wall \ -I../../../base \ -I../../../optional \ @@ -110,8 +103,6 @@ publicapibasefactorydir = $(publicapibasedir)/factory publicapibasefocusmanagerdir = $(publicapibasedir)/focus-manager publicapibasemarkupprocessordir = $(publicapibasedir)/markup-processor publicapibaseshadereffectsdir = $(publicapibasedir)/shader-effects -publicapibasestylingdir = $(publicapibasedir)/styling -publicapibasebuilderdir = $(publicapibasedir)/builder publicapibase_HEADERS = $(public_api_base_header_files) publicapibasecontrols_HEADERS = $(public_api_base_controls_header_files) @@ -131,8 +122,6 @@ publicapibasefactory_HEADERS = $(public_api_base_factory_header_files) publicapibasefocusmanager_HEADERS = $(public_api_base_focus_manager_header_files) publicapibasemarkupprocessor_HEADERS = $(public_api_base_markup_processor_header_files) publicapibaseshadereffects_HEADERS = $(public_api_base_shader_effects_header_files) -publicapibasestyling_HEADERS = $(public_api_base_styling_header_files) -publicapibasebuilder_HEADERS = $(public_api_base_builder_header_files) # Install Optional headers @@ -158,6 +147,7 @@ publicapioptionalviewdir = $(publicapioptionaldir)/controls/view publicapioptionalnavigationframedir = $(publicapioptionaldir)/controls/navigation-frame publicapioptionalshadereffectsdir = $(publicapioptionaldir)/shader-effects publicapioptionalbubbleeffectdir = $(publicapioptionaldir)/shader-effects/bubble-effect +publicapioptionalbuilderdir = $(publicapioptionaldir)/builder publicapioptionaltransitioneffectsdir = $(publicapioptionaldir)/transition-effects publicapioptional_HEADERS = $(public_api_optional_header_files) @@ -179,6 +169,7 @@ publicapioptionalview_HEADERS = $(public_api_optional_view_header_files) publicapioptionalnavigationframe_HEADERS = $(public_api_optional_navigation_frame_header_files) publicapioptionalshadereffects_HEADERS = $(public_api_optional_shader_effects_header_files) publicapioptionalbubbleeffect_HEADERS = $(public_api_optional_bubble_effect_header_files) +publicapioptionalbuilder_HEADERS = $(public_api_optional_builder_header_files) publicapioptionaltransitioneffects_HEADERS = $(public_api_optional_transition_effects_header_files) # Install CAPI headers @@ -221,7 +212,6 @@ capidevelstyledtextutilitiesdir = $(capideveldir)/styled-text-utilities capidevelbuilderdir = $(capideveldir)/builder capidevelutilitiesdir = $(capideveldir)/utilities capideveltransitioneffectsdir = $(capideveldir)/transition-effects -capidevelstylingdir = $(capideveldir)/styling capidevel_HEADERS = $(capi_devel_header_files) capidevelcontrols_HEADERS = $(capi_devel_controls_header_files) @@ -261,5 +251,3 @@ capidevelstyledtextutilities_HEADERS = $(capi_devel_styled_text_utilities_header capidevelbuilder_HEADERS = $(capi_devel_builder_header_files) capidevelutilities_HEADERS = $(capi_devel_utilities_header_files) capideveltransitioneffects_HEADERS = $(capi_devel_transition_effects_header_files) -capidevelstyling_HEADERS = $(capi_devel_styling_header_files) - diff --git a/capi/dali-toolkit/public-api/controls/control-impl.h b/capi/dali-toolkit/public-api/controls/control-impl.h index b2b687f..b024d9a 100644 --- a/capi/dali-toolkit/public-api/controls/control-impl.h +++ b/capi/dali-toolkit/public-api/controls/control-impl.h @@ -35,6 +35,7 @@ class StyleManager; namespace Internal DALI_INTERNAL { +class StyleChangeProcessor; class RelayoutControllerImpl; class KeyInputFocusManager; } @@ -290,9 +291,12 @@ private: // For derived classes to override virtual void OnInitialize() { } /** - * @brief Callback for when the theme changes. + * @brief This method should be overridden by deriving classes when + * they wish to be notified when the style changes. + * + * @param[in] change Information denoting what has changed. */ - virtual void OnThemeChange( Toolkit::StyleManager styleManager ); + virtual void OnStyleChange(StyleChange change) { } /** * @brief Called whenever a pinch gesture is detected on this control. @@ -511,29 +515,13 @@ private: protected: // Construction - // Flags for the constructor - enum ControlBehaviour - { - CONTROL_BEHAVIOUR_NONE = 0x0, - REQUIRES_TOUCH_EVENTS = 0x1, ///< True if the OnTouchEvent() callback is required. - REQUIRES_THEME_CHANGE_SIGNALS = 0x2 ///< True if this control should listen to theme change signals - }; - /** - * @deprecated Use the constructor taking flags instead * @brief Create a Control. * * @param[in] requiresTouchEvents True if the OnTouchEvent() callback is required. */ Control(bool requiresTouchEvents); - /** - * @brief Create a Control. - * - * @param[in] behaviourFlags Behavioural flags from ControlBehaviour enum - */ - Control(ControlBehaviour behaviourFlags); - public: // Size negotiation @@ -709,6 +697,7 @@ private: class Impl; Impl *mImpl; + friend class Internal::StyleChangeProcessor; friend class Internal::RelayoutControllerImpl; ///< Relayout controller needs to call Relayout() which is private. friend class Internal::KeyInputFocusManager; ///< KeyInputFocusManager needs to call which is private. }; diff --git a/capi/dali-toolkit/public-api/dali-toolkit-capi-internal.h b/capi/dali-toolkit/public-api/dali-toolkit-capi-internal.h index 1c13d50..6f89000 100644 --- a/capi/dali-toolkit/public-api/dali-toolkit-capi-internal.h +++ b/capi/dali-toolkit/public-api/dali-toolkit-capi-internal.h @@ -60,4 +60,5 @@ #include #include + #endif // __DALI_TOOLKIT_CAPI_INTERNAL_H__ diff --git a/capi/dali-toolkit/public-api/file.list b/capi/dali-toolkit/public-api/file.list index a878f04..caf2cb3 100644 --- a/capi/dali-toolkit/public-api/file.list +++ b/capi/dali-toolkit/public-api/file.list @@ -85,4 +85,3 @@ capi_devel_shader_effects_header_files = \ $(capi_devel_src_dir)/shader-effects/ripple-effect.h \ $(capi_devel_src_dir)/shader-effects/ripple2d-effect.h \ $(capi_devel_src_dir)/shader-effects/swirl-effect.h - diff --git a/optional/dali-toolkit/dali-toolkit.h b/optional/dali-toolkit/dali-toolkit.h index 3d88968..ed080fe 100644 --- a/optional/dali-toolkit/dali-toolkit.h +++ b/optional/dali-toolkit/dali-toolkit.h @@ -20,6 +20,8 @@ #include // INTERNAL INCLUDES +#include +#include #include #include @@ -87,5 +89,4 @@ #include #include - #endif // __DALI_TOOLKIT_EXT_H__ diff --git a/base/dali-toolkit/internal/builder/builder-actor.cpp b/optional/dali-toolkit/internal/builder/builder-actor.cpp similarity index 100% rename from base/dali-toolkit/internal/builder/builder-actor.cpp rename to optional/dali-toolkit/internal/builder/builder-actor.cpp diff --git a/base/dali-toolkit/internal/builder/builder-animations.cpp b/optional/dali-toolkit/internal/builder/builder-animations.cpp similarity index 100% rename from base/dali-toolkit/internal/builder/builder-animations.cpp rename to optional/dali-toolkit/internal/builder/builder-animations.cpp diff --git a/base/dali-toolkit/internal/builder/builder-declarations.h b/optional/dali-toolkit/internal/builder/builder-declarations.h similarity index 100% rename from base/dali-toolkit/internal/builder/builder-declarations.h rename to optional/dali-toolkit/internal/builder/builder-declarations.h diff --git a/base/dali-toolkit/internal/builder/builder-filesystem.h b/optional/dali-toolkit/internal/builder/builder-filesystem.h similarity index 100% rename from base/dali-toolkit/internal/builder/builder-filesystem.h rename to optional/dali-toolkit/internal/builder/builder-filesystem.h diff --git a/base/dali-toolkit/internal/builder/builder-get-is.inl.h b/optional/dali-toolkit/internal/builder/builder-get-is.inl.h similarity index 100% rename from base/dali-toolkit/internal/builder/builder-get-is.inl.h rename to optional/dali-toolkit/internal/builder/builder-get-is.inl.h diff --git a/base/dali-toolkit/internal/builder/builder-impl.cpp b/optional/dali-toolkit/internal/builder/builder-impl.cpp similarity index 99% rename from base/dali-toolkit/internal/builder/builder-impl.cpp rename to optional/dali-toolkit/internal/builder/builder-impl.cpp index edba366..ae6e036 100644 --- a/base/dali-toolkit/internal/builder/builder-impl.cpp +++ b/optional/dali-toolkit/internal/builder/builder-impl.cpp @@ -994,13 +994,13 @@ void Builder::LoadConstants( const TreeNode& root, PropertyValueMap& intoMap ) } -bool Builder::ApplyStyle( const std::string& styleName, Handle& handle ) +void Builder::ApplyStyle( const std::string& styleName, Handle& handle ) { Replacement replacer( mReplacementMap ); - return ApplyStyle( styleName, handle, replacer ); + ApplyStyle( styleName, handle, replacer ); } -bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement ) +void Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement ) { DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded"); @@ -1010,13 +1010,12 @@ bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Re if( styles && style ) { ApplyAllStyleProperties( *mParser.GetRoot(), *style, handle, replacement ); - return true; } else { DALI_SCRIPT_WARNING("No styles section to create style '%s'\n", styleName.c_str()); - return false; } + } BaseHandle Builder::Create( const std::string& templateName, const PropertyValueMap& map ) diff --git a/base/dali-toolkit/internal/builder/builder-impl.h b/optional/dali-toolkit/internal/builder/builder-impl.h similarity index 98% rename from base/dali-toolkit/internal/builder/builder-impl.h rename to optional/dali-toolkit/internal/builder/builder-impl.h index eae2f71..87a35b9 100644 --- a/base/dali-toolkit/internal/builder/builder-impl.h +++ b/optional/dali-toolkit/internal/builder/builder-impl.h @@ -151,7 +151,7 @@ public: /** * @copydoc Toolkit::Builder::ApplyStyle */ - bool ApplyStyle( const std::string& styleName, Handle& handle ); + void ApplyStyle( const std::string& styleName, Handle& handle ); void AnimateTo( const std::string& styleName, Handle& handle ); @@ -232,7 +232,7 @@ private: void LoadIncludes( const std::string& data ); - bool ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement); + void ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement); Animation CreateAnimation( const std::string& animationName, const Replacement& replacement, Dali::Actor sourceActor ); diff --git a/base/dali-toolkit/internal/builder/builder-set-property.cpp b/optional/dali-toolkit/internal/builder/builder-set-property.cpp similarity index 100% rename from base/dali-toolkit/internal/builder/builder-set-property.cpp rename to optional/dali-toolkit/internal/builder/builder-set-property.cpp diff --git a/base/dali-toolkit/internal/builder/builder-signals.cpp b/optional/dali-toolkit/internal/builder/builder-signals.cpp similarity index 100% rename from base/dali-toolkit/internal/builder/builder-signals.cpp rename to optional/dali-toolkit/internal/builder/builder-signals.cpp diff --git a/base/dali-toolkit/internal/builder/json-parser-impl.cpp b/optional/dali-toolkit/internal/builder/json-parser-impl.cpp similarity index 100% rename from base/dali-toolkit/internal/builder/json-parser-impl.cpp rename to optional/dali-toolkit/internal/builder/json-parser-impl.cpp diff --git a/base/dali-toolkit/internal/builder/json-parser-impl.h b/optional/dali-toolkit/internal/builder/json-parser-impl.h similarity index 100% rename from base/dali-toolkit/internal/builder/json-parser-impl.h rename to optional/dali-toolkit/internal/builder/json-parser-impl.h diff --git a/base/dali-toolkit/internal/builder/json-parser-state.cpp b/optional/dali-toolkit/internal/builder/json-parser-state.cpp similarity index 100% rename from base/dali-toolkit/internal/builder/json-parser-state.cpp rename to optional/dali-toolkit/internal/builder/json-parser-state.cpp diff --git a/base/dali-toolkit/internal/builder/json-parser-state.h b/optional/dali-toolkit/internal/builder/json-parser-state.h similarity index 100% rename from base/dali-toolkit/internal/builder/json-parser-state.h rename to optional/dali-toolkit/internal/builder/json-parser-state.h diff --git a/base/dali-toolkit/internal/builder/optional-value.h b/optional/dali-toolkit/internal/builder/optional-value.h similarity index 100% rename from base/dali-toolkit/internal/builder/optional-value.h rename to optional/dali-toolkit/internal/builder/optional-value.h diff --git a/base/dali-toolkit/internal/builder/replacement.cpp b/optional/dali-toolkit/internal/builder/replacement.cpp similarity index 100% rename from base/dali-toolkit/internal/builder/replacement.cpp rename to optional/dali-toolkit/internal/builder/replacement.cpp diff --git a/base/dali-toolkit/internal/builder/replacement.h b/optional/dali-toolkit/internal/builder/replacement.h similarity index 100% rename from base/dali-toolkit/internal/builder/replacement.h rename to optional/dali-toolkit/internal/builder/replacement.h diff --git a/base/dali-toolkit/internal/builder/tree-node-manipulator.cpp b/optional/dali-toolkit/internal/builder/tree-node-manipulator.cpp similarity index 100% rename from base/dali-toolkit/internal/builder/tree-node-manipulator.cpp rename to optional/dali-toolkit/internal/builder/tree-node-manipulator.cpp diff --git a/base/dali-toolkit/internal/builder/tree-node-manipulator.h b/optional/dali-toolkit/internal/builder/tree-node-manipulator.h similarity index 100% rename from base/dali-toolkit/internal/builder/tree-node-manipulator.h rename to optional/dali-toolkit/internal/builder/tree-node-manipulator.h diff --git a/optional/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp b/optional/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp index 4872d4a..dde4f19 100644 --- a/optional/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp @@ -119,7 +119,7 @@ const char* const COMPOSITE_FRAGMENT_SOURCE = BloomView::BloomView() - : Control( CONTROL_BEHAVIOUR_NONE ) + : Control( false ) // doesn't require touch events , mBlurNumSamples(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_NUM_SAMPLES) , mBlurBellCurveWidth(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_BELL_CURVE_WIDTH) , mPixelFormat(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_RENDER_TARGET_PIXEL_FORMAT) @@ -141,7 +141,7 @@ BloomView::BloomView() BloomView::BloomView( const unsigned int blurNumSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat, const float downsampleWidthScale, const float downsampleHeightScale) - : Control( CONTROL_BEHAVIOUR_NONE ) + : Control( false ) // doesn't require touch events , mBlurNumSamples(blurNumSamples) , mBlurBellCurveWidth(blurBellCurveWidth) , mPixelFormat(renderTargetPixelFormat) diff --git a/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp b/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp index ee36706..8083191 100644 --- a/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp +++ b/optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp @@ -36,7 +36,7 @@ BubbleEmitter::BubbleEmitter( const Vector2& movementArea, Image shapeImage, unsigned int maximumNumberOfBubble, const Vector2& bubbleSizeRange ) -: Control( REQUIRES_TOUCH_EVENTS ), +: Control( true ), mMovementArea( movementArea ), mShapeImage( shapeImage ), mTotalNumOfBubble( maximumNumberOfBubble ), diff --git a/optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp b/optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp index 4a5e45e..5659788 100644 --- a/optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp +++ b/optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp @@ -80,7 +80,7 @@ Dali::Toolkit::Cluster Cluster::New(Toolkit::ClusterStyle& style) } Cluster::Cluster(Toolkit::ClusterStyle& style) -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ), +: Control(true/*requires touch*/), mClusterStyle(style), mExpandedCount(0) { diff --git a/optional/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp b/optional/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp index c8cb42b..ef36347 100644 --- a/optional/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp @@ -100,7 +100,7 @@ Toolkit::EffectsView EffectsView::New() } EffectsView::EffectsView() -: Control( CONTROL_BEHAVIOUR_NONE ), +: Control( false ), mEffectType( Toolkit::EffectsView::INVALID_TYPE ), mPixelFormat( EFFECTS_VIEW_DEFAULT_PIXEL_FORMAT ), mSpread(0.0f), diff --git a/optional/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp b/optional/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp index 126ada3..b77a121 100644 --- a/optional/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp @@ -111,8 +111,9 @@ const char* const GAUSSIAN_BLUR_FRAGMENT_SOURCE = GaussianBlurView::GaussianBlurView() - : Control( CONTROL_BEHAVIOUR_NONE ) + : Control( false ) // doesn't require touch events , mNumSamples(GAUSSIAN_BLUR_VIEW_DEFAULT_NUM_SAMPLES) + , mPixelFormat(GAUSSIAN_BLUR_VIEW_DEFAULT_RENDER_TARGET_PIXEL_FORMAT) , mDownsampleWidthScale(GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_WIDTH_SCALE) , mDownsampleHeightScale(GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_HEIGHT_SCALE) @@ -131,7 +132,7 @@ GaussianBlurView::GaussianBlurView() GaussianBlurView::GaussianBlurView( const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat, const float downsampleWidthScale, const float downsampleHeightScale, bool blurUserImage) - : Control( CONTROL_BEHAVIOUR_NONE ) + : Control( false ) // doesn't require touch events , mNumSamples(numSamples) , mPixelFormat(renderTargetPixelFormat) , mDownsampleWidthScale(downsampleWidthScale) diff --git a/optional/dali-toolkit/internal/controls/image-view/image-view-impl.cpp b/optional/dali-toolkit/internal/controls/image-view/image-view-impl.cpp index edd6f4a..68782e9 100644 --- a/optional/dali-toolkit/internal/controls/image-view/image-view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/image-view/image-view-impl.cpp @@ -86,7 +86,7 @@ Dali::Toolkit::ImageView ImageView::New() } ImageView::ImageView() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ) +: Control(true) { } diff --git a/optional/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp b/optional/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp index 38a05a4..0422021 100644 --- a/optional/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp @@ -474,7 +474,7 @@ Dali::Toolkit::MaskedImageView::MaskedImageViewSignal& MaskedImageView::MaskFini } MaskedImageView::MaskedImageView() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ), +: Control(true), mEditMode( Dali::Toolkit::MaskedImageView::EDIT_DISABLED ), mSelfPropertySetting( false ), mSourceRotation( Dali::Toolkit::MaskedImageView::ROTATE_0 ), diff --git a/optional/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp b/optional/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp index 9c42637..cbe156b 100644 --- a/optional/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp +++ b/optional/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp @@ -161,7 +161,7 @@ Dali::Toolkit::Magnifier Magnifier::New() } Magnifier::Magnifier() -: Control( REQUIRES_TOUCH_EVENTS ), +: Control(true), mPropertySourcePosition(Property::INVALID_INDEX), mActorSize(Vector3::ZERO), mMagnificationFactor(1.0f) diff --git a/optional/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp b/optional/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp index 71b5441..8731515 100644 --- a/optional/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp +++ b/optional/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp @@ -46,7 +46,7 @@ TypeAction a2(mType, Toolkit::NavigationControl::ACTION_POP, &NavigationControl: } NavigationControl::NavigationControl() -: Control( REQUIRES_TOUCH_EVENTS ), +: Control( true ), mToolBar(NULL), mTitleBar(NULL), mOrientationAngle( 0 ), diff --git a/optional/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp b/optional/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp index d681218..4e5c50e 100644 --- a/optional/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp +++ b/optional/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp @@ -44,7 +44,7 @@ TypeRegistration mType( typeid(Toolkit::Page), typeid(CustomActor), Create ); } // unnamed namespace Page::Page() -: Control( CONTROL_BEHAVIOUR_NONE ), +: Control(false), mTitle(""), mSubTitle("") { diff --git a/optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index 4a2c079..f508b54 100644 --- a/optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -250,7 +250,7 @@ const int PageTurnView::NUMBER_OF_CACHED_PAGES = NUMBER_OF_CACHED_PAGES_EACH_SID const float PageTurnView::STATIC_PAGE_INTERVAL_DISTANCE = 1.0f; PageTurnView::PageTurnView( PageFactory& pageFactory, const Vector2& pageSize ) -: Control( REQUIRES_TOUCH_EVENTS ), +: Control( true ), mPageFactory( pageFactory ), mPageSize( pageSize ), mIsEditMode( false ), diff --git a/optional/dali-toolkit/internal/controls/selectors/rotating-selector-impl.cpp b/optional/dali-toolkit/internal/controls/selectors/rotating-selector-impl.cpp index 9f36b9d..dabae5e 100644 --- a/optional/dali-toolkit/internal/controls/selectors/rotating-selector-impl.cpp +++ b/optional/dali-toolkit/internal/controls/selectors/rotating-selector-impl.cpp @@ -101,7 +101,7 @@ void RotatingSelector::OnInitialize() } RotatingSelector::RotatingSelector() -: Control( REQUIRES_TOUCH_EVENTS ), +: Control(true/*requires touch*/), mSelected(false), mSelectable(true), mIsAnimating(false) diff --git a/optional/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp b/optional/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp index b3bb8a5..ec3197a 100644 --- a/optional/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp @@ -116,7 +116,7 @@ struct EqualToConstraintMatrix } // namespace ShadowView::ShadowView( float downsampleWidthScale, float downsampleHeightScale ) -: Control( CONTROL_BEHAVIOUR_NONE ), +: Control( false ), // doesn't require touch events mChildrenRoot(Actor::New()), mCachedShadowColor(DEFAULT_SHADOW_COLOR), mCachedBackgroundColor(DEFAULT_SHADOW_COLOR.r, DEFAULT_SHADOW_COLOR.g, DEFAULT_SHADOW_COLOR.b, 0.0f), diff --git a/optional/dali-toolkit/internal/controls/slider/slider-impl.cpp b/optional/dali-toolkit/internal/controls/slider/slider-impl.cpp index 8a3bbb2..7ec9d7b 100755 --- a/optional/dali-toolkit/internal/controls/slider/slider-impl.cpp +++ b/optional/dali-toolkit/internal/controls/slider/slider-impl.cpp @@ -168,7 +168,7 @@ Dali::Toolkit::Slider Slider::New() } Slider::Slider() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ), +: Control( true ), mState( NORMAL ), mDisableColor( 0.0f, 0.0f, 0.0f, 0.0f ), mPopupTextColor( 0.0f, 0.0f, 0.0f, 0.0f ), diff --git a/optional/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp b/optional/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp index 7ad168f..fdbcd34 100644 --- a/optional/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp @@ -97,7 +97,7 @@ PropertyRegistration property1( typeRegistration, "image", Toolkit::SuperBlurVie } // unnamed namespace SuperBlurView::SuperBlurView( unsigned int blurLevels ) -: Control( CONTROL_BEHAVIOUR_NONE ), +: Control( false ), mBlurLevels( blurLevels ), mBlurStrengthPropertyIndex(Property::INVALID_INDEX), mResourcesCleared( true ), diff --git a/optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp b/optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp index 0a52092..703cf87 100644 --- a/optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp +++ b/optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp @@ -287,7 +287,7 @@ void ToolBar::RemoveControl( Actor control ) } ToolBar::ToolBar() -: Control( CONTROL_BEHAVIOUR_NONE ), +: Control( false ), // doesn't require touch events mLayout(), mLeftOffset( 0 ), mCenterBase( 1 ), diff --git a/optional/dali-toolkit/internal/controls/view/view-impl.cpp b/optional/dali-toolkit/internal/controls/view/view-impl.cpp index 6877c2d..b27d509 100644 --- a/optional/dali-toolkit/internal/controls/view/view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/view/view-impl.cpp @@ -269,7 +269,7 @@ bool View::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* trac } View::View(bool fullscreen) -: Control( CONTROL_BEHAVIOUR_NONE ), +: Control( false ), // doesn't require touch events mOrientation( -1 ), mFullScreen(fullscreen), mContentLayers(), diff --git a/optional/dali-toolkit/internal/file.list b/optional/dali-toolkit/internal/file.list index 797c08b..5e214a4 100644 --- a/optional/dali-toolkit/internal/file.list +++ b/optional/dali-toolkit/internal/file.list @@ -1,6 +1,15 @@ # Add local source files here toolkit_optional_src_files = \ + $(toolkit_optional_src_dir)/builder/builder-impl.cpp \ + $(toolkit_optional_src_dir)/builder/builder-animations.cpp \ + $(toolkit_optional_src_dir)/builder/builder-set-property.cpp \ + $(toolkit_optional_src_dir)/builder/builder-signals.cpp \ + $(toolkit_optional_src_dir)/builder/builder-actor.cpp \ + $(toolkit_optional_src_dir)/builder/json-parser-state.cpp \ + $(toolkit_optional_src_dir)/builder/json-parser-impl.cpp \ + $(toolkit_optional_src_dir)/builder/tree-node-manipulator.cpp \ + $(toolkit_optional_src_dir)/builder/replacement.cpp \ $(toolkit_optional_src_dir)/controls/bloom-view/bloom-view-impl.cpp \ $(toolkit_optional_src_dir)/controls/cluster/cluster-impl.cpp \ $(toolkit_optional_src_dir)/controls/cluster/cluster-style-impl.cpp \ diff --git a/base/dali-toolkit/public-api/builder/builder.cpp b/optional/dali-toolkit/public-api/builder/builder.cpp similarity index 97% rename from base/dali-toolkit/public-api/builder/builder.cpp rename to optional/dali-toolkit/public-api/builder/builder.cpp index dbb75b1..aed1cbe 100644 --- a/base/dali-toolkit/public-api/builder/builder.cpp +++ b/optional/dali-toolkit/public-api/builder/builder.cpp @@ -113,9 +113,9 @@ BaseHandle Builder::Create( const std::string& templateName, const PropertyValue return GetImpl(*this).Create( templateName, map ); } -bool Builder::ApplyStyle( const std::string& styleName, Handle& handle ) +void Builder::ApplyStyle( const std::string& styleName, Handle& handle ) { - return GetImpl(*this).ApplyStyle( styleName, handle ); + GetImpl(*this).ApplyStyle( styleName, handle ); } void Builder::AddActors( Actor toActor ) diff --git a/base/dali-toolkit/public-api/builder/builder.h b/optional/dali-toolkit/public-api/builder/builder.h similarity index 95% rename from base/dali-toolkit/public-api/builder/builder.h rename to optional/dali-toolkit/public-api/builder/builder.h index 723b675..2d67093 100644 --- a/base/dali-toolkit/public-api/builder/builder.h +++ b/optional/dali-toolkit/public-api/builder/builder.h @@ -140,9 +140,7 @@ typedef std::map PropertyValueMap; * @brief Adds or modifies a user defined constant to all future style template or animation expansions * * e.g. - * @code - * builder.AddConstant( "IMAGE_DIRECTORY", "/usr/share/images" ); - * @endcode + * builder.AddConstant( "IMAGE_DIRECTORY", "/usr/share/images" ); * * @pre The Builder has been initialized. * @param key The constant name to add or update @@ -154,11 +152,9 @@ typedef std::map PropertyValueMap; * @brief Gets all currently defined constants. * * e.g. - * @code - * PropertyValueMap map = builder.GetConstants(); // get copy of current constants - * map["IMAGE_DIRECTORY"] = "/usr/share/images"; // make modification - * builder.AddConstants( map ); // write back changes - * @endcode + * PropertyValueMap map = builder.GetConstants(); // get copy of current constants + * map["IMAGE_DIRECTORY"] = "/usr/share/images"; // make modification + * builder.AddConstants( map ); // write back changes * * @pre The Builder has been initialized. * @return A reference to the currently defined constants. @@ -169,11 +165,9 @@ typedef std::map PropertyValueMap; * @brief Gets a currently defined constant, or returns Property::INVALID * * e.g. - * @code - * PropertyValueMap map = builder.GetConstants(); // get copy of current constants - * map["IMAGE_DIRECTORY"] = "/usr/share/images"; // make modification - * builder.AddConstants( map ); // write back changes - * @endcode + * PropertyValueMap map = builder.GetConstants(); // get copy of current constants + * map["IMAGE_DIRECTORY"] = "/usr/share/images"; // make modification + * builder.AddConstants( map ); // write back changes * * @pre The Builder has been initialized. * @param key The constant name to search for. @@ -298,10 +292,8 @@ typedef std::map PropertyValueMap; * @pre Preconditions have been met for creating dali objects ie Images, Actors etc * @param styleName The name of the set of style properties to set on the handle object. * @param handle Then handle of the object on which to set the properties. - * - * @return Return true if the style was found */ - bool ApplyStyle( const std::string& styleName, Handle& handle ); + void ApplyStyle( const std::string& styleName, Handle& handle ); /** * Add the actor tree in the "stage" section to the actor toActor. diff --git a/base/dali-toolkit/public-api/builder/json-parser.cpp b/optional/dali-toolkit/public-api/builder/json-parser.cpp similarity index 100% rename from base/dali-toolkit/public-api/builder/json-parser.cpp rename to optional/dali-toolkit/public-api/builder/json-parser.cpp diff --git a/base/dali-toolkit/public-api/builder/json-parser.h b/optional/dali-toolkit/public-api/builder/json-parser.h similarity index 100% rename from base/dali-toolkit/public-api/builder/json-parser.h rename to optional/dali-toolkit/public-api/builder/json-parser.h diff --git a/base/dali-toolkit/public-api/builder/tree-node.cpp b/optional/dali-toolkit/public-api/builder/tree-node.cpp similarity index 100% rename from base/dali-toolkit/public-api/builder/tree-node.cpp rename to optional/dali-toolkit/public-api/builder/tree-node.cpp diff --git a/base/dali-toolkit/public-api/builder/tree-node.h b/optional/dali-toolkit/public-api/builder/tree-node.h similarity index 100% rename from base/dali-toolkit/public-api/builder/tree-node.h rename to optional/dali-toolkit/public-api/builder/tree-node.h diff --git a/optional/dali-toolkit/public-api/file.list b/optional/dali-toolkit/public-api/file.list index ba93b35..a97558c 100755 --- a/optional/dali-toolkit/public-api/file.list +++ b/optional/dali-toolkit/public-api/file.list @@ -49,11 +49,14 @@ public_api_optional_src_files = \ $(public_api_optional_src_dir)/shader-effects/water-effect.cpp \ $(public_api_optional_src_dir)/shader-effects/bubble-effect/bubble-effect.cpp \ $(public_api_optional_src_dir)/shader-effects/bubble-effect/color-adjuster.cpp \ + $(public_api_optional_src_dir)/builder/builder.cpp \ + $(public_api_optional_src_dir)/builder/json-parser.cpp \ + $(public_api_optional_src_dir)/builder/tree-node.cpp \ $(public_api_optional_src_dir)/transition-effects/cube-transition-effect.cpp \ $(public_api_optional_src_dir)/transition-effects/cube-transition-wave-effect.cpp \ $(public_api_optional_src_dir)/transition-effects/cube-transition-cross-effect.cpp \ $(public_api_optional_src_dir)/transition-effects/cube-transition-fold-effect.cpp - + # Add public header files here public_api_optional_header_files = @@ -132,9 +135,13 @@ public_api_optional_bubble_effect_header_files = \ public_api_optional_bubble_emitter_header_files = +public_api_optional_builder_header_files = \ + $(public_api_optional_src_dir)/builder/builder.h \ + $(public_api_optional_src_dir)/builder/json-parser.h \ + $(public_api_optional_src_dir)/builder/tree-node.h + public_api_optional_transition_effects_header_files = \ $(public_api_optional_src_dir)/transition-effects/cube-transition-effect.h \ $(public_api_optional_src_dir)/transition-effects/cube-transition-wave-effect.h \ $(public_api_optional_src_dir)/transition-effects/cube-transition-cross-effect.h \ $(public_api_optional_src_dir)/transition-effects/cube-transition-fold-effect.h - diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 54a27e4..99b0856 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -56,7 +56,6 @@ all the controls provided by the main package. %define dali_data_ro_dir /usr/share/dali/ %define dali_toolkit_image_files %{dali_data_ro_dir}/toolkit/images/ %define dali_toolkit_sound_files %{dali_data_ro_dir}/toolkit/sounds/ -%define dali_toolkit_style_files %{dali_data_ro_dir}/toolkit/styles/ %define dev_include_path %{_includedir} ############################## @@ -124,7 +123,6 @@ exit 0 %{_libdir}/lib%{name}.so* %{dali_toolkit_image_files}/* %{dali_toolkit_sound_files}/* -%{dali_toolkit_style_files}/* %{_datadir}/license/%{name} %files devel