uifw/AvKon/src/Aknslider.cpp
branchRCL_3
changeset 19 aecbbf00d063
parent 17 a1caeb42b3a3
child 20 d48ab3b357f1
--- a/uifw/AvKon/src/Aknslider.cpp	Thu Aug 19 10:11:06 2010 +0300
+++ b/uifw/AvKon/src/Aknslider.cpp	Tue Aug 31 15:28:30 2010 +0300
@@ -65,6 +65,8 @@
 const TInt KScrollRepeatTimeout = 250000; // 0.25 seconds
 const TInt KStableFeedbackIntesity = 100;
 const TInt KFeedbackTimeout = 100000;
+const TInt KNoFeedbackTimeout = 0;
+const TInt KStepThreshold = 15;
 // ============================================================================
 // Internal class to hold slider control data, primarily coming from resource.
 NONSHARABLE_CLASS( CAknSliderData ): public CBase
@@ -537,12 +539,12 @@
         }; 
     const TAknsItemID iconSkinIDArray[] = 
         {
-        KAknsIIDQgnGrafNsliderVerticalTop,   //KAknsIIDNone,     
-        KAknsIIDQgnGrafNsliderVerticalBottom,//KAknsIIDNone,
-        KAknsIIDQgnGrafNsliderVerticalMiddle,//KAknsIIDNone,
-        KAknsIIDQgnGrafNsliderVerticalMarker,//KAknsIIDNone,
-        KAknsIIDQgnGrafNsliderVerticalTickMajor,//KAknsIIDNone,
-        KAknsIIDQgnGrafNsliderVerticalMarker//KAknsIIDNone
+        KAknsIIDNone,//KAknsIIDQgnGrafNsliderVerticalTop,        
+        KAknsIIDNone,//KAknsIIDQgnGrafNsliderVerticalBottom,
+        KAknsIIDNone,//KAknsIIDQgnGrafNsliderVerticalMiddle,
+        KAknsIIDNone,// KAknsIIDQgnGrafNsliderVerticalMarker,
+        KAknsIIDNone,// KAknsIIDQgnGrafNsliderVerticalTIckMajor,
+        KAknsIIDNone//KAknsIIDQgnGrafNsliderVerticalMarker
         };
         
     const TInt element[] = 
@@ -1497,12 +1499,7 @@
     TResourceReader reader;
     CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId );
 
-    TInt sliderType = reader.ReadInt16();
-    if ( sliderType == EAknSliderWithFeedbackStyle )
-        {
-        reader.ReadInt16(); // ignore type
-        reader.ReadInt16(); // ignore layout
-        }
+    reader.ReadInt16(); // ignore layout
     TInt minValue = reader.ReadInt16();
     TInt maxValue = reader.ReadInt16();
     CleanupStack::PopAndDestroy(); // reader
@@ -1543,12 +1540,7 @@
     TResourceReader reader;
     CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId );
 
-    TInt sliderType = reader.ReadInt16();
-    if ( sliderType == EAknSliderWithFeedbackStyle )
-        {
-        reader.ReadInt16(); // ignore type
-        reader.ReadInt16(); // ignore layout
-        }
+    reader.ReadInt16(); // ignore layout
     TInt minValue = reader.ReadInt16();
     TInt maxValue = reader.ReadInt16();
     CleanupStack::PopAndDestroy(); // reader
@@ -3158,6 +3150,15 @@
                 {
                 if ( touchDownArea.Contains( aEvent.iPosition ) )
                     {
+                    TInt stepCount = SliderData()->Range() / SliderData()->iStepSize;
+                    if ( stepCount <= KStepThreshold )
+                        {
+                        MTouchFeedback* feedback = MTouchFeedback::Instance();
+                        if ( feedback )
+                            {
+                            feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, aEvent );
+                            }
+                        }
                        // repeat until thumb reaches the stylus down position    
                     iExt->iPenInputPos = aEvent.iPosition;
 
@@ -3169,7 +3170,7 @@
                         MTouchFeedback* feedback = MTouchFeedback::Instance();
                         if ( feedback )
                             {
-                            feedback->InstantFeedback( this, ETouchFeedbackSlider, aEvent );
+                            feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, aEvent );
                             }
                         iExt->SetFlag( CAknSliderExtension::EFlagDraggingThumb );
                         reportDragEvent = EDragMarkerStart;
@@ -3256,7 +3257,7 @@
                     if ( feedback )
                         {
                         feedback->InstantFeedback( this,
-                                                   ETouchFeedbackSlider,
+                                                   ETouchFeedbackBasicSlider,
                                                    ETouchFeedbackVibra,
                                                    aEvent );
                         }
@@ -3617,11 +3618,29 @@
         {
         if( aFeedback )
             {
-            MTouchFeedback* feedback = MTouchFeedback::Instance();
-            if ( feedback )
-               {
-               feedback->InstantFeedback( this, ETouchFeedbackSlider );
-               }          
+            TInt stepCount = SliderData()->Range() / SliderData()->iStepSize;
+            if ( stepCount > KStepThreshold )
+                {
+                if ( iExt->IsFlagSet( CAknSliderExtension::EFlagPlayingContinuousFb ))
+                    {
+                    if ( SliderData()->iFeedbackStyle == EAknSliderFbDynamic )
+                        {
+                        ModifyFeedback();
+                        }
+                    }
+                else
+                    {
+                    StartFeedback( NULL, KNoFeedbackTimeout );
+                    }
+                }
+            else
+                {
+                MTouchFeedback* feedback = MTouchFeedback::Instance();
+                if ( feedback )
+                    {
+                    feedback->InstantFeedback( this, ETouchFeedbackBasicSlider );
+                    }
+                }            
             }
 
         Window().Invalidate( Rect() );
@@ -4190,8 +4209,7 @@
     if ( Layout() != EAknSettingsItemSliderLayout &&
          Layout() != EAknSettingsItemSliderLayoutWithGraphics  &&
          Layout() != EAknSliderLayoutVertical &&
-         Layout() != EAknSliderLayoutHorizontal &&
-         Layout() != EAknMIDPFormSliderLayout ) 
+         Layout() != EAknSliderLayoutHorizontal ) 
         {
         error = AknsUtils::GetCachedColor( skin, color,
                     KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8 );
@@ -4259,16 +4277,12 @@
     MTouchFeedback* feedback = MTouchFeedback::Instance();
     if ( feedback )
         {
-        TTouchContinuousFeedback type = ETouchContinuousSmooth;
         TInt intensity = KStableFeedbackIntesity;
-        
         if ( SliderData()->iFeedbackStyle == EAknSliderFbDynamic )
             {
-            type = ETouchDynamicSlider;
             intensity = FeedbackIntensity();
             }
-        
-        feedback->StartFeedback( this, type, aPointerEvent, intensity, aTimeout );
+        feedback->StartFeedback( this, ETouchContinuousSlider, aPointerEvent, intensity, aTimeout );
         iExt->SetFlag( CAknSliderExtension::EFlagPlayingContinuousFb );
         }
     }