Removed unneeded index param and code from ConnectNode / Child 10/44610/2
authorTom Robinson <tom.robinson@samsung.com>
Thu, 23 Jul 2015 13:58:38 +0000 (14:58 +0100)
committerTom Robinson <tom.robinson@samsung.com>
Thu, 23 Jul 2015 14:26:48 +0000 (07:26 -0700)
Change-Id: Ic6dd8519b44d861e3208b4d701d18e3f43776506

dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h
dali/internal/update/manager/update-manager.cpp
dali/internal/update/manager/update-manager.h
dali/internal/update/nodes/node.cpp
dali/internal/update/nodes/node.h

index fb890d0..2bd9b83 100644 (file)
@@ -1933,15 +1933,14 @@ Actor::~Actor()
   }
 }
 
-void Actor::ConnectToStage( unsigned int parentDepth, int index )
+void Actor::ConnectToStage( unsigned int parentDepth )
 {
-  // This container is used instead of walking the Actor hierachy.
-  // It protects us when the Actor hierachy is modified during OnStageConnectionExternal callbacks.
+  // This container is used instead of walking the Actor hierarchy.
+  // It protects us when the Actor hierarchy is modified during OnStageConnectionExternal callbacks.
   ActorContainer connectionList;
 
-
-  // This stage is atomic i.e. not interrupted by user callbacks
-  RecursiveConnectToStage( connectionList, parentDepth+1, index );
+  // This stage is atomic i.e. not interrupted by user callbacks.
+  RecursiveConnectToStage( connectionList, parentDepth + 1 );
 
   // Notify applications about the newly connected actors.
   const ActorIter endIter = connectionList.end();
@@ -1953,14 +1952,14 @@ void Actor::ConnectToStage( unsigned int parentDepth, int index )
   RelayoutRequest();
 }
 
-void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth, int index )
+void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth )
 {
   DALI_ASSERT_ALWAYS( !OnStage() );
 
   mIsOnStage = true;
   mDepth = depth;
 
-  ConnectToSceneGraph( index );
+  ConnectToSceneGraph();
 
   // Notification for internal derived classes
   OnStageConnectionInternal();
@@ -1983,16 +1982,16 @@ void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned in
  * This method is called when the Actor is connected to the Stage.
  * The parent must have added its Node to the scene-graph.
  * The child must connect its Node to the parent's Node.
- * This is resursive; the child calls ConnectToStage() for its children.
+ * This is recursive; the child calls ConnectToStage() for its children.
  */
-void Actor::ConnectToSceneGraph( int index )
+void Actor::ConnectToSceneGraph()
 {
   DALI_ASSERT_DEBUG( mNode != NULL); DALI_ASSERT_DEBUG( mParent != NULL); DALI_ASSERT_DEBUG( mParent->mNode != NULL );
 
   if( NULL != mNode )
   {
     // Reparent Node in next Update
-    ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), *(mParent->mNode), *mNode, index );
+    ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), *(mParent->mNode), *mNode );
   }
 
   // Notify attachment
@@ -3370,7 +3369,7 @@ int Actor::GetPropertyComponentIndex( Property::Index index ) const
   return componentIndex;
 }
 
-void Actor::SetParent( Actor* parent, int index )
+void Actor::SetParent( Actor* parent )
 {
   if( parent )
   {
@@ -3382,7 +3381,7 @@ void Actor::SetParent( Actor* parent, int index )
          parent->OnStage() )
     {
       // Instruct each actor to create a corresponding node in the scene graph
-      ConnectToStage( parent->GetHierarchyDepth(), index );
+      ConnectToStage( parent->GetHierarchyDepth() );
     }
   }
   else // parent being set to NULL
index 9a5e971..6887d8b 100644 (file)
@@ -1492,26 +1492,22 @@ protected:
 
   /**
    * Called on a child during Add() when the parent actor is connected to the Stage.
-   * @param[in] stage The stage.
-   * @param[in] parentDepth The depth of the parent in the hierarchy
-   * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
+   * @param[in] parentDepth The depth of the parent in the hierarchy.
    */
-  void ConnectToStage( unsigned int parentDepth, int index = -1 );
+  void ConnectToStage( unsigned int parentDepth );
 
   /**
    * Helper for ConnectToStage, to recursively connect a tree of actors.
    * This is atomic i.e. not interrupted by user callbacks.
-   * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
-   * @param[in] depth The depth in the hierarchy of the actor
+   * @param[in]  depth The depth in the hierarchy of the actor
    * @param[out] connectionList On return, the list of connected actors which require notification.
    */
