photosgallery/viewframework/views/cloudview/src/glxcloudviewcontrol.cpp
branchRCL_3
changeset 14 ce1c7ad1f18b
parent 9 6b87b143d312
child 22 2dac0fdba72b
equal deleted inserted replaced
13:71da52165949 14:ce1c7ad1f18b
   220 // ---------------------------------------------------------------------------
   220 // ---------------------------------------------------------------------------
   221 //
   221 //
   222 void CGlxCloudViewControl::VisualLayoutUpdated(CAlfVisual &/* aVisual*/)
   222 void CGlxCloudViewControl::VisualLayoutUpdated(CAlfVisual &/* aVisual*/)
   223     {
   223     {
   224     TRACER("GLX_CLOUD::CGlxCloudViewControl::VisualLayoutUpdated");
   224     TRACER("GLX_CLOUD::CGlxCloudViewControl::VisualLayoutUpdated");
       
   225 	
       
   226 	//If the grid is already shown , disable it
       
   227     if(iTagsContextMenuControl->ItemMenuVisibility())
       
   228        {
       
   229        iTagsContextMenuControl->ShowItemMenu(EFalse);
       
   230        }
   225     TRect rect;
   231     TRect rect;
   226     AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect);
   232     AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect);
   227     if ((rect.Width() != (iTagScreenWidth + iScrollPaneHandle.iW + KRightmargin)) || (rect.Height() != iScreenHeight))
   233     if ((rect.Width() != (iTagScreenWidth + iScrollPaneHandle.iW + KRightmargin)) || (rect.Height() != iScreenHeight))
   228         {
   234         {
   229         //set the new screen dimensions
   235         //set the new screen dimensions
   242     iCloudInfo.Close ();
   248     iCloudInfo.Close ();
   243     iLabels.Close();
   249     iLabels.Close();
   244     iMediaList.RemoveContext (iAttributeContext);
   250     iMediaList.RemoveContext (iAttributeContext);
   245     iMediaList.RemoveMediaListObserver (this);
   251     iMediaList.RemoveMediaListObserver (this);
   246     delete iAttributeContext;
   252     delete iAttributeContext;
   247     /*if ( iBubbleContainer )
       
   248 		{
       
   249 		iBubbleContainer->SetHost (NULL);
       
   250 		delete iBubbleContainer;
       
   251 		}*/
       
   252 
   253 
   253     if ( iUiUtility )
   254     if ( iUiUtility )
   254         {
   255         {
   255         iUiUtility->Close ();
   256         iUiUtility->Close ();
   256         }	
   257         }	
   685 
   686 
   686     if ( iLabels.Count()-1 >= iMediaList.FocusIndex())
   687     if ( iLabels.Count()-1 >= iMediaList.FocusIndex())
   687         {
   688         {
   688         //to highlight focused element 
   689         //to highlight focused element 
   689         SetFocusColor(); 
   690         SetFocusColor(); 
   690         //CalculateBubleMidPoint ();   
       
   691         }
   691         }
   692     }
   692     }
   693 
   693 
   694 
   694 
   695 // --------------------------------------------------------------------------- 
   695 // --------------------------------------------------------------------------- 
   749 //
   749 //
   750 void CGlxCloudViewControl::FetchAttributeFromCacheL()
   750 void CGlxCloudViewControl::FetchAttributeFromCacheL()
   751     {
   751     {
   752     TRACER("GLX_CLOUD::CGlxCloudViewControl::FetchAttributeFromCacheL");
   752     TRACER("GLX_CLOUD::CGlxCloudViewControl::FetchAttributeFromCacheL");
   753     GLX_LOG_INFO("GLX_CLOUD ::CGlxCloudViewControl::FetchAttributeFromCache MediaList already filled" );
   753     GLX_LOG_INFO("GLX_CLOUD ::CGlxCloudViewControl::FetchAttributeFromCache MediaList already filled" );
   754     //enable msk as the medialist is populated
       
   755     //iObserver.HandleMskChangedL (ETrue);
       
   756     iLayoutObserver.HandleLayoutChanged();
   754     iLayoutObserver.HandleLayoutChanged();
   757     if ( iLabels.Count ()==0)
   755     if ( iLabels.Count ()==0)
   758         {
   756         {
   759         for (TInt i=0; i<iMediaList.Count();i++)
   757         for (TInt i=0; i<iMediaList.Count();i++)
   760             {
   758             {
  1195     // no shadow wanted for the text
  1193     // no shadow wanted for the text
  1196     iEmptyString->EnableShadow( EFalse );
  1194     iEmptyString->EnableShadow( EFalse );
  1197 
  1195 
  1198     //disable msk
  1196     //disable msk
  1199     iLayoutObserver.HandleLayoutChanged();
  1197     iLayoutObserver.HandleLayoutChanged();
  1200     //iObserver.HandleMskChangedL (EFalse);
       
  1201     iScrollEventData.mSpan = 0;
  1198     iScrollEventData.mSpan = 0;
  1202     iScrollEventData.mViewLength = 0;
  1199     iScrollEventData.mViewLength = 0;
  1203     DisplayScrollBar();
  1200     DisplayScrollBar();
  1204     GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::DisplayEmptyCloudView layout Count after reset  %d ", iLayout->Count());
  1201     GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::DisplayEmptyCloudView layout Count after reset  %d ", iLayout->Count());
  1205     }
  1202     }
  1287 // CreateBubleContainer()
  1284 // CreateBubleContainer()
  1288 // ---------------------------------------------------------------------------
  1285 // ---------------------------------------------------------------------------
  1289 //   
  1286 //   
  1290 void CGlxCloudViewControl::CreateBubleContainer()
  1287 void CGlxCloudViewControl::CreateBubleContainer()
  1291     {   
  1288     {   
  1292     /* if ( !iBubbleContainer)
       
  1293         {
       
  1294         TRAPD(err1,
       
  1295             {
       
  1296             iBubbleContainer = CGlxContainerInfoBubble::NewL (&iMediaList,
       
  1297             CGlxCloudViewControl::Env (), *this);
       
  1298             });
       
  1299             ;
       
  1300         if ( err1!= KErrNone)
       
  1301             {
       
  1302             GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::LayoutVisibleArea - Error (%d)", err1);
       
  1303             }
       
  1304         iBubbleContainer->SetHost (this);
       
  1305         }*/
       
  1306     }
  1289     }
  1307 
  1290 
  1308 // ---------------------------------------------------------------------------
  1291 // ---------------------------------------------------------------------------
  1309 // MoveUpIfRequired()
  1292 // MoveUpIfRequired()
  1310 // ---------------------------------------------------------------------------
  1293 // ---------------------------------------------------------------------------
  1336         iViewPortPosition.iY = iViewPortVirtualSize.iHeight - iViewPortSize.iHeight;
  1319         iViewPortPosition.iY = iViewPortVirtualSize.iHeight - iViewPortSize.iHeight;
  1337         }
  1320         }
  1338     iViewPortLayout->SetViewportPos(iViewPortPosition, KSlowCloudMovement);
  1321     iViewPortLayout->SetViewportPos(iViewPortPosition, KSlowCloudMovement);
  1339     iScrollEventData.mViewStartPos = iViewPortPosition.iY;
  1322     iScrollEventData.mViewStartPos = iViewPortPosition.iY;
  1340     Scroll();  
  1323     Scroll();  
  1341     //CalculateBubleMidPoint ();   
       
  1342     }
  1324     }
  1343 
  1325 
  1344 
  1326 
  1345 // ---------------------------------------------------------------------------
  1327 // ---------------------------------------------------------------------------
  1346 // MoveDownIfRequired()
  1328 // MoveDownIfRequired()
  1374     iScrollEventData.mViewStartPos = iViewPortPosition.iY;
  1356     iScrollEventData.mViewStartPos = iViewPortPosition.iY;
  1375     if(iScrollBarWidget)
  1357     if(iScrollBarWidget)
  1376         {
  1358         {
  1377         Scroll();           
  1359         Scroll();           
  1378         }
  1360         }
  1379     //CalculateBubleMidPoint();   
       
  1380     }     
  1361     }     
  1381 
  1362 
  1382 // ---------------------------------------------------------------------------
  1363 // ---------------------------------------------------------------------------
  1383 // MoveDownIfRequired()
  1364 // MoveDownIfRequired()
  1384 // ---------------------------------------------------------------------------
  1365 // ---------------------------------------------------------------------------
  1417     midpoint.iX+=anchorRect.iX;
  1398     midpoint.iX+=anchorRect.iX;
  1418     midpoint.iY+=anchorRect.iY; 
  1399     midpoint.iY+=anchorRect.iY; 
  1419 
  1400 
  1420     //Substract from the viewport position the viewport position    
  1401     //Substract from the viewport position the viewport position    
  1421     SetBubleMidPoint(midpoint);   
  1402     SetBubleMidPoint(midpoint);   
  1422 
       
  1423     //Set the buble focus    
       
  1424     // iBubbleContainer->SetFocus (midpoint);
       
  1425     } 
  1403     } 
  1426 
  1404 
  1427 // ---------------------------------------------------------------------------
  1405 // ---------------------------------------------------------------------------
  1428 // HandlePointerEventL()
  1406 // HandlePointerEventL()
  1429 // ---------------------------------------------------------------------------
  1407 // ---------------------------------------------------------------------------
  1432     {
  1410     {
  1433     TRACER("GLX_CLOUD::CGlxCloudViewControl::HandlePointerEventL");
  1411     TRACER("GLX_CLOUD::CGlxCloudViewControl::HandlePointerEventL");
  1434     CAlfVisual* tappedvisual = aEvent.Visual();	
  1412     CAlfVisual* tappedvisual = aEvent.Visual();	
  1435     TBool consumed = EFalse;
  1413     TBool consumed = EFalse;
  1436     
  1414     
       
  1415 
  1437     if(aEvent.PointerEvent().iType == TPointerEvent::EButton1Down)
  1416     if(aEvent.PointerEvent().iType == TPointerEvent::EButton1Down)
  1438         {	
  1417         {	
       
  1418         iDownEventReceived = EFalse;
  1439         //reset variables & Physics simulator 
  1419         //reset variables & Physics simulator 
  1440         iPhysics->StopPhysics();
  1420         iPhysics->StopPhysics();
  1441         iPhysics->ResetFriction();
  1421         iPhysics->ResetFriction();
  1442         iDragging = EFalse;
  1422         iDragging = EFalse;
  1443         iPhysicsStarted = EFalse;
  1423         iPhysicsStarted = EFalse;
  1447                 EAlfPointerEventReportDrag + EAlfPointerEventReportLongTap
  1427                 EAlfPointerEventReportDrag + EAlfPointerEventReportLongTap
  1448                         + EAlfPointerEventReportUnhandled, *this);
  1428                         + EAlfPointerEventReportUnhandled, *this);
  1449         Display()->Roster().DisableLongTapEventsWhenDragging(*this);
  1429         Display()->Roster().DisableLongTapEventsWhenDragging(*this);
  1450         
  1430         
  1451         //If the grid is already shown , disable it
  1431         //If the grid is already shown , disable it
  1452         iTagsContextMenuControl->ShowItemMenu(EFalse);
  1432         if(iTagsContextMenuControl->ItemMenuVisibility())
  1453 
  1433            {
       
  1434            iDownEventReceived = ETrue;
       
  1435            iTagsContextMenuControl->ShowItemMenu(EFalse);
       
  1436            return ETrue;
       
  1437            }
  1454         if(tappedvisual)
  1438         if(tappedvisual)
  1455             {
  1439             {
  1456             for(TInt index=0;index<iLayout->Count();index++)
  1440             for(TInt index=0;index<iLayout->Count();index++)
  1457                 {    	
  1441                 {    	
  1458                 CAlfVisual* layoutvisual = &(iLayout->Visual(index));
  1442                 CAlfVisual* layoutvisual = &(iLayout->Visual(index));
  1471                     break;
  1455                     break;
  1472                     }
  1456                     }
  1473                 }
  1457                 }
  1474             }
  1458             }
  1475         }
  1459         }
       
  1460     else if(iDownEventReceived)
       
  1461         {
       
  1462         consumed = ETrue;
       
  1463         }
  1476     else if (aEvent.PointerEvent().iType == TPointerEvent::EDrag)
  1464     else if (aEvent.PointerEvent().iType == TPointerEvent::EDrag)
  1477         {
  1465         {
  1478         GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandlePointerEventL(EDrag) event");
  1466         GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandlePointerEventL(EDrag) event");
  1479         
  1467         
  1480         iTouchFeedback->InstantFeedback(ETouchFeedbackBasic);
  1468         iTouchFeedback->InstantFeedback(ETouchFeedbackBasic);
  1493             }
  1481             }
  1494 
  1482 
  1495         //Check if dragging actually happened using iViewDragged 
  1483         //Check if dragging actually happened using iViewDragged 
  1496         if (iDragging && iViewDragged)
  1484         if (iDragging && iViewDragged)
  1497             {
  1485             {
       
  1486 			iTimer->Cancel ();//cancels any outstanding requests
       
  1487 						
  1498             iDragging = EFalse;
  1488             iDragging = EFalse;
  1499             TPoint drag = iStart - aEvent.PointerEvent().iPosition;
  1489             TPoint drag = iStart - aEvent.PointerEvent().iPosition;
  1500             iPhysics->StartPhysics(drag, iStartTime);
  1490             iPhysics->StartPhysics(drag, iStartTime);
  1501             iPhysicsStarted = ETrue;
  1491             iPhysicsStarted = ETrue;
  1502             
       
  1503             iTimer->Cancel ();//cancels any outstanding requests
       
  1504             }
  1492             }
  1505         //If dragging not happened consider it as Tapped event
  1493         //If dragging not happened consider it as Tapped event
  1506         //When it recognises the long press event ,  and if up event is received..Ignore it 
  1494         //When it recognises the long press event ,  and if up event is received..Ignore it 
  1507         else if (tappedvisual && !iViewDragged && !iTimerComplete)
  1495         else if (tappedvisual && !iViewDragged && !iTimerComplete)
  1508             {
  1496             {
  1606 
  1594 
  1607     //If found that possibly in next move it might go out of bounds, start physics
  1595     //If found that possibly in next move it might go out of bounds, start physics
  1608     //emulation
  1596     //emulation
  1609     if (iPhysicsStarted && iDragging)
  1597     if (iPhysicsStarted && iDragging)
  1610         {
  1598         {
       
  1599         iTimer->Cancel();
  1611         TPoint drag = iStart - aPointerEvent.iPosition;
  1600         TPoint drag = iStart - aPointerEvent.iPosition;
  1612         iPhysics->StartPhysics(drag, iStartTime);
  1601         iPhysics->StartPhysics(drag, iStartTime);
  1613         iDragging = EFalse;
  1602         iDragging = EFalse;
  1614         }
  1603         }
  1615 
  1604 
  1723                 {
  1712                 {
  1724                 switch(aEvent.CustomParameter())
  1713                 switch(aEvent.CustomParameter())
  1725                     {
  1714                     {
  1726                     case KAlfActionIdDeviceLayoutChanged:
  1715                     case KAlfActionIdDeviceLayoutChanged:
  1727                         {
  1716                         {
  1728                         // iObserver.HandleMskChangedL(ETrue);
       
  1729                         iLayoutObserver.HandleLayoutChanged();
  1717                         iLayoutObserver.HandleLayoutChanged();
  1730                         TRAP_IGNORE(UpdateLayoutL());
  1718                         TRAP_IGNORE(UpdateLayoutL());
  1731                         }
  1719                         }
  1732                          return EEventNotHandled;
  1720                          return EEventNotHandled;
  1733 
  1721