uifw/EikStd/coctlsrc/EIKEDWIN.CPP
branchRCL_3
changeset 23 3d340a0166ff
parent 18 0aa5fbdfbc30
child 25 941195f2d488
equal deleted inserted replaced
18:0aa5fbdfbc30 23:3d340a0166ff
   145 const TInt KInfiniteAnimPlayTimes = 0x7ffff;
   145 const TInt KInfiniteAnimPlayTimes = 0x7ffff;
   146 const TInt KAdditionalPixels = 0x400;
   146 const TInt KAdditionalPixels = 0x400;
   147 
   147 
   148 const TInt KFullFormatLengthForSmiley = 5000;
   148 const TInt KFullFormatLengthForSmiley = 5000;
   149 
   149 
       
   150 const TInt KContentThreshold = 8;
       
   151 
   150 //
   152 //
   151 // class CEikEdwin::CUndoBuffer
   153 // class CEikEdwin::CUndoBuffer
   152 //
   154 //
   153 
   155 
   154 class CEikEdwin::CUndoBuffer : public CBase
   156 class CEikEdwin::CUndoBuffer : public CBase
  2870                 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && editingEnabled )
  2872                 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && editingEnabled )
  2871                     {
  2873                     {
  2872                     // on down event feedback is given if cursor/selection changes
  2874                     // on down event feedback is given if cursor/selection changes
  2873                     if ( paintingPossible && !readOnly || editorWillGetFocus )
  2875                     if ( paintingPossible && !readOnly || editorWillGetFocus )
  2874                         {
  2876                         {
  2875                         iEdwinFepSupport->iFeedback->InstantFeedback( this, ETouchFeedbackBasic );
  2877                         iEdwinFepSupport->iFeedback->InstantFeedback( this, ETouchFeedbackEdit );
  2876                         }
  2878                         }
  2877                     }
  2879                     }
  2878                 else  if ( selectionChanged && 
  2880                 else  if ( selectionChanged && 
  2879                        ( ( aPointerEvent.iType == TPointerEvent::EDrag ) ||
  2881                          ( selectionAfter.iAnchorPos != selectionAfter.iCursorPos ) &&
       
  2882                          ( ( aPointerEvent.iType == TPointerEvent::EDrag ) ||
  2880                          ( aPointerEvent.iType == TPointerEvent::EButtonRepeat ) ) )
  2883                          ( aPointerEvent.iType == TPointerEvent::EButtonRepeat ) ) )
  2881                     {
  2884                     {
  2882                     TInt readPos = ( selectionAfter.iCursorPos >= selectionBefore.iCursorPos ) ?
  2885                     TInt readPos = selectionAfter.iCursorPos;
  2883                                           selectionBefore.iCursorPos : selectionAfter.iCursorPos ;
  2886                     if ( selectionAfter.iCursorPos > selectionAfter.iAnchorPos )
  2884                     TChar currentSelectedChar = Text()->Read( readPos, 1 )[0]; 
  2887                         {
       
  2888                         readPos -= 1;//drag backword
       
  2889                         }
       
  2890                     TChar currentSelectedChar = Text()->Read( readPos, 1 )[0];
  2885                     TBool isSpace = currentSelectedChar.IsSpace();
  2891                     TBool isSpace = currentSelectedChar.IsSpace();
  2886                     TBool isSmiley = CSmileyManager::IsSmileyCode(currentSelectedChar);
  2892                     TBool isSmiley = CSmileyManager::IsSmileyCode(currentSelectedChar);
  2887                     TBool isText = currentSelectedChar.IsGraph();
  2893                     TBool isText = currentSelectedChar.IsGraph();
  2888                     
  2894                     
  2889                     // case line
  2895                     // case line
  2890                     TInt prevLineNr = TextLayout()->GetLineNumber(selectionBefore.iCursorPos);
  2896                     TInt prevLineNr = TextLayout()->GetLineNumber(selectionBefore.iCursorPos);
  2891                     TInt lineNr = TextLayout()->GetLineNumber(selectionAfter.iCursorPos);
  2897                     TInt lineNr = TextLayout()->GetLineNumber(selectionAfter.iCursorPos);
  2892                     if ( prevLineNr != lineNr && ( selection.Length() != 0 ) )
  2898                     if ( prevLineNr != lineNr )
  2893                         {
  2899                         {
  2894                         TInt group = ( currentSelectedChar.GetCategory() & 0xF0 );
  2900                         TInt group = currentSelectedChar.GetCategory();
  2895                         TBool isEmptyLine = ( group == TChar::ESeparatorGroup );
  2901                         TBool isEmptyLine = ( group == TChar::EZpCategory );
  2896                         TTouchLogicalFeedback fType = ( isEmptyLine ? 
  2902                         TTouchLogicalFeedback fType = ( isEmptyLine ? 
  2897                             ETouchFeedbackEmptyLineSelection : ETouchFeedbackLineSelection );
  2903                             ETouchFeedbackEmptyLineSelection : ETouchFeedbackLineSelection );
  2898                         iEdwinFepSupport->iFeedback->InstantFeedback( this, fType );
  2904                         iEdwinFepSupport->iFeedback->InstantFeedback( this, fType );
  2899                         }
  2905                         }
  2900                     // case space
  2906                     // case space
  8924 	    iEdwinExtension->iSmiley->HandleSelection( aSelect.LowerPos(), 
  8930 	    iEdwinExtension->iSmiley->HandleSelection( aSelect.LowerPos(), 
  8925 	        aSelect.Length() );
  8931 	        aSelect.Length() );
  8926 		}
  8932 		}
  8927     }
  8933     }
  8928 
  8934 
       
  8935 
  8929 // ---------------------------------------------------------------------------
  8936 // ---------------------------------------------------------------------------
  8930 // CEikEdwin::SkipBackgroundDrawer
  8937 // CEikEdwin::SkipBackgroundDrawer
  8931 // ---------------------------------------------------------------------------
  8938 // ---------------------------------------------------------------------------
  8932 //
  8939 //
  8933 TBool CEikEdwin::SkipBackgroundDrawer() const
  8940 TBool CEikEdwin::SkipBackgroundDrawer() const
  8934     {
  8941     {
  8935     return iEdwinInternalFlags & ESkipBackgroundDrawer;
  8942     return iEdwinInternalFlags & ESkipBackgroundDrawer;
  8936     }
  8943     }
  8937 
  8944 
  8938 
  8945 
       
  8946 // ---------------------------------------------------------------------------
       
  8947 // CEikEdwin::ContentFitsToViewRect
       
  8948 // ---------------------------------------------------------------------------
       
  8949 //
       
  8950 TBool CEikEdwin::ContentFitsToViewRect() const
       
  8951     {
       
  8952     if ( iLayout && !iLayout->IsFormattingBand() )
       
  8953         {
       
  8954         if ( iLayout->FormattedHeightInPixels()
       
  8955             <= AdjustedViewRect().Height() + KContentThreshold )
       
  8956             {
       
  8957             return ETrue;
       
  8958             }
       
  8959         }
       
  8960 
       
  8961     return EFalse;
       
  8962     }
       
  8963 
  8939 
  8964 
  8940 // End of File
  8965 // End of File
  8941 
  8966