-  void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth, int index = -1 );
+  void RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth );
 
   /**
    * Connect the Node associated with this Actor to the scene-graph.
-   * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
    */
-  void ConnectToSceneGraph( int index = -1 );
+  void ConnectToSceneGraph();
 
   /**
    * Helper for ConnectToStage, to notify a connected actor through the public API.
@@ -1652,9 +1648,8 @@ private:
   /**
    * Set the actors parent.
    * @param[in] parent The new parent.
-   * @param[in] index If set, it is only used for positioning the actor within the parent's child list.
    */
-  void SetParent( Actor* parent, int index = -1 );
+  void SetParent( Actor* parent );
 
   /**
    * Helper to create a Node for this Actor.
index 5afcf94..0288a02 100644 (file)
@@ -357,7 +357,7 @@ void UpdateManager::AddNode( Node* node )
   mImpl->activeDisconnectedNodes.insert( node ); // Takes ownership of node
 }
 
-void UpdateManager::ConnectNode( Node* parent, Node* node, int index )
+void UpdateManager::ConnectNode( Node* parent, Node* node )
 {
   DALI_ASSERT_ALWAYS( NULL != parent );
   DALI_ASSERT_ALWAYS( NULL != node );
@@ -374,7 +374,7 @@ void UpdateManager::ConnectNode( Node* parent, Node* node, int index )
 
   node->SetActive( true );
 
-  parent->ConnectChild( node, index );
+  parent->ConnectChild( node );
 }
 
 void UpdateManager::DisconnectNode( Node* node )
index 5c23c9f..7fd446f 100644 (file)
@@ -151,10 +151,9 @@ public:
    * Connect a Node to the scene-graph.
    * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
    * @pre The node does not already have a parent.
-   * @param[in] node The new parent node.
-   * @param[in] node The node to connect.
+   * @param[in] parent The new parent node.
    */
-  void ConnectNode( Node* parent, Node* node, int index );
+  void ConnectNode( Node* parent, Node* node );
 
   /**
    * Disconnect a Node from the scene-graph.
@@ -526,19 +525,19 @@ inline void AddNodeMessage( UpdateManager& manager, Node& node )
   new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
 }
 
-inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild, int index )
+inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
 {
   // Update thread can edit the object
   Node& parent = const_cast< Node& >( constParent );
   Node& child = const_cast< Node& >( constChild );
 
-  typedef MessageValue3< UpdateManager, Node*, Node*, int > LocalType;
+  typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
 
   // Reserve some memory inside the message queue
   unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child, index );
+  new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
 }
 
 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
index db5798f..e94d61f 100644 (file)
@@ -110,7 +110,7 @@ void Node::SetRoot(bool isRoot)
   mIsRoot = isRoot;
 }
 
-void Node::ConnectChild( Node* childNode, int index )
+void Node::ConnectChild( Node* childNode )
 {
   DALI_ASSERT_ALWAYS( this != childNode );
   DALI_ASSERT_ALWAYS( IsRoot() || NULL != mParent ); // Parent should be connected first
@@ -121,14 +121,8 @@ void Node::ConnectChild( Node* childNode, int index )
   // Everything should be reinherited when reconnected to scene-graph
   childNode->SetAllDirtyFlags();
 
-  if (index == -1)
-  {
-    mChildren.PushBack( childNode );
-  }
-  else
-  {
-    mChildren.Insert(mChildren.Begin()+index, childNode);
-  }
+  // Add the node to the end of the child list.
+  mChildren.PushBack( childNode );
 
   // Inform property observers of new connection
   childNode->ConnectToSceneGraph();
index 7c4242b..0a47341 100644 (file)
@@ -226,10 +226,8 @@ public:
    * @pre The childNode does not already have a parent.
    * @pre The childNode is not a root node.
    * @param[in] childNode The child to add.
-   * @param[in] index to insert at, if not supplied or -1 it will be appended
-   *
    */
-  void ConnectChild( Node* childNode, int index = -1);
+  void ConnectChild( Node* childNode );
 
   /**
    * Disconnect a child (& its children) from the scene-graph.