textinput/ptienginev2/src/Ptiqwertykeymappings.cpp
branchRCL_3
changeset 22 bd83ceabce89
parent 21 ecbabf52600f
equal deleted inserted replaced
21:ecbabf52600f 22:bd83ceabce89
    78 
    78 
    79 const TPtiKey vietnameseToneMarkKeys[KNumVietnameseToneMarks] = 
    79 const TPtiKey vietnameseToneMarkKeys[KNumVietnameseToneMarks] = 
    80     {
    80     {
    81     EPtiKeyQwertyS, EPtiKeyQwertyF, EPtiKeyQwertyR, EPtiKeyQwertyX, EPtiKeyQwertyJ	
    81     EPtiKeyQwertyS, EPtiKeyQwertyF, EPtiKeyQwertyR, EPtiKeyQwertyX, EPtiKeyQwertyJ	
    82     };
    82     };
       
    83 const TUint16 KShortCombine = 0xF010;
    83     
    84     
    84     
    85     
    85 //
    86 //
    86 // CPtiQwertyKeymappingsExtension
    87 // CPtiQwertyKeymappingsExtension
    87 //
    88 //
   538 // 
   539 // 
   539 // ---------------------------------------------------------------------------
   540 // ---------------------------------------------------------------------------
   540 // 
   541 // 
   541 TUint16 CPtiQwertyKeyMappings::GetCharForMode(TPtiEngineInputMode aMode, TPtrC aChars, TBool aSkipFirst)
   542 TUint16 CPtiQwertyKeyMappings::GetCharForMode(TPtiEngineInputMode aMode, TPtrC aChars, TBool aSkipFirst)
   542 	{
   543 	{
       
   544     if( DoesModeCharMatchToInputMode(KPtiPinyinMarker, aMode) ||
       
   545         DoesModeCharMatchToInputMode(KPtiStrokeMarker, aMode) ||
       
   546         DoesModeCharMatchToInputMode(KPtiZhuyinMarker, aMode) ||
       
   547         DoesModeCharMatchToInputMode(KPtiCangjieMarker, aMode))
       
   548         {
       
   549         for (TInt i = 0; i < aChars.Length(); i++)
       
   550             {
       
   551             if (DoesModeCharMatchToInputMode(aChars[i], aMode))
       
   552                 {
       
   553                 if (i + 1 >= aChars.Length())
       
   554                     {
       
   555                     return 0;
       
   556                     }
       
   557                 return aChars[i + 1];       
       
   558                 }
       
   559             }
       
   560         }   
   543 	for (TInt i = 0; i < aChars.Length(); i++)
   561 	for (TInt i = 0; i < aChars.Length(); i++)
   544 		{
   562 		{
   545 		if (!IsModeControlChar(aChars[i]))
   563 		if (!IsModeControlChar(aChars[i]))
   546 			{
   564 			{
   547 			if (i == 0 && aSkipFirst && aChars.Length() > 1)
   565 			if (i == 0 && aSkipFirst && aChars.Length() > 1)
   548 				{
   566 				{
   549 				iCurrentChar++;				
   567 				iCurrentChar++;				
   550 				continue;	
   568 				continue;	
   551 				}
   569 				}
       
   570 			if(aChars[i] != KShortCombine)
       
   571 			    {
   552 			return aChars[i];
   572 			return aChars[i];
   553 			}
   573 			}
   554 		if (DoesModeCharMatchToInputMode(aChars[i], aMode))
   574 			else
   555 			{
       
   556 			if (i + 1 >= aChars.Length())
       
   557 				{
   575 				{
   558 				return 0;
   576 				return 0;
   559 				}
   577 				}
   560 			return aChars[i + 1];		
       
   561 			}
   578 			}
   562 		i++;   // Wrong mode, skip char
   579 		i++;   // Wrong mode, skip char
   563 		}
   580 		}
   564 
   581 
   565 	return 0;
   582 	return 0;
   602 		{
   619 		{
   603 		key = iKeyMapData->KeyForBindingTableIndex(iKeyboardType, i, textCase);
   620 		key = iKeyMapData->KeyForBindingTableIndex(iKeyboardType, i, textCase);
   604 		if (key != EPtiKeyNone)
   621 		if (key != EPtiKeyNone)
   605 			{
   622 			{
   606 			TPtrC keyData = DataForKeyLocal(key, textCase, EPtiEngineQwerty);
   623 			TPtrC keyData = DataForKeyLocal(key, textCase, EPtiEngineQwerty);
   607 			if (keyData.Locate(aChar) != KErrNotFound)
   624 			TInt indexOfSpecialMark = keyData.Locate(KShortCombine);
       
   625             TInt indexOfChar = keyData.Locate(aChar);
       
   626             if (indexOfSpecialMark != KErrNotFound && indexOfChar != KErrNotFound && indexOfChar > indexOfSpecialMark)
       
   627                 {
       
   628                 continue;
       
   629                 }
       
   630             else if ( indexOfChar != KErrNotFound)
   608 				{
   631 				{
   609 				return key;
   632 				return key;
   610 				}			
   633 				}			
   611 			}
   634 			}
   612 		}
   635 		}