Revision: 201023 RCL_3 PDK_3.0.1
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 16:15:51 +0300
branchRCL_3
changeset 17 514d98f21c43
parent 15 125793e17004
child 19 4ea6f81c838a
Revision: 201023 Kit: 2010125
mulwidgets/gesturehelper/src/gesture.cpp
mulwidgets/gesturehelper/src/gesturedefs.h
mulwidgets/mulsliderwidget/inc/mulslidercontrol.h
mulwidgets/mulsliderwidget/inc/mulslidervertical.h
mulwidgets/mulsliderwidget/src/mulslidercontrol.cpp
mulwidgets/mulsliderwidget/src/mulverticalslider.cpp
--- a/mulwidgets/gesturehelper/src/gesture.cpp	Tue May 25 13:16:14 2010 +0300
+++ b/mulwidgets/gesturehelper/src/gesture.cpp	Mon Jun 21 16:15:51 2010 +0300
@@ -909,7 +909,8 @@
 //
 TInt CGesture::PinchPercent() const
     {
-    return (iPinchEndDistance*100/iPinchStartDistance);
+	// Added 0.5 to avoid 5.7 getting rounded off to 5.
+    return (iPinchEndDistance*100/iPinchStartDistance) + 0.5;	
     }
 
 // ----------------------------------------------------------------------------
@@ -922,9 +923,7 @@
         {
         return TPoint(0,0);
         }
-    TInt greaterX = iPoints[0].iPos.iX > iSecondaryPoints[0].iPos.iX ? iPoints[0].iPos.iX : iSecondaryPoints[0].iPos.iX;
-    TInt greaterY = iPoints[0].iPos.iY > iSecondaryPoints[0].iPos.iY ? iPoints[0].iPos.iY : iSecondaryPoints[0].iPos.iY; 
-    return TPoint( (Abs(iPoints[0].iPos.iX - iSecondaryPoints[0].iPos.iX)/2 + greaterX), (Abs(iPoints[0].iPos.iY - iSecondaryPoints[0].iPos.iY)/2 + greaterY));
+    return TPoint( (iPoints[0].iPos.iX + iSecondaryPoints[0].iPos.iX)/2, (iPoints[0].iPos.iY + iSecondaryPoints[0].iPos.iY)/2);
     }
 
 // end of file
--- a/mulwidgets/gesturehelper/src/gesturedefs.h	Tue May 25 13:16:14 2010 +0300
+++ b/mulwidgets/gesturehelper/src/gesturedefs.h	Mon Jun 21 16:15:51 2010 +0300
@@ -43,7 +43,7 @@
 const TInt KGestureTolerancePercent = 4; // of 100
 
 /// Tolerance for considering it as pinch gesture for the first time
-const TInt KInitialPinchTolerance = 20; // Pixels
+const TInt KInitialPinchTolerance = 5; // Pixels
 
 /// Tolerance for considering it as pinch gesture after a pinch is detected
 const TInt KPinchTolerance = 5; // Pixels
--- a/mulwidgets/mulsliderwidget/inc/mulslidercontrol.h	Tue May 25 13:16:14 2010 +0300
+++ b/mulwidgets/mulsliderwidget/inc/mulslidercontrol.h	Mon Jun 21 16:15:51 2010 +0300
@@ -125,8 +125,9 @@
      * Generates the feedback based on the events recieved
      * 
      * @param aEvent Events recieved by the widget on Drag
+     * @param aIntensity Intensity of the feedback.If not passed default will be 50
      */ 
-     void TactileEffectOnDrag(TAlfEvent& aEvent);
+     void TactileEffectOnDrag(TAlfEvent& aEvent , int aIntensity = 50 );
      
      /**
       * Generates the feedback based on the thumb release
--- a/mulwidgets/mulsliderwidget/inc/mulslidervertical.h	Tue May 25 13:16:14 2010 +0300
+++ b/mulwidgets/mulsliderwidget/inc/mulslidervertical.h	Mon Jun 21 16:15:51 2010 +0300
@@ -308,9 +308,7 @@
      * initializes Model and Widget Pointer
      */
     void initializeSliderData();
-     
-     
-                         
+                              
     /**
      * SetBackgroundBrush
      * 
@@ -361,6 +359,12 @@
      */
     TAlfImage skinTexture(TSize aPrtImageSize, TSize aLscImageSize, TInt aPrtSkinId, TInt aLscSkinId );
     
+    /*
+     *  Get the Feedback Intensity 
+     */
+    TInt feedbackIntensity();
+    
+    
 private: // Class Data
     
 
--- a/mulwidgets/mulsliderwidget/src/mulslidercontrol.cpp	Tue May 25 13:16:14 2010 +0300
+++ b/mulwidgets/mulsliderwidget/src/mulslidercontrol.cpp	Mon Jun 21 16:15:51 2010 +0300
@@ -243,14 +243,14 @@
 //TactileEffectOnDrag
 //
 //----------------------------------------------------------------------
-void MulSliderControl::TactileEffectOnDrag(TAlfEvent& aEvent)
+void MulSliderControl::TactileEffectOnDrag(TAlfEvent& aEvent, int aIntensity)
 {            
  if (mTactilefdbInstance)
   {
     CCoeControl* ccoecntrl = static_cast<CCoeControl*>(Display()->ObjectProvider());
-    TInt intensity = 50;
+    TInt intensity = aIntensity;
     TTimeIntervalMicroSeconds32 timespan = 400000;
-    mTactilefdbInstance->StartFeedback(ccoecntrl,ETouchContinuousSlider,&aEvent.PointerEvent(),intensity,timespan);
+    mTactilefdbInstance->StartFeedback(ccoecntrl,ETouchDynamicSlider,&aEvent.PointerEvent(),intensity,timespan);
     mDragTactileFeedbackStarted = true;
    }
 }        
--- 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;    
         }