uifw/AvKon/src/AknCharMap.cpp
branchRCL_3
changeset 72 a5e7a4f63858
parent 64 85902f042028
equal deleted inserted replaced
64:85902f042028 72:a5e7a4f63858
   394         TBool IsEmotionEnabled() const;
   394         TBool IsEmotionEnabled() const;
   395         TBool IsShowingEmotion() const;
   395         TBool IsShowingEmotion() const;
   396         void SwitchEmotionVisibilityL();
   396         void SwitchEmotionVisibilityL();
   397         TBool NeedEmotionSwitchIcon() const;
   397         TBool NeedEmotionSwitchIcon() const;
   398         HBufC* ReadEmotionHBufCL();
   398         HBufC* ReadEmotionHBufCL();
   399         void LoadEmotionTumbnails(const TDesC& aText);
   399         void LoadEmotionTumbnails(const TDesC& aChars);
   400         void PlayAnimationL(const TDesC& aText);
       
   401         void StopAnimation(const TDesC& aText);
       
   402         void SetEmotionSize(const TSize& aSize);
   400         void SetEmotionSize(const TSize& aSize);
   403         TBool IsEmotionChar(TChar aChar);
   401         TBool IsEmotionChar(TChar aChar);
   404         TChar SwitchToSctChar();
   402         TChar SwitchToSctChar();
   405         TChar SwitchToEmotionChar();
   403         TChar SwitchToEmotionChar();
   406         CAknSmileyIcon* EmotionIcon(TChar aChar);
   404         CAknSmileyIcon* EmotionIcon(TChar aChar);
   437         // Whether or not kinetic scrolling is enabled in the device.
   435         // Whether or not kinetic scrolling is enabled in the device.
   438         // Focus scrolling is disabled if kinetic scrolling is used.
   436         // Focus scrolling is disabled if kinetic scrolling is used.
   439         TBool iKineticScrolling;
   437         TBool iKineticScrolling;
   440         // Indicates whether menu sct is highlighted or not.
   438         // Indicates whether menu sct is highlighted or not.
   441         TBool iMenuSctHighlighted;
   439         TBool iMenuSctHighlighted;
   442         
       
   443         // flag for focus status of char map dialog
       
   444         TBool iCharMapFocusGained;
       
   445         
   440         
   446     public: // for Emotion
   441     public: // for Emotion
   447         HBufC* iCharsSmiley;
   442         HBufC* iCharsSmiley;
   448         CSmileyModel* iSmileyModel;
   443         CSmileyModel* iSmileyModel;
   449         TChar iLastFocusedSmileyChar;
   444         TChar iLastFocusedSmileyChar;
  1499         }
  1494         }
  1500     
  1495     
  1501     return charsSmiley;
  1496     return charsSmiley;
  1502     }
  1497     }
  1503 
  1498 
  1504 void CAknCharMapExtension::LoadEmotionTumbnails(const TDesC& aText)
  1499 void CAknCharMapExtension::LoadEmotionTumbnails(const TDesC& aChars)
  1505     {
  1500     {
  1506     //If emotion tumbbails can't be load, 
  1501     //If emotion tumbbails can't be load, 
  1507     // no emotion tumbnail will be dispalyed.
  1502     // no emotion tumbnail will be dispalyed.
  1508     TRAP_IGNORE( iSmileyModel->LoadStillImagesL(aText) );
  1503     TRAP_IGNORE( iSmileyModel->LoadStillImagesL(aChars) );
  1509     }
       
  1510 
       
  1511 const TInt KAnimationRepeat = 30;
       
  1512 const TInt KAnimationDelay = 150*1000;
       
  1513 
       
  1514 void CAknCharMapExtension::PlayAnimationL(const TDesC& aText)
       
  1515     {
       
  1516     iSmileyModel->PlayAnimationL(aText, KAnimationRepeat, KAnimationDelay);
       
  1517     }
       
  1518 
       
  1519 void CAknCharMapExtension::StopAnimation(const TDesC& aText)
       
  1520     {
       
  1521     iSmileyModel->StopAnimation(aText);
       
  1522     }
  1504     }
  1523 
  1505 
  1524 void CAknCharMapExtension::SetEmotionSize(const TSize& aSize)
  1506 void CAknCharMapExtension::SetEmotionSize(const TSize& aSize)
  1525     {
  1507     {
  1526     TInt unit = Min(aSize.iWidth, aSize.iHeight);
  1508     TInt unit = Min(aSize.iWidth, aSize.iHeight);
  2190         iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
  2172         iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
  2191         iSBFrame->VerticalScrollBar()->SetMopParent(iExtension);
  2173         iSBFrame->VerticalScrollBar()->SetMopParent(iExtension);
  2192         UpdateScrollIndicatorL();
  2174         UpdateScrollIndicatorL();
  2193         }
  2175         }
  2194     
  2176     
  2195     Extension()->LoadEmotionTumbnails(*iChars);
  2177     iExtension->LoadEmotionTumbnails(*iChars);
       
  2178     
       
  2179     SetSmileyAnimationActivityInCurrentPageL(ETrue);
  2196     
  2180     
  2197     }
  2181     }
  2198 
  2182 
  2199 EXPORT_C void CAknCharMap::SetBuffer(TDes& aSpecialChars)
  2183 EXPORT_C void CAknCharMap::SetBuffer(TDes& aSpecialChars)
  2200     {
  2184     {
  2885         iOffscreenBgDrawn = EFalse;
  2869         iOffscreenBgDrawn = EFalse;
  2886         }
  2870         }
  2887 
  2871 
  2888     else if(aType == KEikMessageFadeAllWindows) // focus gained // KEikMessageWindowsFadeChange
  2872     else if(aType == KEikMessageFadeAllWindows) // focus gained // KEikMessageWindowsFadeChange
  2889         {
  2873         {
  2890         Extension()->iCharMapFocusGained = ETrue;
       
  2891         SetSmileyAnimationActivityInCurrentPageL(ETrue);
  2874         SetSmileyAnimationActivityInCurrentPageL(ETrue);
  2892         }
  2875         }
  2893     
  2876     
  2894     else if(aType == KAknMessageFocusLost) // focus lost
  2877     else if(aType == KAknMessageFocusLost) // focus lost
  2895         {
  2878         {
  2896         Extension()->iCharMapFocusGained = EFalse;
       
  2897         SetSmileyAnimationActivityInCurrentPageL(EFalse);
  2879         SetSmileyAnimationActivityInCurrentPageL(EFalse);
  2898         
  2880         
  2899         if ( iExtension->iHighlightVisible )
  2881         if ( iExtension->iHighlightVisible )
  2900             {
  2882             {
  2901             iExtension->iHighlightVisible = EFalse;
  2883             iExtension->iHighlightVisible = EFalse;
  3468         cc = AknsDrawUtils::ControlContext( this );
  3450         cc = AknsDrawUtils::ControlContext( this );
  3469         }
  3451         }
  3470 
  3452 
  3471     TPoint pos = iGridTopLeft;
  3453     TPoint pos = iGridTopLeft;
  3472     TSize size(iGridItemWidth*iMaxColumns+1, iGridItemHeight);
  3454     TSize size(iGridItemWidth*iMaxColumns+1, iGridItemHeight);
  3473     
  3455 	
  3474     // eliminate the overlap area between menu sct and the first menu item.
  3456 	// eliminate the overlap area between menu sct and the first menu item.
  3475     if ( Extension()->iMenuSct )
  3457     if ( Extension()->iMenuSct )
  3476         {
  3458         {
  3477         // provide a dirty fix for Menu SCT, since Layout data is not suitable for this
  3459         // provide a dirty fix for Menu SCT, since Layout data is not suitable for this
  3478         size = TSize( Rect().Width()- 1, iGridItemHeight - 1 );
  3460         size = TSize( Rect().Width()- 1, iGridItemHeight - 1 );
  3479         }
  3461         }
       
  3462     
  3480     if(iIsMirrored)
  3463     if(iIsMirrored)
  3481         {
  3464         {
  3482         pos.iX += iGridItemWidth - size.iWidth;
  3465         pos.iX += iGridItemWidth - size.iWidth;
  3483         }
  3466         }
  3484 
  3467 
  4880             AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,0,0));
  4863             AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,0,0));
  4881 
  4864 
  4882         TAknLayoutRect rightCellLayRect;
  4865         TAknLayoutRect rightCellLayRect;
  4883         rightCellLayRect.LayoutRect(gridRect,
  4866         rightCellLayRect.LayoutRect(gridRect,
  4884             AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,1,0));
  4867             AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,1,0));
       
  4868 			
  4885         TRect firstCellRect;
  4869         TRect firstCellRect;
  4886 
  4870 		
  4887         // Cell width.
  4871 		// Cell width.
  4888         iGridItemWidth =
  4872         iGridItemWidth =
  4889             rightCellLayRect.Rect().iTl.iX - firstCellLayRect.Rect().iTl.iX;
  4873             rightCellLayRect.Rect().iTl.iX - firstCellLayRect.Rect().iTl.iX;
  4890         if (iGridItemWidth < 0)
  4874         if (iGridItemWidth < 0)
  4891             {
  4875             {
  4892             iGridItemWidth = -iGridItemWidth;
  4876             iGridItemWidth = -iGridItemWidth;
  4893             }
  4877             }
  4894         
  4878 			
  4895         if ( Extension()->iMenuSct )
  4879         if ( Extension()->iMenuSct )
  4896             {
  4880             {
  4897             firstCellRect = TRect( TPoint(0, 0),
  4881             firstCellRect = TRect( TPoint(0, 0),
  4898                  TSize( iGridItemWidth, Rect().Height() ) );
  4882                  TSize( iGridItemWidth, Rect().Height() ) );
  4899             }
  4883             }
  4900         else
  4884         else
  4901             {
  4885             {
  4902             firstCellRect = firstCellLayRect.Rect();
  4886             firstCellRect = firstCellLayRect.Rect();
  4903             }
  4887             }
  4904 
       
  4905 
  4888 
  4906         TInt firstVisibleIndex = iFirstVisibleRow * iMaxColumns;
  4889         TInt firstVisibleIndex = iFirstVisibleRow * iMaxColumns;
  4907         // Max columns.
  4890         // Max columns.
  4908         iMaxColumns = gridRect.Width() / firstCellRect.Width();
  4891         iMaxColumns = gridRect.Width() / firstCellRect.Width();
  4909         iFirstVisibleRow = firstVisibleIndex / iMaxColumns;
  4892         iFirstVisibleRow = firstVisibleIndex / iMaxColumns;
  5680     TInt resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS;
  5663     TInt resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS;
  5681     if (FeatureManager::FeatureSupported(KFeatureIdChinese))
  5664     if (FeatureManager::FeatureSupported(KFeatureIdChinese))
  5682         {
  5665         {
  5683         resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS_CHINESE;
  5666         resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS_CHINESE;
  5684         }
  5667         }
  5685     else if (FeatureManager::FeatureSupported(KFeatureIdKorean))
       
  5686         {
       
  5687         // Added korea character support
       
  5688         resourceId = R_AVKON_MENU_SCT_ROW_DEFAULT_CONTENTS_KOREAN;
       
  5689         }
       
  5690 
  5668 
  5691     CCoeEnv::Static()->CreateResourceReaderLC( reader, resourceId );
  5669     CCoeEnv::Static()->CreateResourceReaderLC( reader, resourceId );
  5692     ConstructFromResourceL( reader );
  5670     ConstructFromResourceL( reader );
  5693     CleanupStack::PopAndDestroy();
  5671     CleanupStack::PopAndDestroy();
  5694     }
  5672     }
  5885             default:
  5863             default:
  5886                 break;
  5864                 break;
  5887             }
  5865             }
  5888         
  5866         
  5889         CAknCharMapHistory::THistoryFilter historyFilter;
  5867         CAknCharMapHistory::THistoryFilter historyFilter;
  5890         if(Extension()->IsEmotionEnabled())
  5868         if(iExtension->IsEmotionEnabled())
  5891             {
  5869             {
  5892             historyFilter = CAknCharMapHistory::EHistoryFilterMixed;
  5870             historyFilter = CAknCharMapHistory::EHistoryFilterMixed;
  5893             }
  5871             }
  5894         else
  5872         else
  5895             {
  5873             {
  6000             iCursorPos = TPoint(0, 0);
  5978             iCursorPos = TPoint(0, 0);
  6001             }
  5979             }
  6002         iExtension->iFlags |= EAknCharMapCharsAllocated; // mark that iChars points to HBufC
  5980         iExtension->iFlags |= EAknCharMapCharsAllocated; // mark that iChars points to HBufC
  6003         }
  5981         }
  6004     
  5982     
  6005     Extension()->LoadEmotionTumbnails(*iChars);
  5983     iExtension->LoadEmotionTumbnails(*iChars);
  6006     
       
  6007     // control will never get focus event while it is in EditMenu mode
       
  6008     Extension()->iCharMapFocusGained = ETrue;
       
  6009 
  5984 
  6010     // The "PlayAnimationL" in "SetSmileyAnimationActivityInCurrentPageL"
  5985     // The "PlayAnimationL" in "SetSmileyAnimationActivityInCurrentPageL"
  6011     // will leave. If we ignore it, just no animation is played.
  5986     // will leave. If we ignore it, just no animation is played.
  6012     TRAP_IGNORE( SetSmileyAnimationActivityInCurrentPageL(ETrue) );
  5987     TRAP_IGNORE( SetSmileyAnimationActivityInCurrentPageL(ETrue) );
  6013     }
  5988     }
  6260     return EFalse;
  6235     return EFalse;
  6261     }
  6236     }
  6262 
  6237 
  6263 TBool CAknCharMap::IsJapaneseSctUi() const
  6238 TBool CAknCharMap::IsJapaneseSctUi() const
  6264     {
  6239     {
  6265     //Japanese feature for SCT will not be supported since TB9.2 PS2,
       
  6266     //so it always return EFalse.
       
  6267     return EFalse;
  6240     return EFalse;
  6268     }
  6241     }
  6269 
  6242 
  6270 TBool CAknCharMap::IsKoreanSctUi() const
       
  6271     {
       
  6272 	// Korean feature dropped half-screen SCT in 9.2, it has the same
       
  6273 	//   behavior with others, so return false here
       
  6274     return EFalse;
       
  6275     }
       
  6276 // -----------------------------------------------------------------------------
  6243 // -----------------------------------------------------------------------------
  6277 // CAknCharMap::TitleWithSelectingSpecialChar()
  6244 // CAknCharMap::TitleWithSelectingSpecialChar()
  6278 // Return the title string with the selecting special characters
  6245 // Return the title string with the selecting special characters
  6279 // -----------------------------------------------------------------------------
  6246 // -----------------------------------------------------------------------------
  6280 //
  6247 //
  6762             DrawCell(index, highlighted);
  6729             DrawCell(index, highlighted);
  6763             }
  6730             }
  6764         }
  6731         }
  6765     }
  6732     }
  6766 
  6733 
       
  6734 const TInt KAnimationRepeat = 30;
       
  6735 const TInt KAnimationDelay = 1000*1000;
       
  6736 
  6767 void CAknCharMap::SetSmileyAnimationActivityInCurrentPageL(TBool aIsActive)
  6737 void CAknCharMap::SetSmileyAnimationActivityInCurrentPageL(TBool aIsActive)
  6768     {
  6738     {
  6769     TInt pos = iFirstVisibleRow * iMaxColumns;
  6739     TInt begin = iFirstVisibleRow * iMaxColumns;
  6770     TInt maxLength = iChars->Length() - pos;
  6740     TInt end = iExtension->iMaxVisibleRows * iMaxColumns + begin;
  6771     TInt length = iExtension->iMaxVisibleRows * iMaxColumns;
  6741     if( end > iChars->Length() ) 
  6772     if(length > maxLength) length = maxLength;
  6742         {
  6773 
  6743         end = iChars->Length();
  6774     const TPtrC textInCurrentPage = iChars->Mid(pos, length);
  6744         }
  6775     
  6745 
  6776     if(Extension()->iCharMapFocusGained && aIsActive)
  6746     for( TInt i(begin); i<end; i++ )
  6777         {
  6747         {
  6778         Extension()->PlayAnimationL(textInCurrentPage);
  6748         TChar code = (*iChars)[i];
  6779         }
  6749         CAknSmileyIcon* icon = iExtension->EmotionIcon(code);
  6780     else
  6750         if( !icon ) 
  6781         {
  6751             {
  6782         Extension()->StopAnimation(textInCurrentPage);
  6752             continue;
       
  6753             }
       
  6754 
       
  6755         if( ( aIsActive ) && 
       
  6756            ( Extension()->IsShowingEmotion() || Extension()->iMenuSctHighlighted) 
       
  6757            )
       
  6758             {
       
  6759             icon->PlayAnimationL( KAnimationRepeat, KAnimationDelay );
       
  6760             }
       
  6761         else
       
  6762             {
       
  6763             icon->StopAnimation();
       
  6764             }
  6783         }
  6765         }
  6784     }
  6766     }
  6785 
  6767 
  6786 void CAknCharMap::GetFocusSctName(TChar& aChar, TDes& aName) const
  6768 void CAknCharMap::GetFocusSctName(TChar& aChar, TDes& aName) const
  6787     {
  6769     {