--- a/textinput/peninputfingerhwrar/src/peninputfingerhwrarsymboltable.cpp Thu Jul 15 19:01:13 2010 +0300
+++ b/textinput/peninputfingerhwrar/src/peninputfingerhwrarsymboltable.cpp Thu Aug 19 10:15:25 2010 +0300
@@ -41,7 +41,7 @@
#include "peninputfingerhwrarstoreconstants.h"
#include "peninputfingerhwrarmultipagevkb.h"
#include "peninputfingerhwrarsymboltable.h"
-
+#include "peninputfingerhwarvkbutility.h"
//CONST DEFINATION
const TInt KSymbolButtonInnerPadding = 6;
@@ -216,14 +216,16 @@
// ---------------------------------------------------------------------------
//
void CPeninputArabicFingerHwrSymbolTable::SizeChanged(
- const TRect aVirtualKeypadRect, const RArray<TRect> aBtnRects,
+ const TRect aVirtualKeypadRect, const RArray<TRect> & aBtnRects,
const TInt aKeypadRow, const TInt aKeypadCol, TBool aIsLandscape)
{
+ ASSERT(aBtnRects.Count() > 0);
+
iIsLandscape = aIsLandscape;
// relayout the button
- TRect pageBtnRect(aBtnRects[0]);
-
+ TRect pageBtnRect = aBtnRects[0];
+
if(aIsLandscape)
{
i2Page1Btn->Hide(EFalse);
@@ -253,7 +255,7 @@
iMutiPageKeypad->UpdatePaging(aKeypadRow,aKeypadCol);
}
-
+
// ---------------------------------------------------------------------------
// create symbol table keypad.
// ---------------------------------------------------------------------------
@@ -330,11 +332,6 @@
aButton->SizeChanged( aRect, rcInner, aReloadImages );
}
-void CPeninputArabicFingerHwrSymbolTable::OnActivate()
- {
- CControlGroup::OnActivate();
- }
-
// ---------------------------------------------------------------------------
// Read control's background info.
// ---------------------------------------------------------------------------
@@ -422,53 +419,7 @@
//
void CPeninputArabicFingerHwrSymbolTable::LoadVkbKeyImageL(TInt aResId, const TSize& aKeySize)
{
- TResourceReader reader;
- CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );
-
- TPtrC bmpFileName = reader.ReadTPtrC();
- TInt32 imgMajorSkinId = reader.ReadInt32();
- TAknsItemID id;
-
- TSize keySize = aKeySize;
-
- for ( TInt index = 0; index <= EKeyBmpLastType ; index += 2 )
- {
- // Get the image ids and mask ids from resource
- TInt bmpId = reader.ReadInt16();
- TInt bmpMskId = reader.ReadInt16();
-
- // read skin item id
- const TInt skinitemid = reader.ReadInt16();
- id.Set( TInt( imgMajorSkinId ), skinitemid );
-
- if ( bmpId != KInvalidImg )
- {
- CFbsBitmap* bmp = NULL;
- CFbsBitmap* maskbmp = NULL;
-
- if ( bmpMskId != KInvalidImg )
- {
- AknsUtils::CreateIconL( AknsUtils::SkinInstance(),
- id, bmp, maskbmp, bmpFileName, bmpId, bmpMskId );
-
- // set maskbmp and size
- AknIconUtils::SetSize( maskbmp, keySize, EAspectRatioNotPreserved );
- iMutiPageKeypad->SetNonIrregularKeyBitmapL(
- TVirtualKeyBmpType( EKeyBmpNormal + index + 1 ), maskbmp );
- }
- else
- {
- AknsUtils::CreateIconL( AknsUtils::SkinInstance(), id,
- bmp, bmpFileName, bmpId );
- }
- // set bmp and size
- AknIconUtils::SetSize( bmp, keySize, EAspectRatioNotPreserved );
- iMutiPageKeypad->SetNonIrregularKeyBitmapL(
- TVirtualKeyBmpType( EKeyBmpNormal + index ), bmp );
- }
- }
- // Pop and destroy reader
- CleanupStack::PopAndDestroy( 1 );
+ PeninputFingerHwrArVkbUtility::LoadVkbKeyImageL(*iMutiPageKeypad,aResId,aKeySize);
}
// ---------------------------------------------------------------------------
@@ -477,118 +428,10 @@
//
void CPeninputArabicFingerHwrSymbolTable::LoadVirtualKeypadKeyL(const TInt aResId, const RArray<TRect>& aCellRects)
{
- iMutiPageKeypad->SetResourceId(aResId);
-
- TResourceReader reader;
- CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );
-
- // construct keys
- TInt resKeyCount = reader.ReadInt16();
- TInt existsKeyCount = iMutiPageKeypad->KeyArray().Count();
- TInt rectCount = aCellRects.Count();
-
- for ( TInt i = 0; i < resKeyCount; i++ )
- {
- if ( i < existsKeyCount )
- {
- CVirtualKey* vk = iMutiPageKeypad->KeyArray()[i];
- UpdateVkbKeyL( vk, reader, aCellRects[i%rectCount] );
- }
- else
- {
- CVirtualKey* vk = CreateVkbKeyL( reader, aCellRects[i%rectCount] );
- CleanupStack::PushL( vk );
- iMutiPageKeypad->AddKeyL( vk );
-
- CleanupStack::Pop( vk );
- }
- }
-
- CleanupStack::PopAndDestroy( 1 ); // reader
-
- iMutiPageKeypad->Draw();
- iMutiPageKeypad->UpdateArea( iMutiPageKeypad->Rect() );
+ PeninputFingerHwrArVkbUtility::LoadVirtualKeypadKeyL(*iMutiPageKeypad,aResId,aCellRects);
}
// ---------------------------------------------------------------------------
-// create virtual key.
-// ---------------------------------------------------------------------------
-//
-CVirtualKey* CPeninputArabicFingerHwrSymbolTable::CreateVkbKeyL( TResourceReader& aReader,
- const TRect aKeyRect )
- {
- CHBufCArray* keytexts = CHBufCArray::NewL();
- CleanupStack::PushL( keytexts );
-
- for ( TInt i = 0; i <= EPosLast; i++ )
- {
- HBufC* unicode = aReader.ReadHBufCL();
- keytexts->Array().AppendL( unicode );
- }
-
- TInt keyscancode = aReader.ReadInt16();
-
- HBufC* text = keytexts->Array()[0];
-
- CVirtualKey* vk = NULL;
- if ( text )
- {
- vk = CVirtualKey::NewL( *text, keyscancode, aKeyRect, aKeyRect, 0 );
- }
- else
- {
- vk = CVirtualKey::NewL( KNullDesC, keyscancode, aKeyRect, aKeyRect, 0 );
- }
-
- CleanupStack::PopAndDestroy( keytexts ); //keytexts
-
-
- TRect innerrect = aKeyRect;
- innerrect.Shrink( TSize(2, 2) );
- vk->SetInnerRect( innerrect );
-
- return vk;
- }
-
-// ---------------------------------------------------------------------------
-// update virtual key info.
-// ---------------------------------------------------------------------------
-//
-void CPeninputArabicFingerHwrSymbolTable::UpdateVkbKeyL( CVirtualKey* aVirtualKey,
- TResourceReader& aReader, const TRect aKeyRect )
- {
- CHBufCArray* keytexts = CHBufCArray::NewL();
- CleanupStack::PushL( keytexts );
-
- for ( TInt i = 0; i <= EPosLast; i++ )
- {
- HBufC* unicode = aReader.ReadHBufCL();
- keytexts->Array().AppendL( unicode );
- }
-
- TInt keyscancode = aReader.ReadInt16();
-
- HBufC* text = keytexts->Array()[0];
- if ( text )
- {
- aVirtualKey->SetKeyData( *text );
- }
- else
- {
- aVirtualKey->SetKeyData( KNullDesC );
- }
-
- aVirtualKey->SetKeyScancode( keyscancode );
-
- CleanupStack::PopAndDestroy( keytexts ); //keytexts
-
- aVirtualKey->SetRect(aKeyRect);
- TRect innerrect = aKeyRect;
- innerrect.Shrink( TSize(2,2) );
- aVirtualKey->SetInnerRect( innerrect );
- }
-
-// ---------------------------------------------------------------------------
// Navigate the symbol page
// ---------------------------------------------------------------------------
//
@@ -691,17 +534,14 @@
{
if(AbleToDraw())
{
- //Draw button area background.
-// DrawOpaqueMaskBackground( Rect() );
-// DrawOpaqueMaskBackground();
DrawOpaqueMaskBackground(iMutiPageKeypad->Rect());
if( BackgroundBmp() && BackgroundBmp()->SizeInPixels() != Rect().Size() )
{
AknIconUtils::SetSize(BackgroundBmp(), Rect().Size(), EAspectRatioNotPreserved);
}
- // draw background
-// DrawBackground();
+ // draw background
DrawBackground(iMutiPageKeypad->Rect());
+
// draw group
CControlGroup::Draw();