extras/calcsoft/src/CalcFunc.cpp
changeset 0 3ee3dfdd8d69
child 16 82ca176301de
equal deleted inserted replaced
-1:000000000000 0:3ee3dfdd8d69
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  The Function-Map subpane class, CCalcFuncmapSubPane
       
    15 *                Derived from CCoeControl.
       
    16 *                CCalcFuncmapSubPane is container class of CCalcCommandButton.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include <AknUtils.h>
       
    25 #include <aknViewAppUi.h>
       
    26 
       
    27 #include <AknsSkinInstance.h> 
       
    28 #include <aknpopuplayout.h> 
       
    29 #include <Calcsoft.rsg>
       
    30 #include <layoutmetadata.cdl.h>
       
    31 #include "CalcFunc.h"
       
    32 //#include "CalcCmdBtn.h"
       
    33 #include "CalcEnv.h"
       
    34 #include "CalcCont.h"
       
    35 #include "CalcView.h"
       
    36 #include "CalcOutSheet.h"
       
    37 #include "calc.hrh"
       
    38 #include "CalcDrawingConst.laf"
       
    39 #include "CalcView.h"
       
    40 #include <applayout.cdl.h>
       
    41 #include <aknlayoutscalable_apps.cdl.h>
       
    42 #include <AvkonInternalCRKeys.h>
       
    43 #include <PtiDefs.h>
       
    44 #include <PtiEngine.h>
       
    45 #include <PtiKeyMappings.h>
       
    46 #include <AknFepInternalCRKeys.h>
       
    47 #include <aknbutton.h>
       
    48 #include <AknsDrawUtils.h>
       
    49 
       
    50 #include <featmgr.h>      // Feature Manager
       
    51 
       
    52 //enum to hold the values of button states
       
    53 enum
       
    54 {
       
    55     EnNormal = 0,
       
    56     EnPressed,
       
    57     EnDimmed
       
    58 };
       
    59 //  LOCAL CONSTANTS AND MACROS  
       
    60 const TInt KButtonsInColumn(2);      // The number of column of a button
       
    61 const TInt KButtonsInRow(KCountOfButtons / KButtonsInColumn);
       
    62 const TInt KButtonsInColumnTouch(4);      // The number of column of a button in Touch layout
       
    63 const TInt KButtonsInRowTouch(KCountOfButtonsTouch / KButtonsInColumnTouch);
       
    64                                      // The number of row of a button
       
    65 const TInt KButtonsIdTblTouch[] =         // The command ID of a button in Touch Layout
       
    66                { 
       
    67                ECalcCmdCancel,          // C
       
    68                ECalcCmdSeven,          // 7
       
    69                ECalcCmdFour,          // 4
       
    70                ECalcCmdOne,          // 1
       
    71 			   ECalcCmdZero,          // 0
       
    72 			   ECalcCmdSqrt, 		 // Sqrt
       
    73                ECalcCmdEight,          // 8
       
    74                ECalcCmdFive,          // 5
       
    75                ECalcCmdTwo,          // 2
       
    76 			   ECalcCmdSeparator,          // .
       
    77 			   ECalcCmdPercent,		 // %	
       
    78 			   ECalcCmdNine,          // 9
       
    79                ECalcCmdSix,          // 6
       
    80                ECalcCmdThree,          // 3
       
    81                ECalcCmdChangeSign,   // +/- 
       
    82                ECalcCmdDivide,       // /
       
    83                ECalcCmdMultiply,     // *
       
    84                ECalcCmdSubtract,     // -
       
    85                ECalcCmdAdd,          // +
       
    86                ECalcCmdResult       // =
       
    87 				};
       
    88 				
       
    89 const TInt KButtonsIdTbl[] =         // The command ID of a button in non Touch Layout
       
    90                { 
       
    91                ECalcCmdAdd,          // +
       
    92                ECalcCmdSubtract,     // -
       
    93                ECalcCmdMultiply,     // *
       
    94                ECalcCmdDivide,       // /
       
    95                ECalcCmdChangeSign,   // +/- 
       
    96                ECalcCmdResult,       // =
       
    97 			   ECalcCmdSqrt, 		 // Sqrt
       
    98 			   ECalcCmdPercent,		 // %
       
    99                ECalcCmdScrollUp,     // Scroll-up
       
   100                ECalcCmdScrollDown    // Scroll-down
       
   101 				};
       
   102 
       
   103 
       
   104 // If const TChar is used, complie error occurs in THUMB build.
       
   105 // To avoid this, #define is used.
       
   106 #define KCalcAsteriskBtn '*'
       
   107 
       
   108 
       
   109 // ================= MEMBER FUNCTIONS =======================
       
   110 
       
   111 // Two-phased constructor.
       
   112 CCalcFuncmapSubPane* CCalcFuncmapSubPane::NewL(
       
   113                      CCalcContainer* aContainer)
       
   114     {
       
   115     CCalcFuncmapSubPane* self = new (ELeave) CCalcFuncmapSubPane();
       
   116     CleanupStack::PushL(self);
       
   117     self->ConstructL(aContainer);
       
   118     CleanupStack::Pop(self); 
       
   119     return self;
       
   120     }
       
   121 
       
   122 
       
   123 // Destructor
       
   124 CCalcFuncmapSubPane::~CCalcFuncmapSubPane()
       
   125     {
       
   126         for (TInt count(0); count < KCountOfButtonsTouch; count++)
       
   127             {
       
   128                 if(iButtons[count])
       
   129                 {
       
   130                      delete iButtons[count];    
       
   131                 }
       
   132                 
       
   133             }
       
   134    
       
   135     // delete of button controls
       
   136        iQwertyModeStatusProperty.Close();
       
   137        delete iEngine;
       
   138        delete iCRKey;
       
   139     }
       
   140 
       
   141 // ---------------------------------------------------------
       
   142 // CCalcFuncmapSubPane::SetScrollupEnable
       
   143 // \ scroll up and down button on scrolling enable.
       
   144 // (other items were commented in a header).
       
   145 // ---------------------------------------------------------
       
   146 //
       
   147 void CCalcFuncmapSubPane::RedrawScrollButtons()
       
   148     {
       
   149     CCalcOutputSheet* outputSheet = iContainer->OutputSheet();
       
   150     SetScrollupEnable(outputSheet->CanUp());
       
   151     SetScrolldownEnable(outputSheet->CanDown());
       
   152     }
       
   153 
       
   154 
       
   155 
       
   156 // ---------------------------------------------------------
       
   157 // CCalcFuncmapSubPane::SetChangeSignEnable
       
   158 // Redraw ChangeSign button on ChangeSign enable.
       
   159 // (other items were commented in a header).
       
   160 // ---------------------------------------------------------
       
   161 //
       
   162 void CCalcFuncmapSubPane::SetChangeSignEnable
       
   163                             (TBool aEnable)
       
   164     {
       
   165 
       
   166 				/*Get the selected pointer 
       
   167 				button -> different layouts, different values*/
       
   168         CAknButton* button = NULL;
       
   169         if( AknLayoutUtils::PenEnabled() )
       
   170         {
       
   171             button = iButtons[ECmdTChangeSign];
       
   172         }
       
   173         else
       
   174         {
       
   175             button = iButtons[EChangeSignButton];
       
   176         }
       
   177         
       
   178         //Set to dimmed state
       
   179         button->SetDimmed( !aEnable );
       
   180         button->DrawNow();
       
   181         iIsChangeSignDimmed = aEnable;
       
   182     }
       
   183 
       
   184 // ---------------------------------------------------------
       
   185 // CCalcFuncmapSubPane::SetClearKeyEnable
       
   186 // Redraw ClearKey button on ClearKey enable.
       
   187 // (other items were commented in a header).
       
   188 // ---------------------------------------------------------
       
   189 //
       
   190 void CCalcFuncmapSubPane::SetClearKeyEnable( TBool aEnable )
       
   191     {
       
   192     if ( AknLayoutUtils::PenEnabled() )
       
   193         {
       
   194         CAknButton* button = NULL;
       
   195         button = iButtons[ECmdTCancel];
       
   196 
       
   197         if ( button )
       
   198             {
       
   199             button->SetDimmed( !aEnable );   
       
   200             button->DrawNow();
       
   201             }      
       
   202         }
       
   203     iIsClearKeyEnabled = aEnable;
       
   204    }
       
   205 
       
   206 // ---------------------------------------------------------
       
   207 // CCalcFuncmapSubPane::NotifyTimeoutL
       
   208 // If no key is pressed until timeout of *-key,
       
   209 // this function is called.
       
   210 // (other items were commented in a header).
       
   211 // ---------------------------------------------------------
       
   212 //
       
   213 void CCalcFuncmapSubPane::NotifyTimeoutL()
       
   214     {
       
   215 
       
   216 	  /*Get the selected pointer 
       
   217 		button -> different layouts, different values*/
       
   218     CAknButton* button = iButtons[iSelected];    
       
   219     if( !AknLayoutUtils::PenEnabled() )
       
   220         {
       
   221 #ifdef RD_INTELLIGENT_TEXT_INPUT  
       
   222         if ( iKeyboardType == EPtiKeyboardHalfQwerty )
       
   223         	{
       
   224             if( ( iLastKeyCode == EStdKeyLeftShift && iDecimalPoint ) || ( iLastKeyCode == EStdKeyLeftFunc && iDecimalPoint ))
       
   225     	        {
       
   226                 iContainer->SetSeparatorFromTouchL();
       
   227         	    }
       
   228             else
       
   229                 {
       
   230                 iContainer->View()->HandleCommandL( KButtonsIdTbl[iSelected] );
       
   231                 }
       
   232         	}
       
   233         else
       
   234 #endif
       
   235         	{
       
   236             iContainer->View()->HandleCommandL( KButtonsIdTbl[iSelected] );
       
   237         	}
       
   238         }
       
   239     else
       
   240         {
       
   241         iContainer->View()->HandleCommandL( KButtonsIdTblTouch[iSelected] );
       
   242         }   
       
   243    
       
   244 #ifdef RD_INTELLIGENT_TEXT_INPUT  
       
   245     if ( iKeyboardType == EPtiKeyboardHalfQwerty )
       
   246     	{
       
   247         iLastKeyCode = 0;
       
   248     	}
       
   249 #endif
       
   250     
       
   251     //Set to dimmed state
       
   252     button->SetDimmed( EFalse );
       
   253     DrawDeferred();    
       
   254     }
       
   255 
       
   256 // ---------------------------------------------------------
       
   257 // CCalcFuncmapSubPane::NotifyReleaseKeyL
       
   258 // Notify any key is released. If pressed button exists.
       
   259 // command which is releated is executed.
       
   260 // (other items were commented in a header).
       
   261 // ---------------------------------------------------------
       
   262 //
       
   263 void CCalcFuncmapSubPane::NotifyReleaseKeyL()
       
   264     {
       
   265 				/*Get the selected pointer 
       
   266 				button -> different layouts, different values*/
       
   267         CAknButton* button = iButtons[iSelected];
       
   268         CAknButtonState* state = button->State(EnNormal);      	
       
   269         
       
   270         if(state->Flags() == EnPressed)
       
   271         {
       
   272           TKeyEvent aKeyEvent;
       
   273           aKeyEvent.iScanCode = EStdKeyEnter;
       
   274           TEventCode aType = EEventKeyUp;
       
   275           //trigger offerkeyeventl to this button
       
   276           button->OfferKeyEventL(aKeyEvent,aType);
       
   277 	      state->SetFlags(EnNormal);    
       
   278 	      button->DrawNow();
       
   279         }
       
   280       if( !AknLayoutUtils::PenEnabled() )
       
   281        	{
       
   282        	  if(iSelected == EScrollUp)
       
   283             {
       
   284                 CCalcOutputSheet* outputSheet = iContainer->OutputSheet();
       
   285                 if(!outputSheet->CanUp())
       
   286                 {
       
   287                     RedrawHighlight(EScrollUp,EScrollDown);
       
   288                     iSelected = EScrollDown;
       
   289                 }
       
   290             }
       
   291             
       
   292           if(iSelected == EScrollDown)
       
   293             {
       
   294                 CCalcOutputSheet* outputSheet = iContainer->OutputSheet();
       
   295                 if(!outputSheet->CanDown())
       
   296                 {
       
   297                     RedrawHighlight(EScrollDown,EScrollUp);
       
   298                     iSelected = EScrollUp;
       
   299                 }
       
   300             }
       
   301             
       
   302        	}
       
   303 
       
   304 	   }
       
   305 
       
   306 // ---------------------------------------------------------
       
   307 // CCalcFuncmapSubPane::NotifyOtherThanOkKeyPressed
       
   308 // If key other than OK-key is pressed this function is called.
       
   309 // (other items were commented in a header).
       
   310 // ---------------------------------------------------------
       
   311 //
       
   312 void CCalcFuncmapSubPane::NotifyOtherThanOkKeyPressed()
       
   313     {
       
   314     //for (TInt cnt(0); cnt < iCountOfButtons; cnt++)
       
   315         {
       
   316           //Get the pointer for the button
       
   317          CAknButton* button = iButtons[iSelected];
       
   318          CAknButtonState* state = button->State(EnNormal);
       
   319          if(state->Flags() == EnPressed)
       
   320             {
       
   321           state->SetFlags(EnNormal);
       
   322           button->DrawNow();
       
   323             }
       
   324         }
       
   325 
       
   326     }
       
   327 
       
   328 // ---------------------------------------------------------
       
   329 // CCalcFuncmapSubPane::NotifyLangChange
       
   330 // Called if language is changed.
       
   331 // Change layout according to the language.
       
   332 // (other items were commented in a header).
       
   333 // ---------------------------------------------------------
       
   334 //
       
   335 void CCalcFuncmapSubPane::NotifyLangChange()
       
   336     {
       
   337     // Write code here.
       
   338     SetLayout();
       
   339     DrawNow();
       
   340     }
       
   341 
       
   342 
       
   343 // ---------------------------------------------------------
       
   344 // CCalcFuncmapSubPane::IsQwertyKeypadActive
       
   345 // Called to check qwerty keypad is active or not
       
   346 // (other items were commented in a header).
       
   347 // ---------------------------------------------------------
       
   348 //
       
   349  TInt CCalcFuncmapSubPane::IsQwertyKeypadActive()
       
   350   {
       
   351  	TInt value = 0;
       
   352     
       
   353     iQwertyModeStatusProperty.Get(value);
       
   354     
       
   355     return value;
       
   356  }
       
   357 
       
   358 // ---------------------------------------------------------
       
   359 // CCalcFuncmapSubPane::HandleControlEventL
       
   360 // Observer event from avkon button change
       
   361 // (other items were commented in a header).
       
   362 // ---------------------------------------------------------
       
   363 void CCalcFuncmapSubPane::HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType)
       
   364     {    
       
   365     iIsKeyLongPress = EFalse;   
       
   366     if ( aEventType != EEventStateChanged && aEventType != CAknButton::ELongPressEvent )
       
   367         {
       
   368         return;
       
   369         }
       
   370     else if ( aEventType == CAknButton::ELongPressEvent )
       
   371         {
       
   372         iIsKeyLongPress = ETrue;
       
   373         }
       
   374         
       
   375     //Get the selected button
       
   376     CAknButton* button = (CAknButton*)aControl;
       
   377     
       
   378     for ( TInt i = 0; i < KCountOfButtons; ++i )
       
   379         {
       
   380         if ( button == iButtons[i] )
       
   381             {
       
   382             if(iSelected != i)
       
   383             return;
       
   384             
       
   385             //break;
       
   386             }
       
   387         }    
       
   388     
       
   389     if ( !button->IsDimmed() )
       
   390         {
       
   391         		//handles all the commands for the buttons
       
   392             if( !AknLayoutUtils::PenEnabled() )
       
   393             {
       
   394             iContainer->View()->HandleCommandL(KButtonsIdTbl[iSelected]);
       
   395             if(iSelected == EScrollUp)
       
   396             {
       
   397                 CCalcOutputSheet* outputSheet = iContainer->OutputSheet();
       
   398                 if(!outputSheet->CanUp())
       
   399                 {
       
   400                     RedrawHighlight(EScrollUp,EScrollDown);
       
   401                     iSelected = EScrollDown;
       
   402                 }
       
   403             }
       
   404             else if(iSelected == EScrollDown)
       
   405             {
       
   406                 CCalcOutputSheet* outputSheet = iContainer->OutputSheet();
       
   407                 if(!outputSheet->CanDown())
       
   408                 {
       
   409                     RedrawHighlight(EScrollDown,EScrollUp);
       
   410                     iSelected = EScrollUp;
       
   411                 }
       
   412             }
       
   413             }
       
   414             else
       
   415             {
       
   416             iContainer->View()->HandleCommandL(KButtonsIdTblTouch[iSelected]);
       
   417             }   
       
   418 
       
   419         }    
       
   420     }
       
   421 
       
   422 // ---------------------------------------------------------
       
   423 // CCalcFuncmapSubPane::OfferKeyEventL
       
   424 // This function is called by CCalcContainer::OfferKeyEventL
       
   425 // (other items were commented in a header).
       
   426 // ---------------------------------------------------------
       
   427 //
       
   428 TKeyResponse CCalcFuncmapSubPane::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
       
   429 {
       
   430     TKeyResponse exitCode(EKeyWasNotConsumed);
       
   431        
       
   432     TPtiKey keyQwertyValue = (TPtiKey)aKeyEvent.iScanCode;
       
   433     
       
   434     if(IsQwertyKeypadActive())  
       
   435         {
       
   436 #ifdef RD_INTELLIGENT_TEXT_INPUT  
       
   437         if ( iKeyboardType == EPtiKeyboardHalfQwerty )
       
   438         	{
       
   439             TBuf<KMaxNumCharsPerCase> keys;
       
   440             TInt firstoperator(-1);
       
   441             TInt secondoperator(-1);
       
   442                    
       
   443             TInt oldSelect( iSelected );
       
   444             
       
   445             if ( ( aKeyEvent.iScanCode == EStdKeyLeftFunc && aType == EEventKeyDown ) || 
       
   446                  ( aKeyEvent.iScanCode == EStdKeyLeftShift && aType == EEventKeyDown ) )
       
   447                  {            
       
   448                  iEngine->MappingDataForKey( keyQwertyValue, keys, EPtiCaseFnLower  );
       
   449                  MapDataForChrShiftKey( keys, firstoperator, secondoperator);
       
   450                  if ( (secondoperator == -1) && (firstoperator != -1))
       
   451                 	 {
       
   452                      if ( AknLayoutUtils::PenEnabled() )
       
   453                          {
       
   454                          iSelected = firstoperator;    
       
   455                          }
       
   456                      else
       
   457                          {
       
   458                          if ( firstoperator == ECmdTSeparator )
       
   459                         	 {
       
   460                         	 iDecimalPoint = ETrue;
       
   461                         	 }
       
   462                          else
       
   463                         	 {
       
   464                         	 iSelected = firstoperator;
       
   465                         	 iDecimalPoint = EFalse;
       
   466                         	 }
       
   467                          }                	 
       
   468                 	 }
       
   469                  else if ( (firstoperator == -1) && (secondoperator != -1) )
       
   470                 	 {
       
   471                      if ( AknLayoutUtils::PenEnabled() )
       
   472                          {
       
   473                          iSelected = secondoperator;    
       
   474                          }
       
   475                      else
       
   476                          {
       
   477                          if ( secondoperator == ECmdTSeparator )
       
   478                         	 {
       
   479                         	 iDecimalPoint = ETrue;
       
   480                         	 }
       
   481                          else
       
   482                         	 {
       
   483                         	 iSelected = secondoperator;
       
   484                         	 iDecimalPoint = EFalse;
       
   485                         	 }
       
   486                          }                	 
       
   487                 	 }
       
   488                  else if ( (firstoperator != -1) && (secondoperator != -1) )
       
   489                 	 {
       
   490                      if ( iLastKeyCode == aKeyEvent.iScanCode )
       
   491                          {
       
   492                          if ( AknLayoutUtils::PenEnabled() )
       
   493                              {
       
   494                              if ( iSelected == firstoperator )
       
   495                                  {
       
   496                                  iSelected = secondoperator;
       
   497                                  }
       
   498                              else
       
   499                                  {
       
   500                                  iSelected = firstoperator;
       
   501                                  }
       
   502                              }
       
   503                          else
       
   504                         	 {
       
   505                               if ( firstoperator == ECmdTSeparator || secondoperator == ECmdTSeparator )
       
   506                             	  {
       
   507                             	  if ( iDecimalPoint )
       
   508                             		  {
       
   509                             		  iDecimalPoint = EFalse;
       
   510                             		  if ( firstoperator == ECmdTSeparator )
       
   511                             			  {
       
   512                             			  iSelected = secondoperator;
       
   513                             			  }
       
   514                             		  else
       
   515                             			  {
       
   516                             			  iSelected = firstoperator;
       
   517                             			  }                 		  
       
   518                             		  }
       
   519                             	  else
       
   520                             		  {
       
   521                             		  iDecimalPoint = ETrue;
       
   522                             		  }
       
   523                             	  }
       
   524                               else
       
   525                             	  {
       
   526                                   if ( iSelected == firstoperator )
       
   527                                       {
       
   528                                       iSelected = secondoperator;
       
   529                                       }
       
   530                                   else
       
   531                                       {
       
   532                                       iSelected = firstoperator;
       
   533                                       }                	  
       
   534                             	  }
       
   535                         	 }
       
   536                          }
       
   537                      else
       
   538                          {
       
   539                          if ( AknLayoutUtils::PenEnabled() )
       
   540                              {
       
   541                              iSelected = firstoperator;    
       
   542                              }
       
   543                          else
       
   544                              {
       
   545                              if ( firstoperator == ECmdTSeparator )
       
   546                             	 {
       
   547                             	 iDecimalPoint = ETrue;
       
   548                             	 }
       
   549                              else
       
   550                             	 {
       
   551                             	 iSelected = firstoperator;
       
   552                             	 iDecimalPoint = EFalse;
       
   553                             	 }
       
   554                              }
       
   555 
       
   556                          }
       
   557                      }
       
   558                      RedrawHighlight( oldSelect, iSelected );
       
   559                      iLastKeyCode = aKeyEvent.iScanCode;
       
   560                      exitCode = EKeyWasConsumed;
       
   561                      
       
   562                      iIsShiftKeyPressed = ETrue;
       
   563                  }
       
   564             }
       
   565          else
       
   566 #endif
       
   567         	{
       
   568         	//For Multiplication operator in Qwerty keypad
       
   569         	if(((aKeyEvent.iScanCode == EStdKeyLeftShift) || (aKeyEvent.iScanCode == EStdKeyRightShift)) && aType == EEventKeyDown)
       
   570         	    {
       
   571         	     if(iShiftKeyPressed == EPtiCaseLower )
       
   572         		     {
       
   573         		   	 iShiftKeyPressed = EPtiCaseUpper;
       
   574         		   	 iShiftKey = 0;
       
   575         		   	 iValue = ETrue;
       
   576         		     }
       
   577         	      
       
   578         	     else
       
   579         	     	{
       
   580         			iShiftKeyPressed = EPtiCaseLower;
       
   581         	     	}
       
   582         	    exitCode = EKeyWasConsumed; 	
       
   583         	    
       
   584         	    iIsShiftKeyPressed = ETrue;
       
   585         	    }
       
   586         	else if((aKeyEvent.iScanCode == EStdKeyLeftShift || aKeyEvent.iScanCode == EStdKeyRightShift)&& aType == EEventKeyUp)
       
   587         		{
       
   588                         /*if(((iLanguage == ELangFrench) || (iLanguage == ELangTaiwanChinese) || 
       
   589                             (iLanguage == ELangCzech) || (iLanguage == ELangSlovak))&& iShiftKey >= 1)*/
       
   590                                 if( iShiftKey >= 1 )
       
   591         			{
       
   592         			iShiftKeyPressed = EPtiCaseLower;
       
   593         			}
       
   594         		iValue = EFalse;
       
   595         	    exitCode = EKeyWasConsumed; 
       
   596         	    
       
   597         	    iIsShiftKeyPressed = ETrue;
       
   598         	    }
       
   599         	}
       
   600 	      //else
       
   601      if ( !iIsShiftKeyPressed )
       
   602 		{
       
   603 		if (aType != EEventKey)
       
   604         {
       
   605 	        if (aType == EEventKeyDown)
       
   606 			    {
       
   607 			        iIsOfferKeyEvent = ETrue;        
       
   608 			    }
       
   609 			    else if (aType == EEventKeyUp)
       
   610 			    {
       
   611 			        iIsOfferKeyEvent = EFalse;        
       
   612 			    }
       
   613             // when users press send key, EKeyWasNotConsumed is returned to system
       
   614             // to open dialer 
       
   615             if ( aKeyEvent.iScanCode == EStdKeyYes )
       
   616                 {
       
   617                 return EKeyWasNotConsumed;
       
   618                 }
       
   619         return EKeyWasConsumed;
       
   620         }
       
   621 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   622         if( MapNumericCharL( aKeyEvent ) )
       
   623             {
       
   624             exitCode = EKeyWasConsumed;
       
   625             iShiftKeyPressed = EPtiCaseLower;
       
   626             }
       
   627 #else
       
   628 		if(MapNumericCharL(keyQwertyValue,iShiftKeyPressed))
       
   629 			{
       
   630 			exitCode = EKeyWasConsumed;
       
   631 			iShiftKeyPressed = EPtiCaseLower;		
       
   632 			}
       
   633 #endif
       
   634 		else 
       
   635 			{
       
   636 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   637             if( MapNumerics( aKeyEvent ) || aKeyEvent.iCode == EKeyBackspace )
       
   638                 {
       
   639                 exitCode = EKeyWasNotConsumed;
       
   640                 iShiftKeyPressed = EPtiCaseLower;
       
   641                 
       
   642                                 /*if((iLanguage == ELangFrench) || (iLanguage == ELangTaiwanChinese) || 
       
   643                                          (iLanguage == ELangCzech) || (iLanguage == ELangSlovak))*/
       
   644                     {
       
   645                     if( !iValue )
       
   646                     iShiftKeyPressed = EPtiCaseLower;
       
   647 
       
   648                     else
       
   649                     iShiftKeyPressed = EPtiCaseUpper;
       
   650                     iShiftKey++;
       
   651                     }
       
   652                 }
       
   653 #else
       
   654 			if(MapNumerics(keyQwertyValue,iShiftKeyPressed) || aKeyEvent.iCode == EKeyBackspace)
       
   655 				{
       
   656 				exitCode = EKeyWasNotConsumed;
       
   657 				iShiftKeyPressed = EPtiCaseLower;
       
   658 
       
   659                                 /*if((iLanguage == ELangFrench) || (iLanguage == ELangTaiwanChinese) || 
       
   660                                          (iLanguage == ELangCzech) || (iLanguage == ELangSlovak))*/
       
   661 					{
       
   662 					if(!iValue)
       
   663 					iShiftKeyPressed = EPtiCaseLower;
       
   664 					
       
   665 					else
       
   666 					iShiftKeyPressed = EPtiCaseUpper;
       
   667 					iShiftKey++;	
       
   668 					}
       
   669 				}
       
   670 #endif
       
   671 			else
       
   672 				{
       
   673 				exitCode = EKeyWasConsumed;	
       
   674 				iShiftKeyPressed = EPtiCaseLower;
       
   675 				}
       
   676 			
       
   677 			}
       
   678 
       
   679 		}	    
       
   680 
       
   681     // handle Enter key event	
       
   682     if ( aKeyEvent.iCode == EKeyEnter )
       
   683         {
       
   684         exitCode = EKeyWasConsumed;
       
   685         HandleMiddleSoftKeyOREKeyOKL();
       
   686         iShiftKeyPressed = EPtiCaseLower;
       
   687         return exitCode;
       
   688         }
       
   689     
       
   690 	iIsShiftKeyPressed = EFalse;
       
   691 		
       
   692 	}
       
   693  
       
   694 /*	if(aKeyEvent.iCode == EKeyOK)
       
   695     {
       
   696        
       
   697         HandleMiddleSoftKeyOREKeyOKL();
       
   698         exitCode = EKeyWasConsumed;
       
   699     }   
       
   700     else if (aType == EEventKey)*/
       
   701     if (aType == EEventKey)
       
   702     {
       
   703         TInt oldSelect(iSelected);
       
   704         TInt row(iSelected % iButtonsInRow);
       
   705         TInt column(iSelected / iButtonsInRow);
       
   706         iIsOfferKeyEvent = EFalse; 
       
   707         switch(aKeyEvent.iCode)
       
   708         {
       
   709             case EKeyLeftArrow:
       
   710             {
       
   711                 
       
   712                 do
       
   713                 {   
       
   714                    
       
   715                         column--;
       
   716                         
       
   717                         if(column < 0)
       
   718                         {
       
   719                             column = iButtonsInColumn -1;
       
   720                             row--;
       
   721 
       
   722                             if( row < 0 )
       
   723                             {
       
   724                                 row = iButtonsInRow -1;
       
   725                             }
       
   726                         }
       
   727                     
       
   728                     iSelected = row + column * iButtonsInRow;
       
   729 
       
   730                 }while( iButtons[iSelected]->IsDimmed() );
       
   731                 
       
   732                 RedrawHighlight(oldSelect, iSelected);
       
   733 
       
   734                 exitCode = EKeyWasConsumed;
       
   735                 break;
       
   736             }
       
   737             
       
   738             case EKeyRightArrow:
       
   739             {
       
   740                                
       
   741                 do
       
   742                 {   
       
   743                         column++;
       
   744                         
       
   745                         if(column == iButtonsInColumn)
       
   746                         {
       
   747                             column = 0;
       
   748                             row++;
       
   749                             
       
   750                             if( row >= iButtonsInRow )
       
   751                             {
       
   752                                 row = 0;
       
   753                             }
       
   754                         }
       
   755                     
       
   756                     iSelected = row + column * iButtonsInRow;
       
   757 
       
   758                 }while( iButtons[iSelected]->IsDimmed() );
       
   759                 
       
   760                 RedrawHighlight(oldSelect, iSelected);
       
   761                 exitCode = EKeyWasConsumed;
       
   762                 break;
       
   763             }
       
   764             
       
   765             case EKeyUpArrow:
       
   766             {
       
   767                 
       
   768                 SetNextCursorPosForUpArrow(oldSelect);
       
   769 
       
   770                 RedrawHighlight(oldSelect, iSelected);
       
   771                 exitCode = EKeyWasConsumed;
       
   772                 break;
       
   773             }
       
   774             
       
   775             case EKeyDownArrow:
       
   776             {
       
   777                 
       
   778                 SetNextCursorPosForDownArrow(oldSelect);
       
   779  
       
   780                 RedrawHighlight(oldSelect, iSelected);
       
   781                 exitCode = EKeyWasConsumed;
       
   782                 break;
       
   783             }
       
   784 
       
   785             case EKeyOK:
       
   786             {
       
   787             if ( !AknLayoutUtils::PenEnabled() )
       
   788                 {
       
   789                 // get and judge the state of button
       
   790                 CAknButton* button = iButtons[iSelected];
       
   791                 CAknButtonState* state = button->State( EnNormal ); 
       
   792                 if ( ( iSelected == EScrollUp || iSelected == EScrollDown ) 
       
   793                     && ( state->Flags() == EnPressed ) )
       
   794                     {
       
   795                     iContainer->View()->HandleCommandL( KButtonsIdTbl[iSelected] );
       
   796                     // when the history arrives the top or bottom,the button should be set dimmed
       
   797                     CCalcOutputSheet* outputSheet = iContainer->OutputSheet();
       
   798                     if ( !( outputSheet->CanDown() ) && iSelected == EScrollDown )
       
   799                         {
       
   800                         button->SetDimmed( ETrue );
       
   801                         DrawDeferred();  
       
   802                         }
       
   803                     if ( !( outputSheet->CanUp() ) && iSelected == EScrollUp )
       
   804                         {
       
   805                         button->SetDimmed( ETrue );
       
   806                         DrawDeferred();  
       
   807                         }   
       
   808                     }
       
   809                 }
       
   810                 break;
       
   811             }
       
   812             default:
       
   813             {
       
   814                if(!IsQwertyKeypadActive())
       
   815              {
       
   816                 if(aKeyEvent.iCode == KCalcAsteriskBtn)
       
   817                 {
       
   818                     if(iLastKeyCode == aKeyEvent.iCode)
       
   819                     {
       
   820                         row++;
       
   821                         
       
   822                         if(row == iButtonsInRow - 1)  // Equal is not contained in a loop.
       
   823                         {
       
   824                             row = 0;
       
   825                         }
       
   826                         iSelected = row + column * iButtonsInRow;
       
   827                     }
       
   828                     else
       
   829                     {
       
   830                         if(AknLayoutUtils::PenEnabled())
       
   831                             {
       
   832                               iSelected = ECmdTAdd;    
       
   833                             }
       
   834                         else
       
   835                             {
       
   836                               iSelected = EPlusButton;    
       
   837                             }    
       
   838                         
       
   839                     }
       
   840                     RedrawHighlight(oldSelect, iSelected);
       
   841                     exitCode = EKeyWasConsumed;
       
   842                 }
       
   843              }
       
   844             break;
       
   845             }
       
   846         }
       
   847         iLastKeyCode = aKeyEvent.iCode;
       
   848         
       
   849     }
       
   850     else if (aType == EEventKeyDown)
       
   851     {
       
   852         iIsOfferKeyEvent = ETrue;        
       
   853     }
       
   854     else if (aType == EEventKeyUp)
       
   855     {
       
   856         iIsOfferKeyEvent = EFalse;        
       
   857     }
       
   858     
       
   859    
       
   860     return exitCode;
       
   861 }
       
   862 
       
   863 
       
   864 // C++ default constructor can NOT contain any code, that
       
   865 // might leave.
       
   866 //
       
   867 CCalcFuncmapSubPane::CCalcFuncmapSubPane()
       
   868     {
       
   869     }
       
   870 
       
   871 
       
   872 // default constructor can leave.
       
   873 void CCalcFuncmapSubPane::ConstructL
       
   874       (CCalcContainer* aContainer) 
       
   875     {
       
   876     iSelected = 0;    
       
   877     iContainer = aContainer;
       
   878     iIsOfferKeyEvent = EFalse;
       
   879 
       
   880     SetContainerWindowL(*iContainer);
       
   881     // Read character sequence tables, such as -, +.
       
   882     iCalcAppEnv = CCalcAppEnv::Static();
       
   883     iIsChangeSignDimmed = ETrue;
       
   884     
       
   885        if( AknLayoutUtils::PenEnabled() )
       
   886     {
       
   887         iCountOfButtons = KCountOfButtonsTouch;
       
   888         iButtonsInRow = KButtonsInRowTouch;
       
   889         iButtonsInColumn = KButtonsInColumnTouch;
       
   890       
       
   891     }
       
   892     else
       
   893     {
       
   894         iCountOfButtons = KCountOfButtons;
       
   895         iButtonsInRow = KButtonsInRow;
       
   896         iButtonsInColumn = KButtonsInColumn;  
       
   897         
       
   898     }
       
   899     
       
   900 
       
   901     for (TInt count = 0; count < iCountOfButtons; count++)
       
   902         {        
       
   903         //Create the AknButtons
       
   904         if(AknLayoutUtils::PenEnabled())
       
   905             {
       
   906                 iButtons[count] = CAknButton::NewL(
       
   907             iCalcAppEnv->UnpressedButtonBmp(count),
       
   908             NULL,
       
   909             NULL,
       
   910             NULL,
       
   911             _L(""),
       
   912             _L(""),
       
   913             0,
       
   914             0
       
   915             );     
       
   916             
       
   917             }
       
   918         else
       
   919             {
       
   920             
       
   921                 iButtons[count] = CAknButton::NewL(
       
   922             iCalcAppEnv->UnpressedButtonBmp(count),
       
   923             NULL,
       
   924             iCalcAppEnv->PressedButtonBmp(count),
       
   925             NULL,
       
   926             _L(""),
       
   927             _L(""),
       
   928             0,
       
   929             0
       
   930             );     
       
   931             /*if((count == ESqrtButton) && !iIsChangeSignDimmed)
       
   932             {
       
   933                 iButtons[count]->SetDimmed(ETrue);
       
   934             }*/
       
   935             
       
   936             }
       
   937         
       
   938         iButtons[count]->SetContainerWindowL( *this );
       
   939         iButtons[count]->SetObserver( this );     
       
   940         }
       
   941 
       
   942     if ( AknLayoutUtils::PenEnabled() )
       
   943         {
       
   944         iButtons[ECmdTCancel]->SetButtonFlags( KAknButtonReportOnLongPress );
       
   945         }
       
   946     iSelected = 0;
       
   947     RedrawHighlight( iSelected, iSelected );
       
   948 
       
   949     User::LeaveIfError(iQwertyModeStatusProperty.Attach(KCRUidAvkon, KAknQwertyInputModeActive));
       
   950    
       
   951     iShiftKeyPressed = EPtiCaseLower;
       
   952     iShiftKey		 = 0;
       
   953 
       
   954      // Try to get the English key mappings. If those are not available, use the 
       
   955     // mappings of the current input language. The order is this because all mappings
       
   956     // do not necessarily contain all characters neeeded by the Calculator.
       
   957     iLanguage = ELangEnglish;
       
   958     iEngine = CPtiEngine::NewL(ETrue);
       
   959     iCoreLanguage = static_cast<CPtiCoreLanguage*>(iEngine->GetLanguage( iLanguage ));
       
   960 
       
   961     if( !iCoreLanguage )
       
   962     	{
       
   963         iCRKey = CRepository::NewL(KCRUidAknFep);
       
   964         TInt ret = iCRKey->Get(KAknFepInputTxtLang,iLanguage);
       
   965         if( ret!= KErrNone )
       
   966             {
       
   967             //Exit application if server is busy( Error Raised )
       
   968             iAvkonViewAppUi->Exit();
       
   969             }
       
   970             iCoreLanguage = static_cast<CPtiCoreLanguage*>(iEngine->GetLanguage(iLanguage));
       
   971          }
       
   972 
       
   973     RProperty::Get( KCRUidAvkon, KAknKeyBoardLayout, iKeyboardType );
       
   974     
       
   975     if( iCoreLanguage )
       
   976         {
       
   977 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   978         if ( iKeyboardType == EPtiKeyboardHalfQwerty)
       
   979            {
       
   980            iHalfQwertyKeyMappings = static_cast<CPtiHalfQwertyKeyMappings*>(iCoreLanguage->GetHalfQwertyKeymappings());
       
   981            }
       
   982        else
       
   983 #endif
       
   984           {
       
   985           iQwertyKeyMappings = static_cast<CPtiQwertyKeyMappings*>(iCoreLanguage->GetQwertyKeymappings());
       
   986           }
       
   987         }
       
   988 
       
   989         // UI language is used to determine the used number format.
       
   990         iUiLanguage = User::Language();
       
   991   
       
   992         
       
   993 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   994         
       
   995         if ( iKeyboardType == EPtiKeyboardHalfQwerty )
       
   996             { 
       
   997             iEngine->ActivateLanguageL( iLanguage, EPtiEngineHalfQwerty );
       
   998             }
       
   999         else if ( IsQwertyKeypadActive())
       
  1000             { 
       
  1001             iEngine->ActivateLanguageL( iLanguage, EPtiEngineQwerty );
       
  1002             }  
       
  1003        
       
  1004   //      RProperty::Get( KCRUidAvkon, KAknKeyBoardLayout, iKeyboardType );
       
  1005         iEngine->SetKeyboardType( TPtiKeyboardType (iKeyboardType ));
       
  1006         
       
  1007 #endif
       
  1008     
       
  1009     iIsShiftKeyPressed = EFalse;
       
  1010 
       
  1011     }
       
  1012 
       
  1013 //	---------------------------------------------------------
       
  1014 // CCalcFuncmapSubPane::RefreshButtonIcons
       
  1015 // This function is called by CCalcContainer::OfferKeyEventL
       
  1016 // (other items were commented in a header).
       
  1017 // ---------------------------------------------------------
       
  1018 //
       
  1019 void CCalcFuncmapSubPane::RefreshButtonIcons()
       
  1020 {
       
  1021 	/*for (TInt count(0); count < iCountOfButtons; count++)
       
  1022         {
       
  1023         iButtons[count]->SetBitmapIcons(iCalcAppEnv->UnpressedButtonBmp(count),
       
  1024 			iCalcAppEnv->PressedButtonBmp(count),
       
  1025 			iCalcAppEnv->InactiveButtonBmp(count));
       
  1026         }*/
       
  1027 }
       
  1028 // ---------------------------------------------------------
       
  1029 // CCalcFuncmapSubPane::SetScrollupEnable
       
  1030 // Redraw scroll-up button on scrolling enable.
       
  1031 // (other items were commented in a header).
       
  1032 // ---------------------------------------------------------
       
  1033 //
       
  1034 void CCalcFuncmapSubPane::SetScrollupEnable
       
  1035                      (TBool aEnable)  
       
  1036     {
       
  1037 		//Enabling/Disabling of scroll up buttons only for Non-Touch   
       
  1038     if(!AknLayoutUtils::PenEnabled())
       
  1039     {
       
  1040         CAknButton* scrollUp = iButtons[EScrollUp];
       
  1041         scrollUp->SetDimmed( !aEnable );
       
  1042         scrollUp->DrawNow();         
       
  1043     }
       
  1044     
       
  1045     }
       
  1046 
       
  1047 
       
  1048 // ---------------------------------------------------------
       
  1049 // CCalcFuncmapSubPane::SetScrolldownEnable
       
  1050 // Redraw scroll-down button on scrolling enable.
       
  1051 // (other items were commented in a header).
       
  1052 // ---------------------------------------------------------
       
  1053 //
       
  1054 void CCalcFuncmapSubPane::SetScrolldownEnable
       
  1055                      (TBool aEnable) 
       
  1056     {
       
  1057 	//Enabling/Disabling of scroll down buttons only for Non-Touch
       
  1058     if(!AknLayoutUtils::PenEnabled())
       
  1059     {       
       
  1060     CAknButton* scrollDown = iButtons[EScrollDown];
       
  1061     scrollDown->SetDimmed( !aEnable );
       
  1062     scrollDown->DrawNow();
       
  1063     }
       
  1064     }
       
  1065 
       
  1066 
       
  1067 // ---------------------------------------------------------
       
  1068 // CCalcFuncmapSubPane::SetNextCursorPosForUpArrow
       
  1069 // Set next cursor position whwn pressing uparrow key.
       
  1070 // (other items were commented in a header).
       
  1071 // ---------------------------------------------------------
       
  1072 //
       
  1073 void CCalcFuncmapSubPane::SetNextCursorPosForUpArrow(TInt aOldPos)
       
  1074 {
       
  1075     
       
  1076     TInt row(aOldPos % iButtonsInRow);
       
  1077     TInt column(aOldPos / iButtonsInRow);
       
  1078 
       
  1079     do
       
  1080     {   row--;
       
  1081 
       
  1082         if(row < 0)
       
  1083         {
       
  1084             column--;
       
  1085         
       
  1086             if(column < 0)
       
  1087             {
       
  1088                 column = iButtonsInColumn -1;
       
  1089             }
       
  1090             row = iButtonsInRow - 1;
       
  1091         }
       
  1092         iSelected = row + column * iButtonsInRow;
       
  1093     
       
  1094     }while( iButtons[iSelected]->IsDimmed() );
       
  1095 }
       
  1096 
       
  1097 // ---------------------------------------------------------
       
  1098 // CCalcFuncmapSubPane::SetNextCursorPosForDownArrow
       
  1099 // Set next cursor position whwn pressing downarrow key.
       
  1100 // (other items were commented in a header).
       
  1101 // ---------------------------------------------------------
       
  1102 //
       
  1103 void CCalcFuncmapSubPane::SetNextCursorPosForDownArrow(TInt aOldPos)
       
  1104 {
       
  1105     TInt row(aOldPos % iButtonsInRow);
       
  1106     TInt column(aOldPos / iButtonsInRow);
       
  1107 
       
  1108     do
       
  1109     {   row++;
       
  1110 
       
  1111         if(row == iButtonsInRow)  // KButtonsInRow is equal to "number of rows in column"
       
  1112         {
       
  1113             row = 0;
       
  1114 
       
  1115             //move focus from last item to first item, column should be added one
       
  1116             column++;     
       
  1117         
       
  1118             if( column == iButtonsInColumn )  
       
  1119             {
       
  1120                 column = 0;
       
  1121             }
       
  1122         }
       
  1123         iSelected = row + column * iButtonsInRow;
       
  1124     
       
  1125     }while( iButtons[iSelected]->IsDimmed() );
       
  1126 }
       
  1127 
       
  1128 
       
  1129 // ---------------------------------------------------------
       
  1130 // CCalcFuncmapSubPane::RedrawHighlight
       
  1131 // An old highlight rectangle is erased and 
       
  1132 // a new highlight rectangle is drawn.
       
  1133 // (other items were commented in a header).
       
  1134 // ---------------------------------------------------------
       
  1135 //
       
  1136 void CCalcFuncmapSubPane::RedrawHighlight
       
  1137       (TUint aOldId,            // The button chosen before
       
  1138        TUint aNewId) const      // The button chosen newly
       
  1139     {
       
  1140     // The State of each button is set.
       
  1141     CAknButton* button = iButtons[aOldId];
       
  1142     CAknButtonState* state = button->State(EnNormal);      	
       
  1143         
       
  1144     if(state->Flags() == EnPressed)
       
  1145         {
       
  1146         TKeyEvent aKeyEvent;
       
  1147         aKeyEvent.iScanCode = EStdKeyEnter;
       
  1148         TEventCode aType = EEventKeyUp;
       
  1149         //trigger offerkeyeventl to this button
       
  1150         TRAP_IGNORE(button->OfferKeyEventL(aKeyEvent,aType));
       
  1151 	    state->SetFlags(EnNormal);
       
  1152      	}
       
  1153     button->SetFocus( EFalse, EDrawNow );      
       
  1154     button = iButtons[aNewId];        
       
  1155     button->SetFocus( ETrue, EDrawNow );
       
  1156     }
       
  1157 
       
  1158 // ---------------------------------------------------------
       
  1159 // CCalcFuncmapSubPane::SetLayout
       
  1160 // Set functionmap button layout.
       
  1161 // (other items were commented in a header).
       
  1162 // ---------------------------------------------------------
       
  1163 //
       
  1164 
       
  1165 
       
  1166 void CCalcFuncmapSubPane::SetLayout()
       
  1167     {
       
  1168     TRect parentRect(Rect());    
       
  1169     
       
  1170 	 TInt t = 0;
       
  1171 	 if( AknLayoutUtils::PenEnabled()  )
       
  1172 	    {
       
  1173 	        for (TInt count(0); count < KButtonsInColumnTouch; count++)
       
  1174             {
       
  1175             for (TInt row(0); row < 5; row++)   
       
  1176       	        { 
       
  1177       	        
       
  1178       	         TAknWindowLineLayout area;
       
  1179                  TAknWindowLineLayout area1;
       
  1180 
       
  1181                  TAknWindowLineLayout areaG2;
       
  1182                  TAknWindowLineLayout areaGraphics;
       
  1183      	        
       
  1184      	            area= AknLayoutScalable_Apps::toolbar_button_pane_cp01(1).LayoutLine();
       
  1185                    areaG2= AknLayoutScalable_Apps::cell_calc_pane_g2(1).LayoutLine();
       
  1186     		         if (Layout_Meta_Data::IsLandscapeOrientation())
       
  1187     		            {
       
  1188     		                area1 = AknLayoutScalable_Apps::cell_calc_pane(count,row,enTouch_with_prt).LayoutLine();
       
  1189     		            }
       
  1190     		         else
       
  1191     		            {
       
  1192     		               area1 = AknLayoutScalable_Apps::cell_calc_pane(count,row,enTouch_enabled).LayoutLine();
       
  1193     		            }   
       
  1194 
       
  1195                     areaGraphics = area1;
       
  1196                     areaGraphics.iW = areaGraphics.iW - areaG2.il - areaG2.ir;
       
  1197                     areaGraphics.iH = areaG2.iH;
       
  1198     		    
       
  1199     		        area1.il = area1.il + area.il;
       
  1200     		        area1.ir = area1.ir - area.ir;
       
  1201     		        area1.it = area1.it + area.it;
       
  1202     		        area1.ib = area1.ib - area.ib;
       
  1203     		        area1.iW = area1.iW - area.il - area.ir;
       
  1204     		        area1.iH = area1.iH - area.it - area.ib;
       
  1205     		    
       
  1206                  
       
  1207                 //A change in values here
       
  1208                 if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1209                 {
       
  1210                 AknLayoutUtils::LayoutControl(
       
  1211                 iButtons[t], parentRect,/*AknLayoutScalable_Apps::cell_calc_pane(count,Row,enTouch_with_prt).LayoutLine()*/area1 );
       
  1212                 }
       
  1213                 else
       
  1214                 {
       
  1215                 AknLayoutUtils::LayoutControl(
       
  1216                 iButtons[t], parentRect,/*AknLayoutScalable_Apps::cell_calc_pane(count,Row,enTouch_enabled).LayoutLine()*/area1 );
       
  1217                 }
       
  1218 
       
  1219                 TSize iconSize( areaGraphics.iW, areaGraphics.iH );
       
  1220                 iButtons[t]->SetIconSize( iconSize );
       
  1221                 TRect rect = iButtons[t]->Rect();
       
  1222                 rect.iBr.iX += 5;
       
  1223                 rect.iBr.iY += 5; 
       
  1224                 rect.iTl.iX -= 5;
       
  1225                 rect.iTl.iY -= 5;
       
  1226 
       
  1227                 if ( FeatureManager::FeatureSupported( KFeatureIdRockerKey ) )
       
  1228                 {
       
  1229                 iButtons[t]->SetHighlightRect( rect );
       
  1230                 }
       
  1231                 t++;
       
  1232       	        }
       
  1233             }
       
  1234             
       
  1235        }
       
  1236             
       
  1237 	    
       
  1238 	    else
       
  1239 	        {
       
  1240              for (TInt count(0); count < KButtonsInColumn; count++)
       
  1241                 {
       
  1242                 for (TInt row(0); row < 5; row++)   
       
  1243            	        {   	        
       
  1244                	        AknLayoutUtils::LayoutControl(
       
  1245                         iButtons[t], parentRect, AknLayoutScalable_Apps::cell_calc_pane( count, row ).LayoutLine());
       
  1246                         iButtons[t]->SetHighlightRect( iButtons[t]->Rect() );
       
  1247                         t++;
       
  1248            	        }
       
  1249            	        
       
  1250                 }
       
  1251 	        }
       
  1252                 
       
  1253         
       
  1254     }
       
  1255 
       
  1256 
       
  1257 
       
  1258 
       
  1259 // ---------------------------------------------------------
       
  1260 // CCalcFuncmapSubPane::CountComponentControls
       
  1261 // The count of child control is returned.
       
  1262 // (other items were commented in a header).
       
  1263 // ---------------------------------------------------------
       
  1264 //
       
  1265 TInt CCalcFuncmapSubPane::CountComponentControls() const
       
  1266     {
       
  1267     return iCountOfButtons;
       
  1268     }
       
  1269 
       
  1270 // ---------------------------------------------------------
       
  1271 // CCalcFuncmapSubPane::ComponentControl
       
  1272 // Child control's pointer corresponding to the specified index is returned.
       
  1273 // (other items were commented in a header).
       
  1274 // ---------------------------------------------------------
       
  1275 //
       
  1276 CCoeControl* CCalcFuncmapSubPane::ComponentControl
       
  1277               (TInt aIndex) const 
       
  1278     {
       
  1279     return iButtons[aIndex];
       
  1280     }
       
  1281 
       
  1282 // ---------------------------------------------------------
       
  1283 // CCalcFuncmapSubPane::GetButtonBitmapControl
       
  1284 // This function is called when the size changes.
       
  1285 // (other items were commented in a header).
       
  1286 // ---------------------------------------------------------
       
  1287 //
       
  1288 /*CCalcCommandButton*/CAknButton* CCalcFuncmapSubPane::GetButtonBitmapControl
       
  1289                                     (TInt aIndex)
       
  1290 	{
       
  1291 		return iButtons[aIndex];
       
  1292 	}
       
  1293 
       
  1294 // ---------------------------------------------------------
       
  1295 // CCalcFuncmapSubPane::SizeChanged
       
  1296 // This function is called when the size changes.
       
  1297 // (other items were commented in a header).
       
  1298 // ---------------------------------------------------------
       
  1299 //
       
  1300 void CCalcFuncmapSubPane::SizeChanged()
       
  1301     {
       
  1302     SetLayout();
       
  1303     }
       
  1304 
       
  1305 
       
  1306 // ---------------------------------------------------------
       
  1307 // CCalcFuncmapSubPane::SetSqrtEnable
       
  1308 // Redraw square root button, either normal or dimmed.
       
  1309 // (other items were commented in a header).
       
  1310 // ---------------------------------------------------------
       
  1311 //
       
  1312 void CCalcFuncmapSubPane::SetSqrtEnable(TBool aEnable)
       
  1313 {
       
  1314 	//Get the sqrt button
       
  1315 	CAknButton* button = NULL;
       
  1316 	 if( !AknLayoutUtils::PenEnabled()  )
       
  1317 	    {
       
  1318 	     button = iButtons[ESqrtButton];     
       
  1319 	    }
       
  1320 	  else
       
  1321 	    {
       
  1322 	     button = iButtons[ECmdTSqrt];    
       
  1323 	    }  
       
  1324 	if( button )
       
  1325 	    {
       
  1326          button->SetDimmed(!aEnable);   
       
  1327          button->DrawNow();
       
  1328         }
       
  1329     iIsSqrtDimmed = aEnable;
       
  1330 	}
       
  1331 
       
  1332 
       
  1333 // ---------------------------------------------------------
       
  1334 // CCalcFuncmapSubPane::SetPercentEnable
       
  1335 // Redraw percent button, either normal or dimmed.
       
  1336 // (other items were commented in a header).
       
  1337 // ---------------------------------------------------------
       
  1338 //
       
  1339 void CCalcFuncmapSubPane::SetPercentEnable(TBool aEnable)
       
  1340 {
       
  1341 	//Get the percent button
       
  1342 	CAknButton* button = NULL;
       
  1343 	 if( !AknLayoutUtils::PenEnabled()  )
       
  1344 	    {
       
  1345 	     button = iButtons[EPercentButton];     
       
  1346 	    }
       
  1347 	  else
       
  1348 	    {
       
  1349 	     button = iButtons[ECmdTPercent];    
       
  1350 	    }  
       
  1351     if( button )
       
  1352 	    {
       
  1353          button->SetDimmed(!aEnable);   
       
  1354          button->DrawNow();
       
  1355 	   }
       
  1356 	iIsPercentDimmed = aEnable;
       
  1357 }
       
  1358 
       
  1359 // ---------------------------------------------------------
       
  1360 // CCalcFuncmapSubPane::MapNumericChar
       
  1361 // Redraw percent button, either normal or dimmed.
       
  1362 // (other items were commented in a header).
       
  1363 // ---------------------------------------------------------
       
  1364 //		
       
  1365 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  1366 TBool CCalcFuncmapSubPane::MapNumericCharL( TKeyEvent aKeyEvent )
       
  1367     {
       
  1368     TBuf<KMaxNumCharsPerCase> keys;
       
  1369 
       
  1370     TPtiKey aKey = ( TPtiKey )aKeyEvent.iScanCode;
       
  1371 
       
  1372 
       
  1373     if( !keys.Length() )
       
  1374             {
       
  1375             keys.Append( aKeyEvent.iCode );
       
  1376             }
       
  1377 
       
  1378     if ( keys.Length() > 0 )
       
  1379         {
       
  1380         TUint16 firstChar = keys[0];
       
  1381         switch ( firstChar )
       
  1382             {
       
  1383             case KPtiPinyinMarker:
       
  1384             case KPtiStrokeMarker:
       
  1385             case KPtiZhuyinMarker:
       
  1386             case KPtiCangjieMarker:
       
  1387             case KPtiGetAllMarker:
       
  1388                  if ( keys.Length() > 1 )
       
  1389                      {
       
  1390                      firstChar = keys[1];
       
  1391                      }
       
  1392             default:
       
  1393                 break;
       
  1394             }
       
  1395 
       
  1396         TInt loc1 = KAllowedOperatorPlus().Locate( firstChar );
       
  1397         if ( loc1 != KErrNotFound )
       
  1398             {
       
  1399             iContainer->View()->HandleCommandL( KButtonsIdTbl[0] );
       
  1400             return ETrue;
       
  1401             }
       
  1402         TInt loc2 = KAllowedOperatorMinus().Locate( firstChar );
       
  1403         if ( loc2 != KErrNotFound )
       
  1404             {
       
  1405             iContainer->View()->HandleCommandL( KButtonsIdTbl[1] );
       
  1406             return ETrue;
       
  1407             }
       
  1408         TInt loc3 = KAllowedOperatorStar().Locate( firstChar );
       
  1409         if ( loc3 != KErrNotFound )
       
  1410             {
       
  1411             iContainer->View()->HandleCommandL( KButtonsIdTbl[2] );
       
  1412             return ETrue;
       
  1413             }
       
  1414         TInt loc4 = KAllowedOperatorDivide().Locate( firstChar );
       
  1415         if ( loc4 != KErrNotFound )
       
  1416             {
       
  1417             iContainer->View()->HandleCommandL( KButtonsIdTbl[3] );
       
  1418             return ETrue;
       
  1419             }
       
  1420         TInt loc5 = KAllowedOperatorEquals().Locate( firstChar );
       
  1421         if ( loc5 != KErrNotFound )
       
  1422             {
       
  1423             iContainer->View()->HandleCommandL( KButtonsIdTbl[5] );
       
  1424             return ETrue;
       
  1425             }
       
  1426         TInt loc6 = KAllowedOperatorPercent().Locate( firstChar );
       
  1427         if ( loc6 != KErrNotFound &&  GetPercentButtonState() )
       
  1428             {
       
  1429             iContainer->View()->HandleCommandL( KButtonsIdTbl[7] );
       
  1430             return ETrue;
       
  1431             }
       
  1432 
       
  1433               }
       
  1434         
       
  1435     return EFalse;
       
  1436     }
       
  1437 
       
  1438 #else
       
  1439 TBool CCalcFuncmapSubPane::MapNumericCharL( TPtiKey aKey, TPtiTextCase aCase )	
       
  1440     {
       
  1441     TBuf<KMaxNumCharsPerCase> keys;
       
  1442 
       
  1443     iQwertyKeyMappings->GetDataForKey( aKey, keys, aCase );				
       
  1444 
       
  1445     if ( keys.Length() > 0 )
       
  1446         {
       
  1447         TUint16 firstChar = keys[0];
       
  1448         switch ( firstChar )
       
  1449             {
       
  1450             case KPtiPinyinMarker:
       
  1451             case KPtiStrokeMarker:
       
  1452             case KPtiZhuyinMarker:
       
  1453             case KPtiCangjieMarker:
       
  1454             case KPtiGetAllMarker:
       
  1455                 if ( keys.Length() > 1 )
       
  1456                     {
       
  1457                     firstChar = keys[1];
       
  1458                     }
       
  1459             default:
       
  1460                 break;
       
  1461             }
       
  1462 
       
  1463         TInt loc1 = KAllowedOperatorPlus().Locate( firstChar );
       
  1464         if ( loc1 != KErrNotFound )
       
  1465             {
       
  1466             iContainer->View()->HandleCommandL( KButtonsIdTbl[0] );
       
  1467             return ETrue;
       
  1468             }
       
  1469         TInt loc2 = KAllowedOperatorMinus().Locate( firstChar );
       
  1470         if ( loc2 != KErrNotFound )
       
  1471             {
       
  1472             iContainer->View()->HandleCommandL( KButtonsIdTbl[1] );
       
  1473             return ETrue;
       
  1474             }
       
  1475         TInt loc3 = KAllowedOperatorStar().Locate( firstChar );
       
  1476         if ( loc3 != KErrNotFound )
       
  1477             {
       
  1478             iContainer->View()->HandleCommandL( KButtonsIdTbl[2] );
       
  1479             return ETrue;
       
  1480             }
       
  1481         TInt loc4 = KAllowedOperatorDivide().Locate( firstChar );
       
  1482         if ( loc4 != KErrNotFound )
       
  1483             {
       
  1484             iContainer->View()->HandleCommandL( KButtonsIdTbl[3] );
       
  1485             return ETrue;
       
  1486             }
       
  1487         TInt loc5 = KAllowedOperatorEquals().Locate( firstChar );
       
  1488         if ( loc5 != KErrNotFound )
       
  1489             {
       
  1490             iContainer->View()->HandleCommandL( KButtonsIdTbl[5] );
       
  1491             return ETrue;
       
  1492             }
       
  1493         TInt loc6 = KAllowedOperatorPercent().Locate( firstChar );
       
  1494         if ( loc6 != KErrNotFound &&  GetPercentButtonState() )
       
  1495             {
       
  1496             iContainer->View()->HandleCommandL( KButtonsIdTbl[7] );
       
  1497             return ETrue;
       
  1498             }
       
  1499 
       
  1500               }
       
  1501         
       
  1502     return EFalse;
       
  1503     }
       
  1504 #endif       
       
  1505 	
       
  1506 // ---------------------------------------------------------
       
  1507 // CCalcFuncmapSubPane::MapNumericChar
       
  1508 // Redraw percent button, either normal or dimmed.
       
  1509 // (other items were commented in a header).
       
  1510 // ---------------------------------------------------------
       
  1511 //		
       
  1512 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  1513 TBool CCalcFuncmapSubPane::MapNumerics( TKeyEvent aKeyEvent )
       
  1514     {
       
  1515     
       
  1516     TBuf<KMaxNumCharsPerCase> keys;
       
  1517 
       
  1518     TPtiKey aKey = ( TPtiKey )aKeyEvent.iScanCode;
       
  1519 
       
  1520     if ( !keys.Length() )
       
  1521             {
       
  1522             keys.Append( aKeyEvent.iCode );
       
  1523             }
       
  1524 
       
  1525     if ( keys.Length() > 0 )
       
  1526         {
       
  1527         TUint16 firstChar = keys[0];
       
  1528         switch ( firstChar )
       
  1529             {
       
  1530             case KPtiPinyinMarker:
       
  1531             case KPtiStrokeMarker:
       
  1532             case KPtiZhuyinMarker:
       
  1533             case KPtiCangjieMarker:
       
  1534             case KPtiGetAllMarker:
       
  1535                  if ( keys.Length() > 1 )
       
  1536                      {
       
  1537                      firstChar = keys[1];
       
  1538                      }
       
  1539             default:
       
  1540                 break;
       
  1541             }
       
  1542         TInt loc = KAllowedNumericChars().Locate( firstChar );
       
  1543         if ( loc != KErrNotFound )
       
  1544             {
       
  1545             return ETrue;
       
  1546             }
       
  1547         }
       
  1548     return EFalse;
       
  1549     }
       
  1550 
       
  1551 #else
       
  1552 TBool CCalcFuncmapSubPane::MapNumerics( TPtiKey aKey, TPtiTextCase aCase )	
       
  1553     {
       
  1554 
       
  1555     TBuf<KMaxNumCharsPerCase> keys;
       
  1556 
       
  1557     iQwertyKeyMappings->GetDataForKey( aKey, keys, aCase );				
       
  1558 
       
  1559     if ( keys.Length() > 0 )
       
  1560         {
       
  1561         TUint16 firstChar = keys[0];
       
  1562         switch ( firstChar )
       
  1563             {
       
  1564             case KPtiPinyinMarker:
       
  1565             case KPtiStrokeMarker:
       
  1566             case KPtiZhuyinMarker:
       
  1567             case KPtiCangjieMarker:
       
  1568             case KPtiGetAllMarker:
       
  1569                  if ( keys.Length() > 1 )
       
  1570                      {
       
  1571                      firstChar = keys[1];
       
  1572                      }
       
  1573             default:
       
  1574                 break;
       
  1575             }
       
  1576         TInt loc = KAllowedNumericChars().Locate( firstChar );
       
  1577         if ( loc != KErrNotFound )
       
  1578             {
       
  1579             return ETrue;
       
  1580             }
       
  1581         }
       
  1582     return EFalse;
       
  1583     }
       
  1584 #endif
       
  1585 		
       
  1586 // ---------------------------------------------------------
       
  1587 // CCalcFuncmapSubPane::HandlePointerEventL
       
  1588 // Handles apen input in Function Pane. .
       
  1589 // (other items were commented in a header).
       
  1590 // ---------------------------------------------------------
       
  1591 //
       
  1592 void CCalcFuncmapSubPane::HandlePointerEventL
       
  1593                 ( const TPointerEvent& aPointerEvent )           
       
  1594     {
       
  1595     if ( !AknLayoutUtils::PenEnabled() )
       
  1596         {
       
  1597         return;
       
  1598         }
       
  1599     TInt oldSelect( iSelected );
       
  1600     TInt buttonValue = CalculatingCorrectButton( aPointerEvent );
       
  1601     if ( !iButtons[buttonValue]->IsDimmed() )
       
  1602         {
       
  1603         iSelected = buttonValue;
       
  1604         if ( iButtons[buttonValue]->Rect().Contains( aPointerEvent.iPosition ) )
       
  1605             {
       
  1606             RedrawHighlight( oldSelect, iSelected );
       
  1607             }
       
  1608         }
       
  1609     CCoeControl::HandlePointerEventL( aPointerEvent );
       
  1610     }
       
  1611     
       
  1612 // ---------------------------------------------------------
       
  1613 // CCalcFuncmapSubPane::FunctionPaneRect
       
  1614 // This function gives the layout of Function Pnae.
       
  1615 // (other items were commented in a header).
       
  1616 // ---------------------------------------------------------
       
  1617 //
       
  1618 
       
  1619 TRect CCalcFuncmapSubPane::FunctionPaneRect()
       
  1620    {
       
  1621    TRect parentRect(Rect()); 
       
  1622    return 	parentRect;
       
  1623    }
       
  1624    
       
  1625 // ---------------------------------------------------------
       
  1626 // CCalcFuncmapSubPane::CalculatingCorrectButton
       
  1627 // Handled when there is Pen Input.
       
  1628 // (other items were commented in a header).
       
  1629 // ---------------------------------------------------------
       
  1630 //
       
  1631 
       
  1632 TInt CCalcFuncmapSubPane::CalculatingCorrectButton
       
  1633 					(const TPointerEvent& aPointerEvent)
       
  1634    {
       
  1635     TInt selected = iSelected;
       
  1636     
       
  1637     //Function that calculates the correct button where the pointer event had occurred
       
  1638     for(TInt i = 0; i<iCountOfButtons; i++)
       
  1639     {
       
  1640    		if(iButtons[i]->Rect().Contains(aPointerEvent.iPosition))
       
  1641    		{
       
  1642    			selected = i;
       
  1643    		}
       
  1644     }
       
  1645     return selected;
       
  1646    }
       
  1647 
       
  1648 // ---------------------------------------------------------
       
  1649 // CCalcFuncmapSubPane::HandleMiddleSoftKeyOREKeyOK
       
  1650 // Handled when MSK or EKeyOk is selected.
       
  1651 // ---------------------------------------------------------
       
  1652 //
       
  1653 
       
  1654 void CCalcFuncmapSubPane::HandleMiddleSoftKeyOREKeyOKL()
       
  1655    {
       
  1656      	//get the selected button id
       
  1657 	    CAknButton* button = iButtons[iSelected];
       
  1658 	    //put the button in the pressed state
       
  1659         CAknButtonState* state = button->State(EnNormal);
       
  1660     	//Put the button in pressed state
       
  1661         
       
  1662         TKeyEvent aKeyEvent;
       
  1663         aKeyEvent.iScanCode = EStdKeyEnter;
       
  1664         TEventCode aType = EEventKeyDown;
       
  1665         button->OfferKeyEventL(aKeyEvent,aType);
       
  1666 	    //put to pressed state
       
  1667 	    state->SetFlags(EnPressed);
       
  1668         button->DrawNow();
       
  1669         
       
  1670 	    if(!iIsOfferKeyEvent)
       
  1671         {
       
  1672             
       
  1673             NotifyReleaseKeyL();
       
  1674         }
       
  1675    }
       
  1676    
       
  1677 // ---------------------------------------------------------
       
  1678 // CCalcFuncmapSubPane::GetChangeSignButtonState
       
  1679 // Returns the state of change sign button
       
  1680 // ---------------------------------------------------------
       
  1681 //
       
  1682 TBool CCalcFuncmapSubPane::GetChangeSignButtonState()
       
  1683 {
       
  1684     return(iIsChangeSignDimmed);
       
  1685 }
       
  1686 
       
  1687 // ---------------------------------------------------------
       
  1688 // CCalcFuncmapSubPane::GetClearButtonState
       
  1689 // Returns the state of Clear button
       
  1690 // ---------------------------------------------------------
       
  1691 //
       
  1692 TBool CCalcFuncmapSubPane::GetClearButtonState()
       
  1693     {
       
  1694     return( iIsClearKeyEnabled );
       
  1695     } 
       
  1696 
       
  1697 // ---------------------------------------------------------
       
  1698 // CCalcFuncmapSubPane::GetSqrtButtonState
       
  1699 // Returns the state of square root button
       
  1700 // ---------------------------------------------------------
       
  1701 //
       
  1702 TBool CCalcFuncmapSubPane::GetSqrtButtonState()
       
  1703 {
       
  1704     return(iIsSqrtDimmed);
       
  1705 }
       
  1706 
       
  1707 // ---------------------------------------------------------
       
  1708 // CCalcFuncmapSubPane::GetPercentButtonState
       
  1709 // returns the state of percent button
       
  1710 // ---------------------------------------------------------
       
  1711 //
       
  1712 TBool CCalcFuncmapSubPane::GetPercentButtonState()
       
  1713 {
       
  1714     return(iIsPercentDimmed);
       
  1715 }
       
  1716 
       
  1717 // ---------------------------------------------------------
       
  1718 // CCalcFuncmapSubPane::GetSelectedButtonId
       
  1719 // returns the id of current button
       
  1720 // ---------------------------------------------------------
       
  1721 //
       
  1722 TInt CCalcFuncmapSubPane::GetSelectedButtonId()
       
  1723     {
       
  1724     return iSelected;
       
  1725     }
       
  1726    
       
  1727 // ---------------------------------------------------------
       
  1728 // CCalcFuncmapSubPane::SetHighlightButton
       
  1729 // set highlight button
       
  1730 // ---------------------------------------------------------
       
  1731 //
       
  1732 void CCalcFuncmapSubPane::SetHighlightButton( TUint aOldId, TUint aNewId )
       
  1733     {
       
  1734     iSelected = aNewId;
       
  1735     RedrawHighlight( aOldId, aNewId );
       
  1736     }
       
  1737 
       
  1738 // ---------------------------------------------------------
       
  1739 // CCalcFuncmapSubPane::IsClearKeyLongPressed
       
  1740 // Find Clear is long Pressed.
       
  1741 // ---------------------------------------------------------
       
  1742 //
       
  1743 TBool CCalcFuncmapSubPane::IsKeyLongPressed()
       
  1744     {
       
  1745     return iIsKeyLongPress;
       
  1746     }
       
  1747 
       
  1748 // ---------------------------------------------------------
       
  1749 // CCalcFuncmapSubPane::MapDataForChrShiftKey
       
  1750 // Redraw percent button, either normal or dimmed.
       
  1751 // ---------------------------------------------------------
       
  1752 //
       
  1753 void CCalcFuncmapSubPane::MapDataForChrShiftKey( TDes& aOperators, TInt& aFirstOperator, TInt& aSecondOperator)
       
  1754 	{ 
       
  1755 	if( aOperators.Length() > 0 )
       
  1756 		{
       
  1757 		TUint16 firstChar = aOperators[0];
       
  1758 		TUint16 secondChar = firstChar;
       
  1759 		
       
  1760 		if ( aOperators.Length() > 1 )
       
  1761 			{
       
  1762 			secondChar = aOperators[1];
       
  1763 			}
       
  1764 		
       
  1765         switch ( firstChar )
       
  1766             {
       
  1767             case KPtiPinyinMarker:
       
  1768             case KPtiStrokeMarker:
       
  1769             case KPtiZhuyinMarker:
       
  1770             case KPtiCangjieMarker:
       
  1771             case KPtiGetAllMarker:
       
  1772                 if ( aOperators.Length() > 2 )
       
  1773                     {
       
  1774                     firstChar = aOperators[1];
       
  1775                     secondChar = aOperators[2];
       
  1776                     }
       
  1777                 else
       
  1778                 	{
       
  1779                 	firstChar = aOperators[1];
       
  1780                 	secondChar = firstChar;
       
  1781                 	}
       
  1782                 break;
       
  1783             default:
       
  1784                 break;
       
  1785 		
       
  1786 		}
       
  1787         
       
  1788        MapOperators( firstChar, aFirstOperator );
       
  1789 
       
  1790        MapOperators( secondChar, aSecondOperator );
       
  1791        
       
  1792        }
       
  1793 	}
       
  1794 
       
  1795 // ---------------------------------------------------------
       
  1796 // CCalcFuncmapSubPane::MapOperators
       
  1797 // Redraw percent button, either normal or dimmed.
       
  1798 // ---------------------------------------------------------
       
  1799 //
       
  1800 TBool CCalcFuncmapSubPane::MapOperators( TUint16 aOperator, TInt& aResult)
       
  1801 	{
       
  1802     TInt loc1 = KAllowedOperatorPlus().Locate( aOperator );
       
  1803     if ( loc1 != KErrNotFound )
       
  1804         {
       
  1805         if ( AknLayoutUtils::PenEnabled() )
       
  1806         	{
       
  1807             aResult = ECmdTAdd;
       
  1808         	}
       
  1809         else
       
  1810         	{
       
  1811         	aResult = EPlusButton;
       
  1812         	}
       
  1813         return ETrue;
       
  1814         }
       
  1815     TInt loc2 = KAllowedOperatorMinus().Locate( aOperator );
       
  1816     if ( loc2 != KErrNotFound )
       
  1817         {
       
  1818         if ( AknLayoutUtils::PenEnabled() )
       
  1819         	{
       
  1820             aResult = ECmdTSubtract;
       
  1821         	}
       
  1822         else
       
  1823         	{
       
  1824         	aResult = EMinusButton;
       
  1825         	}
       
  1826         return ETrue;
       
  1827         }
       
  1828     TInt loc3 = KAllowedOperatorStar().Locate( aOperator );
       
  1829     if ( loc3 != KErrNotFound )
       
  1830         {
       
  1831         if ( AknLayoutUtils::PenEnabled() )
       
  1832         	{
       
  1833             aResult = ECmdTMultiply;
       
  1834         	}
       
  1835         else
       
  1836         	{
       
  1837         	aResult = EMultiplyButton;
       
  1838         	}
       
  1839         return ETrue;
       
  1840         }
       
  1841     TInt loc4 = KAllowedOperatorDivide().Locate( aOperator );
       
  1842     if ( loc4 != KErrNotFound )
       
  1843         {
       
  1844         if ( AknLayoutUtils::PenEnabled() )
       
  1845         	{
       
  1846             aResult = ECmdTDivide;
       
  1847         	}
       
  1848         else
       
  1849         	{
       
  1850         	aResult = EDivideButton;
       
  1851         	}
       
  1852         return ETrue;
       
  1853         }
       
  1854     TInt loc5 = KAllowedOperatorEquals().Locate( aOperator );
       
  1855     if ( loc5 != KErrNotFound )
       
  1856         {
       
  1857         if ( AknLayoutUtils::PenEnabled() )
       
  1858         	{
       
  1859             aResult = ECmdTResult;
       
  1860         	}
       
  1861         else
       
  1862         	{
       
  1863         	aResult = EEqualButton;
       
  1864         	}
       
  1865         return ETrue;
       
  1866         }
       
  1867     TInt loc6 = KAllowedOperatorPercent().Locate( aOperator );
       
  1868     if ( loc6 != KErrNotFound )
       
  1869         {
       
  1870         if ( AknLayoutUtils::PenEnabled() )
       
  1871         	{
       
  1872             aResult = ECmdTPercent;
       
  1873         	}
       
  1874         else
       
  1875         	{ 
       
  1876         	aResult = EPercentButton;
       
  1877         	}
       
  1878         return ETrue;
       
  1879         }
       
  1880     TInt loc7 = KAllowedOperatorDecimal().Locate( aOperator );
       
  1881     if ( loc7 != KErrNotFound )
       
  1882         {
       
  1883         aResult = ECmdTSeparator;
       
  1884         return ETrue;
       
  1885         }
       
  1886     return EFalse;
       
  1887 	}
       
  1888 
       
  1889 // ---------------------------------------------------------
       
  1890 // CCalcFuncmapSubPane::GetKeyboardType
       
  1891 // Returns the type of keyboard
       
  1892 // ---------------------------------------------------------
       
  1893 //
       
  1894 TBool CCalcFuncmapSubPane::GetKeyboardType()
       
  1895     {
       
  1896     return iKeyboardType;
       
  1897     }
       
  1898 
       
  1899 // End of file