Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-notification-impl.cpp
index 510c344..7e407ca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -24,7 +24,7 @@
 #include <dali/public-api/math/radian.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/common/property-notification-manager.h>
-#include <dali/internal/event/common/proxy-object.h>
+#include <dali/internal/event/common/object-impl.h>
 #include <dali/internal/event/common/stage-impl.h>
 #include <dali/internal/update/manager/update-manager.h>
 #include <dali/internal/update/common/scene-graph-property-notification.h>
@@ -46,53 +46,45 @@ PropertyNotificationPtr PropertyNotification::New(Property& target,
 
   UpdateManager& updateManager = tls.GetUpdateManager();
 
-  PropertyNotificationManager& propertyNotificationManager = Stage::GetCurrent()->GetPropertyNotificationManager();
-
+  PropertyNotificationManager& propertyNotificationManager = tls.GetPropertyNotificationManager();
   PropertyNotificationPtr propertyNotification = new PropertyNotification(updateManager,
                                                                           propertyNotificationManager,
                                                                           target,
                                                                           componentIndex,
                                                                           condition);
-
   return propertyNotification;
 }
 
-PropertyNotification::PropertyNotification(UpdateManager& updateManager,
-                                           PropertyNotificationManager& propertyNotificationManager,
-                                           Property& target,
-                                           int componentIndex,
-                                           const Dali::PropertyCondition& condition)
-: mUpdateManager(updateManager),
-  mPropertyNotification(NULL),
-  mPropertyNotificationManager(propertyNotificationManager),
-  mProxyPropertyIndex(target.propertyIndex),
-  mPropertyType(Property::NONE),
-  mComponentIndex(componentIndex),
-  mCondition(condition),
-  mNotifyMode(Dali::PropertyNotification::NotifyOnTrue),
-  mNotifyResult(false)
-{
-  // Set condition arguments (as simple vector of floats)
-  PropertyCondition::ArgumentContainer arguments = GetImplementation(condition).arguments;
-  PropertyCondition::ArgumentConstIter iter = arguments.begin();
-
-  while( iter != arguments.end() )
+PropertyNotification::PropertyNotification( UpdateManager& updateManager,
+                                            PropertyNotificationManager& propertyNotificationManager,
+                                            Property& target,
+                                            int componentIndex,
+                                            const Dali::PropertyCondition& condition )
+: mUpdateManager( updateManager ),
+  mPropertyNotification( NULL ),
+  mPropertyNotificationManager( propertyNotificationManager ),
+  mObjectPropertyIndex( target.propertyIndex ),
+  mPropertyType( Property::NONE ),
+  mComponentIndex( componentIndex ),
+  mCondition( condition ),
+  mNotifyMode( Dali::PropertyNotification::NotifyOnTrue ),
+  mNotifyResult( false )
+{
+  const Internal::PropertyCondition& conditionImpl = GetImplementation( condition );
+
+  Dali::Vector<float>::SizeType count = conditionImpl.arguments.Count();
+  for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
   {
-    const Property::Value& value = *iter;
-    float floatValue;
-    value.Get(floatValue);
-
-    mRawConditionArgs.PushBack( floatValue );
-    ++iter;
+    mRawConditionArgs.PushBack( conditionImpl.arguments[ index ] );
   }
 
-  // Observe target proxy and create/destroy notification scene object accordingly.
-  mProxy = dynamic_cast<ProxyObject*>( &GetImplementation(target.object) );
-  if ( mProxy )
+  // Observe target object and create/destroy notification scene object accordingly.
+  mObject = dynamic_cast<Object*>( &GetImplementation(target.object) );
+  if ( mObject )
   {
-    mPropertyType = mProxy->GetPropertyType(mProxyPropertyIndex);
+    mPropertyType = mObject->GetPropertyType(mObjectPropertyIndex);
 
-    int internalComponentIndex = mProxy->GetPropertyComponentIndex(mProxyPropertyIndex);
+    int internalComponentIndex = mObject->GetPropertyComponentIndex(mObjectPropertyIndex);
     if( internalComponentIndex != Property::INVALID_COMPONENT_INDEX )
     {
       // override the one passed in
@@ -100,7 +92,7 @@ PropertyNotification::PropertyNotification(UpdateManager& updateManager,
     }
     if(mComponentIndex != Property::INVALID_COMPONENT_INDEX)
     {
-      Property::Type type = mProxy->GetPropertyType(mProxyPropertyIndex);
+      Property::Type type = mObject->GetPropertyType(mObjectPropertyIndex);
       if( type == Property::VECTOR2
           || type == Property::VECTOR3
           || type == Property::VECTOR4 )
@@ -109,13 +101,8 @@ PropertyNotification::PropertyNotification(UpdateManager& updateManager,
       }
     }
 
-    // Check if target scene-object already present, and if so create our notification
-    // scene-object
-    const SceneGraph::PropertyOwner* object = mProxy->GetSceneObject();
-    if (object)
-    {
-      CreateSceneObject();
-    }
+    // all objects always have scene object
+    CreateSceneObject();
   }
 
   // Connect to the property notification manager
@@ -134,7 +121,7 @@ PropertyNotification::~PropertyNotification()
   }
 }
 
-Dali::PropertyNotifySignalV2& PropertyNotification::NotifySignal()
+Dali::PropertyNotifySignalType& PropertyNotification::NotifySignal()
 {
   return mNotifySignal;
 }
@@ -173,14 +160,14 @@ const Dali::PropertyCondition& PropertyNotification::GetCondition() const
 
 Dali::Handle PropertyNotification::GetTarget() const
 {
-  Dali::Handle handle(mProxy);
+  Dali::Handle handle(mObject);
 
   return handle;
 }
 
 Property::Index PropertyNotification::GetTargetProperty() const
 {
-  return mProxyPropertyIndex;
+  return mObjectPropertyIndex;
 }
 
 void PropertyNotification::SetNotifyMode( NotifyMode mode )
@@ -212,19 +199,16 @@ void PropertyNotification::CreateSceneObject()
   // this method can be called from constructor and on stage connection
   if( !mPropertyNotification )
   {
-    // Create a new PropertyNotification, temporarily owned
-    SceneGraph::PropertyNotification* propertyNotification = SceneGraph::PropertyNotification::New( *mProxy,
-                                                                                                    mProxyPropertyIndex,
-                                                                                                    mPropertyType,
-                                                                                                    mComponentIndex,
-                                                                                                    GetImplementation(mCondition).type,
-                                                                                                    mRawConditionArgs,
-                                                                                                    mNotifyMode );
-    // Keep a const pointer to the PropertyNotification.
-    mPropertyNotification = propertyNotification;
-
-    // Transfer scene object ownership to the update manager through a message
-    AddPropertyNotificationMessage( mUpdateManager, propertyNotification );
+    // Create a new PropertyNotification, keep a const pointer to it
+    mPropertyNotification = SceneGraph::PropertyNotification::New( *mObject,
+                                                                   mObjectPropertyIndex,
+                                                                   mPropertyType,
+                                                                   mComponentIndex,
+                                                                   GetImplementation( mCondition ).type,
+                                                                   mRawConditionArgs,
+                                                                   mNotifyMode );
+    OwnerPointer< SceneGraph::PropertyNotification > transferOwnership( const_cast<SceneGraph::PropertyNotification*>( mPropertyNotification ) );
+    AddPropertyNotificationMessage( mUpdateManager, transferOwnership );
   }
 }