camerauis/cameraapp/generic/src/CamZoomModel.cpp
branchRCL_3
changeset 12 51dda465e618
parent 7 dbec5787fa68
child 17 8f559c47d7fd
equal deleted inserted replaced
11:d486e5e3cc9a 12:51dda465e618
    86     
    86     
    87     // Setting up initial internal values for zoom levels
    87     // Setting up initial internal values for zoom levels
    88     iCurZoomStepOptical = 0;
    88     iCurZoomStepOptical = 0;
    89     iCurZoomStepDigital = 0;        
    89     iCurZoomStepDigital = 0;        
    90 
    90 
       
    91     // Default zoom jump multiplier
       
    92     iZoomStepMultiplier = 1;
       
    93 
    91     // Timer used to give smooth zooming    
    94     // Timer used to give smooth zooming    
    92     iZoomTimer = CPeriodic::NewL( CActive::EPriorityHigh );          
    95     iZoomTimer = CPeriodic::NewL( CActive::EPriorityHigh );          
    93     
    96     
    94     // Register for controller events
    97     // Register for controller events
    95     iController.AddControllerObserverL( this );
    98     iController.AddControllerObserverL( this );
   291         PRINT( _L( "CCamZoomModel::ZoomIn one click" ) );
   294         PRINT( _L( "CCamZoomModel::ZoomIn one click" ) );
   292         iState = ECamZoomModelStateZoomNone;
   295         iState = ECamZoomModelStateZoomNone;
   293         }
   296         }
   294     else
   297     else
   295         {
   298         {
   296         // Start the timer to zoom-in again when timer expires
   299         // Don't restart timer (Auto-stop) timer when no zoom was done
   297         PRINT( _L( "CCamZoomModel::ZoomIn start zoom timer" ) );
   300         if( optZoomJump || digZoomJump || extZoomJump )
   298         StartZoomTimer();
   301             {
       
   302             // Start the timer to zoom-in again when timer expires
       
   303             PRINT( _L( "CCamZoomModel::ZoomIn start zoom timer" ) );
       
   304             StartZoomTimer();
       
   305             }
       
   306         else
       
   307             {
       
   308             PRINT( _L("Camera <> CCamZoomModel::ZoomOut - stopping zoom at boundary") );
       
   309             StopZoom();
       
   310             }
   299         }
   311         }
   300     
   312     
   301     PRINT( _L( "Camera <= CCamZoomModel::ZoomIn " ) );
   313     PRINT( _L( "Camera <= CCamZoomModel::ZoomIn " ) );
   302     }
   314     }
   303 
   315 
   415 //  
   427 //  
   416 void CCamZoomModel::ZoomStepsToJump( TInt& aOpt, TInt& aDig, TInt& aExt ) const
   428 void CCamZoomModel::ZoomStepsToJump( TInt& aOpt, TInt& aDig, TInt& aExt ) const
   417     {  
   429     {  
   418     PRINT( _L( "Camera => CCamZoomModel::ZoomStepsToJump (by reference)" ) );
   430     PRINT( _L( "Camera => CCamZoomModel::ZoomStepsToJump (by reference)" ) );
   419     
   431     
   420     TInt steps = ZoomStepsToJump();
   432     TInt steps = iZoomStepMultiplier * ZoomStepsToJump();
   421 
   433 
   422     TCamZoomBoundary boundary = CheckBoundary();
   434     TCamZoomBoundary boundary = CheckBoundary();
   423     
   435     
   424     // If jumping this number of steps will make us cross the boundary, 
   436     // If jumping this number of steps will make us cross the boundary, 
   425     // we need to split the steps up into the composite opt/dig steps.
   437     // we need to split the steps up into the composite opt/dig steps.
   667         PRINT( _L( "CCamZoomModel::ZoomIn one click" ) );
   679         PRINT( _L( "CCamZoomModel::ZoomIn one click" ) );
   668         iState = ECamZoomModelStateZoomNone;
   680         iState = ECamZoomModelStateZoomNone;
   669         }
   681         }
   670     else
   682     else
   671         {
   683         {
   672         // Start the timer to zoom-in again when timer expires
   684         // Don't restart timer (auto-stop) timer when no zoom was done
   673         PRINT( _L( "CCamZoomModel::ZoomIn start zoom timer" ) );
   685         if( optZoomJump || digZoomJump || extZoomJump )
   674         StartZoomTimer();
   686             {
       
   687             // Start the timer to zoom-in again when timer expires
       
   688             PRINT( _L( "CCamZoomModel::ZoomIn start zoom timer" ) );
       
   689             StartZoomTimer();
       
   690             }
       
   691         else
       
   692             {
       
   693             PRINT( _L("Camera <> CCamZoomModel::ZoomOut - stopping zoom at boundary") );
       
   694             StopZoom();
       
   695             }
   675         }
   696         }
   676     
   697     
   677     PRINT( _L( "Camera <= CCamZoomModel::ZoomOut " ) );
   698     PRINT( _L( "Camera <= CCamZoomModel::ZoomOut " ) );
   678     }
   699     }
   679 
   700 
  1044     
  1065     
  1045     if ( iZoomTimer->IsActive() )
  1066     if ( iZoomTimer->IsActive() )
  1046         {
  1067         {
  1047         iZoomTimer->Cancel();
  1068         iZoomTimer->Cancel();
  1048         }
  1069         }
  1049         
  1070 
  1050     // Clear the zoom state
  1071     // Clear the zoom state
  1051     iState = ECamZoomModelStateZoomNone;     
  1072     iState = ECamZoomModelStateZoomNone;
  1052     
  1073 
       
  1074     // Reset zoom multiplier
       
  1075     iZoomStepMultiplier = 1;
       
  1076 
  1053     if ( iPauseState == EPauseStatePaused )
  1077     if ( iPauseState == EPauseStatePaused )
  1054         {
  1078         {
  1055         iPauseState = EPauseStateReleased;
  1079         iPauseState = EPauseStateReleased;
  1056         }
  1080         }
  1057     else
  1081     else
  1226                 stepPeriod = iZoomLAF.iZoomSpeedDig * 1000;
  1250                 stepPeriod = iZoomLAF.iZoomSpeedDig * 1000;
  1227                 }
  1251                 }
  1228             else
  1252             else
  1229                 {
  1253                 {
  1230                 // use slower speed for videomode        
  1254                 // use slower speed for videomode        
  1231                 stepPeriod = iZoomLAF.iZoomSpeedDig * 2000;
  1255                 stepPeriod = iZoomLAF.iZoomSpeedDig * 2500;
  1232                 }    
  1256                 }
  1233             break;        
  1257             break;        
  1234             }
  1258             }
  1235         
  1259         
  1236         case ECamZoomModeExtended:
  1260         case ECamZoomModeExtended:
  1237             {
  1261             {
  1358     else
  1382     else
  1359         {
  1383         {
  1360         // Return the combined zoom value
  1384         // Return the combined zoom value
  1361         PRINT( _L( "Camera <= CCamZoomModel::CurrentZoom optical+digital" ) );
  1385         PRINT( _L( "Camera <= CCamZoomModel::CurrentZoom optical+digital" ) );
  1362         return (iCurZoomStepOptical + iCurZoomStepDigital);
  1386         return (iCurZoomStepOptical + iCurZoomStepDigital);
  1363         }        
  1387         }
  1364     }
  1388     }
  1365 
  1389 
  1366 
  1390 
  1367 // ---------------------------------------------------------------------------
  1391 // ---------------------------------------------------------------------------
  1368 // CCamZoomModel::PauseAtBoundary
  1392 // CCamZoomModel::PauseAtBoundary
  1496     iCurrentResolution = KErrNotReady;
  1520     iCurrentResolution = KErrNotReady;
  1497     }
  1521     }
  1498   PRINT1( _L("Camera <= CCamZoomModel::ReadCurrentResolution, got:%d"), iCurrentResolution );
  1522   PRINT1( _L("Camera <= CCamZoomModel::ReadCurrentResolution, got:%d"), iCurrentResolution );
  1499   }
  1523   }
  1500 
  1524 
       
  1525 // -----------------------------------------------------------------------------
       
  1526 // SetZoomMultiplier
       
  1527 // -----------------------------------------------------------------------------
       
  1528 //
       
  1529 void CCamZoomModel::SetZoomMultiplier( TInt aZoomStepMultiplier )
       
  1530     {
       
  1531     iZoomStepMultiplier = aZoomStepMultiplier;
       
  1532     if ( iCameraState & ECamVideoOn )
       
  1533         {
       
  1534         iZoomStepMultiplier *= 2;
       
  1535         }
       
  1536     }
       
  1537 
  1501 //  End of File  
  1538 //  End of File