1132 } |
1132 } |
1133 |
1133 |
1134 // --------------------------------------------------------------------------- |
1134 // --------------------------------------------------------------------------- |
1135 // CEikEdwin::CEikEdwinExtension::EnableKineticScrollingL |
1135 // CEikEdwin::CEikEdwinExtension::EnableKineticScrollingL |
1136 // --------------------------------------------------------------------------- |
1136 // --------------------------------------------------------------------------- |
1137 // |
1137 // |
1138 void CEikEdwin::CEikEdwinExtension::EnableKineticScrollingL() |
1138 void CEikEdwin::CEikEdwinExtension::EnableKineticScrollingL( CAknPhysics* aPhysics ) |
1139 { |
1139 { |
1140 iFlags.Set( EKineticScrollingEnabled ); |
1140 iFlags.Set( EKineticScrollingEnabled ); |
1141 EnablePhysicsL(); |
1141 EnablePhysicsL( aPhysics ); |
1142 } |
1142 } |
1143 |
1143 |
1144 // --------------------------------------------------------------------------- |
1144 // --------------------------------------------------------------------------- |
1145 // CEikEdwin::CEikEdwinExtension::EnablePhysicsL |
1145 // CEikEdwin::CEikEdwinExtension::EnablePhysicsL |
1146 // --------------------------------------------------------------------------- |
1146 // --------------------------------------------------------------------------- |
1147 // |
1147 // |
1148 void CEikEdwin::CEikEdwinExtension::EnablePhysicsL() |
1148 void CEikEdwin::CEikEdwinExtension::EnablePhysicsL( CAknPhysics* aPhysics ) |
1149 { |
1149 { |
1150 if ( iFlags.IsSet( EKineticScrollingEnabled ) |
1150 if ( iFlags.IsSet( EKineticScrollingEnabled ) |
1151 && !iPhysicsHandler && iEdwin->DrawableWindow() ) |
1151 && !iPhysicsHandler && iEdwin->DrawableWindow() ) |
1152 { |
1152 { |
1153 iPhysicsHandler = CAknEdwinPhysicsHandler::NewL( *iEdwin ); |
1153 iPhysicsHandler = CAknEdwinPhysicsHandler::NewL( *iEdwin, aPhysics ); |
1154 |
1154 |
1155 InitPhysicsL(); |
1155 InitPhysicsL(); |
1156 if ( iEdwin->iLayout ) |
1156 if ( iEdwin->iLayout ) |
1157 { |
1157 { |
1158 iEdwin->iLayout->RestrictScrollToTopsOfLines( EFalse ); |
1158 iEdwin->iLayout->RestrictScrollToTopsOfLines( EFalse ); |
2874 } |
2874 } |
2875 else if ( selectionChanged && |
2875 else if ( selectionChanged && |
2876 ( ( aPointerEvent.iType == TPointerEvent::EDrag ) || |
2876 ( ( aPointerEvent.iType == TPointerEvent::EDrag ) || |
2877 ( aPointerEvent.iType == TPointerEvent::EButtonRepeat ) ) ) |
2877 ( aPointerEvent.iType == TPointerEvent::EButtonRepeat ) ) ) |
2878 { |
2878 { |
2879 |
2879 TInt readPos = ( selectionAfter.iCursorPos >= selectionBefore.iCursorPos ) ? |
2880 // selectionAfter.iCursorPos-1 below is because we need to select the previous char |
2880 selectionBefore.iCursorPos : selectionAfter.iCursorPos ; |
2881 TBool ltr = ( selectionAfter.iCursorPos >= selectionBefore.iCursorPos ); |
|
2882 TInt readPos = selectionAfter.iCursorPos; |
|
2883 if (ltr && readPos > 0) |
|
2884 { |
|
2885 readPos -= 1; // read previous char |
|
2886 } |
|
2887 TChar currentSelectedChar = Text()->Read( readPos, 1 )[0]; |
2881 TChar currentSelectedChar = Text()->Read( readPos, 1 )[0]; |
2888 TBool isSpace = currentSelectedChar.IsSpace(); |
2882 TBool isSpace = currentSelectedChar.IsSpace(); |
2889 TBool isText = currentSelectedChar.IsAlpha() |
2883 TBool isSmiley = CSmileyManager::IsSmileyCode(currentSelectedChar); |
2890 || currentSelectedChar.IsDigit(); |
2884 TBool isText = currentSelectedChar.IsGraph(); |
2891 |
2885 |
2892 // case line |
2886 // case line |
2893 TInt prevLineNr = TextLayout()->GetLineNumber(selectionBefore.iCursorPos); |
2887 TInt prevLineNr = TextLayout()->GetLineNumber(selectionBefore.iCursorPos); |
2894 TInt lineNr = TextLayout()->GetLineNumber(selectionAfter.iCursorPos); |
2888 TInt lineNr = TextLayout()->GetLineNumber(selectionAfter.iCursorPos); |
2895 if ( prevLineNr != lineNr && ( selection.Length() != 0 ) ) |
2889 if ( prevLineNr != lineNr && ( selection.Length() != 0 ) ) |
8050 |
8045 |
8051 EXPORT_C void CEikEdwin::EnableKineticScrollingL( TBool aEnable ) |
8046 EXPORT_C void CEikEdwin::EnableKineticScrollingL( TBool aEnable ) |
8052 { |
8047 { |
8053 if ( iEdwinExtension && aEnable ) |
8048 if ( iEdwinExtension && aEnable ) |
8054 { |
8049 { |
8055 iEdwinExtension->EnableKineticScrollingL(); |
8050 iEdwinExtension->EnableKineticScrollingL( NULL ); |
|
8051 } |
|
8052 } |
|
8053 |
|
8054 EXPORT_C void CEikEdwin::EnableKineticScrollingL( CAknPhysics* aPhysics ) |
|
8055 { |
|
8056 if ( iEdwinExtension ) |
|
8057 { |
|
8058 iEdwinExtension->EnableKineticScrollingL( aPhysics ); |
8056 } |
8059 } |
8057 } |
8060 } |
8058 |
8061 |
8059 TBool CEikEdwin::NeedToChangeFormattingModeL() const |
8062 TBool CEikEdwin::NeedToChangeFormattingModeL() const |
8060 { |
8063 { |