uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp
branchRCL_3
changeset 7 88b23e2e82e1
parent 6 10534483575f
child 8 46927d61fef3
equal deleted inserted replaced
6:10534483575f 7:88b23e2e82e1
   212 void CAlfNode::GetAllChildrenInGroup( RPointerArray<CAlfNode>& aNodes, TUint32 aParentId )
   212 void CAlfNode::GetAllChildrenInGroup( RPointerArray<CAlfNode>& aNodes, TUint32 aParentId )
   213 	{
   213 	{
   214 	if ( iParent->iType != MWsWindowTreeNode::EWinTreeNodeRoot)
   214 	if ( iParent->iType != MWsWindowTreeNode::EWinTreeNodeRoot)
   215 		{
   215 		{
   216 		CAlfNode* parentGroupNode = iModel->FindNode( aParentId );
   216 		CAlfNode* parentGroupNode = iModel->FindNode( aParentId );
       
   217 		aNodes.Append(parentGroupNode); 
   217 		for (CAlfNode::TIter iter( parentGroupNode ); iter.Current() != NULL;  iter.Next()) 
   218 		for (CAlfNode::TIter iter( parentGroupNode ); iter.Current() != NULL;  iter.Next()) 
   218 			{ 
   219 			{ 
   219 			aNodes.Append(iter.Current()); 
   220 			if (iter.Current() != parentGroupNode )
       
   221 			    {
       
   222 			    aNodes.Append(iter.Current());
       
   223 			    }
   220 			}
   224 			}
   221 		}
   225 		}
   222 	else
   226 	else
   223 		{
   227 		{
   224 		CAlfNode* child = iParent->iChild;
   228 		CAlfNode* child = iParent->iChild;
  1714 	aStream->ReadL( (TUint8*)&iNodeWindowConstructionStruct, sizeof( TNodeWindowConstructionStruct ) );
  1718 	aStream->ReadL( (TUint8*)&iNodeWindowConstructionStruct, sizeof( TNodeWindowConstructionStruct ) );
  1715     iOrdinalPriority = iNodeWindowConstructionStruct.iOrdinalPriority;
  1719     iOrdinalPriority = iNodeWindowConstructionStruct.iOrdinalPriority;
  1716     ResolveParent( iNodeWindowConstructionStruct.iParentId, iId );
  1720     ResolveParent( iNodeWindowConstructionStruct.iParentId, iId );
  1717     CreateWindowL( iNodeWindowConstructionStruct.iWindowGroupHandle, iNodeWindowConstructionStruct.iWindowHandle, iNodeWindowConstructionStruct.iParentId );
  1721     CreateWindowL( iNodeWindowConstructionStruct.iWindowGroupHandle, iNodeWindowConstructionStruct.iWindowHandle, iNodeWindowConstructionStruct.iParentId );
  1718     UpdateOrdinalPosition();
  1722     UpdateOrdinalPosition();
       
  1723     
       
  1724     AMT_MAP_STREAMER_NODE_WINDOW_CONSTRUCT();
  1719 	}
  1725 	}
  1720 
  1726 
  1721 // ---------------------------------------------------------------------------
  1727 // ---------------------------------------------------------------------------
  1722 // MoveToWindowGroup
  1728 // MoveToWindowGroup
  1723 // !!!! THIS METHOD HAS NOT BEEN TESTED AT ALL!!!!!! EXPECT TROUBLE!!!!
       
  1724 // ---------------------------------------------------------------------------
  1729 // ---------------------------------------------------------------------------
  1725 //
  1730 //
  1726 void CAlfNodeWindow::MoveToWindowGroup( TUint32 aNewGroupId )
  1731 void CAlfNodeWindow::MoveToWindowGroup( TUint32 aNewGroupId )
  1727 	{
  1732 	{
  1728 	__ALFLOGSTRING("CAlfNodeWindow::MoveToWindowGroup, THIS METHOD IS UNTESTED. EXPECT TROUBLE!");
  1733 	__ALFLOGSTRING3("CAlfNodeWindow::MoveToWindowGroup moving nodeID 0x%x from group 0x%x to 0x%x",iId, iParent->iId, aNewGroupId );
  1729 	CAlfNodeGroup* newGroup = (CAlfNodeGroup*)iModel->FindNode( aNewGroupId );
  1734 	CAlfNodeGroup* newGroup = (CAlfNodeGroup*)iModel->FindNode( aNewGroupId );
  1730 	if ( newGroup )
  1735 	if ( newGroup )
  1731 		{
  1736 		{
  1732 		// collect my children in my old group
  1737 		// collect my children in my old group (inclucing me)
  1733 		RPointerArray<CAlfNode> myChildNodes;
  1738 		RPointerArray<CAlfNode> myChildNodes;
  1734 		GetAllChildrenInGroup( myChildNodes, iId );
  1739 		GetAllChildrenInGroup( myChildNodes, iId );
  1735 			    
  1740 			    
  1736 		// release old relationships
  1741 		// release old relationships
  1737 		CAlfNode* previous = FindPreviousChild();
  1742 		CAlfNode* previous = FindPreviousChild();
  1741 			}
  1746 			}
  1742 		else
  1747 		else
  1743 			{
  1748 			{
  1744 			previous->iSibling = iSibling; // there was the a previous child. update the link to my next sibling (which might be NULL)
  1749 			previous->iSibling = iSibling; // there was the a previous child. update the link to my next sibling (which might be NULL)
  1745 			}
  1750 			}
  1746 		TUint32 oldGroupId = iParent->iId;
  1751 
  1747 		iParent = newGroup;
       
  1748 		SetFirstChild();
       
  1749 		
       
  1750 		// yippii, new parent, 		
  1752 		// yippii, new parent, 		
  1751 		// add me as the first child of the new group
  1753 		// add me as the first child of the new group
  1752 		// TODO: Move the nodes to the new group?
  1754 		iParent = newGroup;
       
  1755 		iSibling = NULL;
       
  1756 		SetFirstChild();
       
  1757 
       
  1758 		TUint32 screenNumber = iScreenNumber;
       
  1759 
  1753 		TInt i = myChildNodes.Count();
  1760 		TInt i = myChildNodes.Count();
  1754 		while( --i >=0 ) // update groupid and send new location to appui 
  1761 		while( --i >=0 ) // update groupid and send new location to appui 
  1755 			{
  1762 		    {
  1756 			iModel->Server().Bridge()->AddData( EAlfDSMoveWindowToNewGroup, 
  1763 		    iModel->Server().Bridge()->AddData( EAlfDSMoveWindowToNewGroup, 
  1757 					myChildNodes[i]->iId, 
  1764 		            myChildNodes[i]->iId, 
  1758 					oldGroupId, 
  1765 		            screenNumber, 
  1759 					(TAny*)aNewGroupId );
  1766 		            (TAny*)aNewGroupId );
  1760 			myChildNodes[i]->iGroupId = aNewGroupId;
  1767 			myChildNodes[i]->iGroupId = aNewGroupId;
  1761 			}
  1768 			}
  1762 	  
  1769 	  
  1763 		myChildNodes.Close();
  1770 		myChildNodes.Close();
  1764 		}
  1771 		}
  1893 	
  1900 	
  1894     iModel->Server().Bridge()->AddData( EAlfDSNewWindow, 
  1901     iModel->Server().Bridge()->AddData( EAlfDSNewWindow, 
  1895             iGroupId, 
  1902             iGroupId, 
  1896             iId, 
  1903             iId, 
  1897             (TAny*)offset );
  1904             (TAny*)offset );
       
  1905     
       
  1906     AMT_MAP_STREAMER_NODE_GROUP_CONSTRUCT();
  1898 	}
  1907 	}
  1899 
  1908 
  1900 // ---------------------------------------------------------------------------
  1909 // ---------------------------------------------------------------------------
  1901 // NewL
  1910 // NewL
  1902 // ---------------------------------------------------------------------------
  1911 // ---------------------------------------------------------------------------
  2126             iGroupId, 
  2135             iGroupId, 
  2127             iId, 
  2136             iId, 
  2128             (TAny*)offset );
  2137             (TAny*)offset );
  2129     
  2138     
  2130     UpdateOrdinalPosition();
  2139     UpdateOrdinalPosition();
       
  2140     
       
  2141     AMT_MAP_STREAMER_TEXT_CURSOR_CONSTRUCT();
  2131     }
  2142     }
  2132 
  2143 
  2133 // ---------------------------------------------------------------------------
  2144 // ---------------------------------------------------------------------------
  2134 // NewL
  2145 // NewL
  2135 // ---------------------------------------------------------------------------
  2146 // ---------------------------------------------------------------------------
  2144     return self;
  2155     return self;
  2145     }
  2156     }
  2146 
  2157 
  2147 void CAlfNodeTextCursor::AttributeChangedL( RMemReadStream* aStream )
  2158 void CAlfNodeTextCursor::AttributeChangedL( RMemReadStream* aStream )
  2148     {
  2159     {
       
  2160     AMT_MAP_BRIDGE_ADD_TEXT_CURSOR();
       
  2161     
  2149     // TODO: PASS FORWARD!!!
  2162     // TODO: PASS FORWARD!!!
  2150     TInt attribute = aStream->ReadInt32L();
  2163     TInt attribute = aStream->ReadInt32L();
  2151     switch ( attribute )
  2164     switch ( attribute )
  2152         {
  2165         {
  2153         case MWsWindowTreeObserver::ECursorType:
  2166         case MWsWindowTreeObserver::ECursorType:
  2182        __ALFLOGSTRING("Forwarding cursor data");
  2195        __ALFLOGSTRING("Forwarding cursor data");
  2183        iModel->Server().Bridge()->AddData( EAlfDSSetCursorData, 
  2196        iModel->Server().Bridge()->AddData( EAlfDSSetCursorData, 
  2184                iGroupId, 
  2197                iGroupId, 
  2185                iId, 
  2198                iId, 
  2186                (TAny*)offset );
  2199                (TAny*)offset );
       
  2200        
       
  2201    AMT_MAP_STREAMER_TEXT_CURSOR_CHANGE();
  2187     }
  2202     }
  2188 CAlfNodeTextCursor::~CAlfNodeTextCursor( )
  2203 CAlfNodeTextCursor::~CAlfNodeTextCursor( )
  2189     {
  2204     {
  2190     // text cursor is the only text cursor in its parent. No need to check siblings.
  2205     // text cursor is the only text cursor in its parent. No need to check siblings.
  2191     if(iParent)
  2206     if(iParent)