uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp
changeset 19 f5bac0badc7e
parent 14 83d2d132aa58
child 29 ac3859d43844
equal deleted inserted replaced
14:83d2d132aa58 19:f5bac0badc7e
  1080                 //   |   0   1   2   3   4 
  1080                 //   |   0   1   2   3   4 
  1081                 //   +-->A ->B ->C ->D ->E ->null 
  1081                 //   +-->A ->B ->C ->D ->E ->null 
  1082                 //                           ^^^ 
  1082                 //                           ^^^ 
  1083                 // if iterNode gets to NULL, then we must have found both matches 
  1083                 // if iterNode gets to NULL, then we must have found both matches 
  1084                 // - i.e. either the new or current/old position is the rightmost node   
  1084                 // - i.e. either the new or current/old position is the rightmost node   
  1085                 ASSERT(oldPrevNode!=NULL && newPrevNode!=NULL); 
  1085                 if (oldPrevNode == NULL || newPrevNode == NULL )
       
  1086                     {
       
  1087                     // Fatal error! Node tree is corrupted.
       
  1088                     __ALFLOGSTRING4("CAlfNode::SiblingOrderChanged(). Fatal error! Node tree is corrupted. oldPrevNode=0x%x, newPrevNode=0x%x, iterNodePosition=%d, aNewPos=%d", 
       
  1089                             oldPrevNode, newPrevNode, iterNodePosition, aNewPos);                    
       
  1090                     __ALFLOGSTRING4("CAlfNode::SiblingOrderChanged(). This node=0x%x, type = %d, parent node=0x%x, parent type=%d", this, Type(), iParent, iParent->Type());
       
  1091                     __ALFLOGSTRING2("CAlfNode::SiblingOrderChanged(). This node id=0x%x, parent node id=0x%x", iId, iParent->iId);
       
  1092                     __ASSERT_ALWAYS(EFalse, USER_INVARIANT());    
       
  1093                     //__ASSERT_DEBUG(EFalse, USER_INVARIANT()); 
       
  1094                     return;  
       
  1095                     }
  1086                 } 
  1096                 } 
  1087 
       
  1088             ASSERT(iterPrevNode!=NULL);                 
  1097             ASSERT(iterPrevNode!=NULL);                 
  1089         } // end while loop 
  1098         } // end while loop 
  1090 
  1099 
  1091     if (newPrevNode == oldPrevNode) 
  1100     if (newPrevNode == oldPrevNode) 
  1092         { 
  1101         { 
  1718 	aStream->ReadL( (TUint8*)&iNodeWindowConstructionStruct, sizeof( TNodeWindowConstructionStruct ) );
  1727 	aStream->ReadL( (TUint8*)&iNodeWindowConstructionStruct, sizeof( TNodeWindowConstructionStruct ) );
  1719     iOrdinalPriority = iNodeWindowConstructionStruct.iOrdinalPriority;
  1728     iOrdinalPriority = iNodeWindowConstructionStruct.iOrdinalPriority;
  1720     ResolveParent( iNodeWindowConstructionStruct.iParentId, iId );
  1729     ResolveParent( iNodeWindowConstructionStruct.iParentId, iId );
  1721     CreateWindowL( iNodeWindowConstructionStruct.iWindowGroupHandle, iNodeWindowConstructionStruct.iWindowHandle, iNodeWindowConstructionStruct.iParentId );
  1730     CreateWindowL( iNodeWindowConstructionStruct.iWindowGroupHandle, iNodeWindowConstructionStruct.iWindowHandle, iNodeWindowConstructionStruct.iParentId );
  1722     UpdateOrdinalPosition();
  1731     UpdateOrdinalPosition();
       
  1732     
       
  1733     AMT_MAP_STREAMER_NODE_WINDOW_CONSTRUCT();
  1723 	}
  1734 	}
  1724 
  1735 
  1725 // ---------------------------------------------------------------------------
  1736 // ---------------------------------------------------------------------------
  1726 // MoveToWindowGroup
  1737 // MoveToWindowGroup
  1727 // ---------------------------------------------------------------------------
  1738 // ---------------------------------------------------------------------------
  1898 	
  1909 	
  1899     iModel->Server().Bridge()->AddData( EAlfDSNewWindow, 
  1910     iModel->Server().Bridge()->AddData( EAlfDSNewWindow, 
  1900             iGroupId, 
  1911             iGroupId, 
  1901             iId, 
  1912             iId, 
  1902             (TAny*)offset );
  1913             (TAny*)offset );
       
  1914     
       
  1915     AMT_MAP_STREAMER_NODE_GROUP_CONSTRUCT();
  1903 	}
  1916 	}
  1904 
  1917 
  1905 // ---------------------------------------------------------------------------
  1918 // ---------------------------------------------------------------------------
  1906 // NewL
  1919 // NewL
  1907 // ---------------------------------------------------------------------------
  1920 // ---------------------------------------------------------------------------
  2131             iGroupId, 
  2144             iGroupId, 
  2132             iId, 
  2145             iId, 
  2133             (TAny*)offset );
  2146             (TAny*)offset );
  2134     
  2147     
  2135     UpdateOrdinalPosition();
  2148     UpdateOrdinalPosition();
       
  2149     
       
  2150     AMT_MAP_STREAMER_TEXT_CURSOR_CONSTRUCT();
  2136     }
  2151     }
  2137 
  2152 
  2138 // ---------------------------------------------------------------------------
  2153 // ---------------------------------------------------------------------------
  2139 // NewL
  2154 // NewL
  2140 // ---------------------------------------------------------------------------
  2155 // ---------------------------------------------------------------------------
  2149     return self;
  2164     return self;
  2150     }
  2165     }
  2151 
  2166 
  2152 void CAlfNodeTextCursor::AttributeChangedL( RMemReadStream* aStream )
  2167 void CAlfNodeTextCursor::AttributeChangedL( RMemReadStream* aStream )
  2153     {
  2168     {
       
  2169     AMT_MAP_BRIDGE_ADD_TEXT_CURSOR();
       
  2170     
  2154     // TODO: PASS FORWARD!!!
  2171     // TODO: PASS FORWARD!!!
  2155     TInt attribute = aStream->ReadInt32L();
  2172     TInt attribute = aStream->ReadInt32L();
  2156     switch ( attribute )
  2173     switch ( attribute )
  2157         {
  2174         {
  2158         case MWsWindowTreeObserver::ECursorType:
  2175         case MWsWindowTreeObserver::ECursorType:
  2187        __ALFLOGSTRING("Forwarding cursor data");
  2204        __ALFLOGSTRING("Forwarding cursor data");
  2188        iModel->Server().Bridge()->AddData( EAlfDSSetCursorData, 
  2205        iModel->Server().Bridge()->AddData( EAlfDSSetCursorData, 
  2189                iGroupId, 
  2206                iGroupId, 
  2190                iId, 
  2207                iId, 
  2191                (TAny*)offset );
  2208                (TAny*)offset );
       
  2209        
       
  2210    AMT_MAP_STREAMER_TEXT_CURSOR_CHANGE();
  2192     }
  2211     }
  2193 CAlfNodeTextCursor::~CAlfNodeTextCursor( )
  2212 CAlfNodeTextCursor::~CAlfNodeTextCursor( )
  2194     {
  2213     {
  2195     // text cursor is the only text cursor in its parent. No need to check siblings.
  2214     // text cursor is the only text cursor in its parent. No need to check siblings.
  2196     if(iParent)
  2215     if(iParent)
  2202         {
  2221         {
  2203         iModel->RemoveNode( iId );
  2222         iModel->RemoveNode( iId );
  2204         }
  2223         }
  2205     }
  2224     }
  2206 
  2225 
       
  2226 #ifdef __WINS__
       
  2227 // ---------------------------------------------------------------------------
       
  2228 // 
       
  2229 // ---------------------------------------------------------------------------
       
  2230 //
       
  2231 void CAlfNode::Debug_CheckSiblingOrder(const TDesC16& aContext)
       
  2232    {
       
  2233    if (!iParent || Type() != MWsWindowTreeNode::EWinTreeNodeClient)
       
  2234        {
       
  2235        return;
       
  2236        }
       
  2237    
       
  2238    TBool foundMyself = EFalse;
       
  2239    TInt iterNodePosition = 0; 
       
  2240    
       
  2241    // Search for myselk in iParent sibling list
       
  2242    for(CAlfNode* iterNode = iParent->iChild; iterNode != NULL; iterNode = iterNode->iSibling, iterNodePosition++)
       
  2243        {
       
  2244        if (iterNode == this) 
       
  2245            {
       
  2246            foundMyself = ETrue;
       
  2247            }  
       
  2248        }
       
  2249    
       
  2250    if(!foundMyself)
       
  2251        {
       
  2252        // Did not find myself from the parent sibling list ==> error!
       
  2253        __ALFLOGSTRING2("CAlfNode::Test_CheckSiblingOrder(). Fatal error! Node tree is corrupted.  at %S: iId=0x%x", &aContext, iId );                    
       
  2254        __ALFLOGSTRING3("CAlfNode::Test_CheckSiblingOrder(). iterNodePosition=%d, iChild=0x%x, iSibling=0x%x", iterNodePosition, iChild, iSibling );                    
       
  2255        __ALFLOGSTRING3("CAlfNode::Test_CheckSiblingOrder(). iSpriteChild=0x%x, iAnimChild=0x%x, iTextCursor=0x%x", iSpriteChild, iAnimChild, iTextCursor );                    
       
  2256        __ALFLOGSTRING4("CAlfNode::Test_CheckSiblingOrder(). This node=0x%x, type = %d, parent node=0x%x, parent type=%d", this, Type(), iParent, iParent->Type());
       
  2257        // Print sibling list
       
  2258        iterNodePosition=0;     
       
  2259        __ALFLOGSTRING("CAlfNode::Test_CheckSiblingOrder(). SIBLINGS:");
       
  2260        for(CAlfNode* iterNode2 = iParent->iChild; iterNode2!=NULL; iterNode2 = iterNode2->iSibling, iterNodePosition++)
       
  2261            {
       
  2262            __ALFLOGSTRING4("CAlfNode::Test_CheckSiblingOrder(). *** iterNodePosition=%d, id=%d, this=0x%x, iChild=0x%x", iterNodePosition, iterNode2->iId, iterNode2, iterNode2->iChild );                    
       
  2263            __ALFLOGSTRING3("CAlfNode::Test_CheckSiblingOrder(). iSpriteChild=0x%x, iAnimChild=0x%x, iTextCursor=0x%x", iterNode2->iSpriteChild, iterNode2->iAnimChild, iterNode2->iTextCursor );                    
       
  2264            }                 
       
  2265        
       
  2266        __ASSERT_ALWAYS(EFalse, USER_INVARIANT());   
       
  2267        }
       
  2268    }
       
  2269 #endif
       
  2270 
  2207 // end of file
  2271 // end of file
  2208 
  2272