mulwidgets/mulsliderwidget/src/mulverticalslider.cpp
branchRCL_3
changeset 23 514d98f21c43
parent 21 125793e17004
--- a/mulwidgets/mulsliderwidget/src/mulverticalslider.cpp	Tue May 25 13:16:14 2010 +0300
+++ b/mulwidgets/mulsliderwidget/src/mulverticalslider.cpp	Mon Jun 21 16:15:51 2010 +0300
@@ -101,6 +101,7 @@
     int mZoomInTextureLscId; 
     int mZoomOutTexturePrtId;
     int mZoomOutTextureLscId;
+    bool misSetModel;
     
     
     CAlfLayout* mMainLayout;
@@ -122,6 +123,7 @@
         {
         mOperation = false;
         mSliderHit = false;
+        misSetModel = false;
         mTickInPixels = 0;
         mRangeInPixels = 0;
         mCurrTickInPixels = 0;
@@ -328,7 +330,9 @@
 //
 void MulSliderVertical::layoutVisuals( sliderTemplate /*aTemplateId*/)
     {
-    bool relayout = false;
+
+    bool relayout = mData->misSetModel;
+ 
     if(mData->mLayoutMirrored != AknLayoutUtils::LayoutMirrored())
         {
         mData->mOrientationLandScape = !mSliderModel->IsLandscape();
@@ -342,7 +346,7 @@
         }  
     if(relayout)
         {
-    
+    mData->misSetModel = false; 
     CAlfControl* ctrl = (CAlfControl*)&control();  
     TAknLayoutRect layoutRect;
     //get the lct rect for mBaseSliderLayout and set it            
@@ -794,10 +798,7 @@
             (mSliderModel->MaxRange() - mSliderModel->MinRange()) ;
         }
     // Get the track start pixel value    
-    mData->mTrackStartPoint = 
-    sliderCentrePos + 
-    sliderCentreSize -   
-    sliderHandleSize  ;  
+    mData->mTrackStartPoint = sliderCentrePos + sliderCentreSize - sliderHandleSize  ;  
     // Store current tick
     mData->mCurrTick =  mSliderModel->PrimaryValue() ; 
     if(mSliderModel->MaxRange()== mSliderModel->MinRange())
@@ -807,6 +808,22 @@
     mData->mTick = mSliderModel->Tick();
     }
     
+//----------------------------------------------------------------------------
+//  FeedbackIntensity
+//----------------------------------------------------------------------------
+//
+TInt MulSliderVertical::feedbackIntensity()
+    {
+       /*  We need to find the position of the thumb w.r.t the slider track.
+        *  mData->mTickInPixels will give the no. of pixels each tick will 
+        * 
+        */ 
+    
+       int deltaY = (mSliderModel->PrimaryValue() - mSliderModel->MinRange()) * 
+                    mData->mTickInPixels;
+       TInt intensity =  ( deltaY  * 100 )/ mData->mRangeInPixels  ;
+       return intensity ;
+    }
     
 // ---------------------------------------------------------------------------
 //  createVisualization
@@ -821,7 +838,8 @@
         mData->mLayoutMirrored = false;
     // Create the visualization
     CAlfControl* ctrl = (CAlfControl*)&control();
-    mData->mOrientationLandScape = !mSliderModel->IsLandscape();
+    mData->mOrientationLandScape = mSliderModel->IsLandscape();
+    mData->misSetModel = true;
         
     // Visual Hierarchy creation
     // create the mMainLayout
@@ -1142,7 +1160,8 @@
             updateModelPrimaryValue(newPos); 
             //Tactile Feedback For Thumb Drag
             MulSliderControl& sldrcntrl = static_cast<MulSliderControl&>(control());
-            sldrcntrl.TactileEffectOnDrag(*aEvent);
+            int fdbintensity = feedbackIntensity();
+            sldrcntrl.TactileEffectOnDrag(*aEvent , fdbintensity );
             ret = EEventHandled;    
         }