1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
41 #include "peninputfingerhwrarcontrolid.h" |
41 #include "peninputfingerhwrarcontrolid.h" |
42 #include "peninputfingerhwrarstoreconstants.h" |
42 #include "peninputfingerhwrarstoreconstants.h" |
43 #include "peninputfingerhwrarmultipagevkb.h" |
43 #include "peninputfingerhwrarmultipagevkb.h" |
44 #include "peninputfingerhwrarlayout.h" |
44 #include "peninputfingerhwrarlayout.h" |
45 #include "peninputfingerhwrardatastore.h" |
45 #include "peninputfingerhwrardatastore.h" |
46 #include "peninputlayouthwrwnd.h" |
|
47 #include "peninputfingerhwrarsymboltable.h" |
46 #include "peninputfingerhwrarsymboltable.h" |
48 #include "peninputfingerhwrarindicator.h" |
47 #include "peninputfingerhwrarindicator.h" |
|
48 #include "peninputfingerhwrarwritingwnd.h" |
49 |
49 |
50 const TUint32 KDefaultTextColor = 0x000000; |
50 const TUint32 KDefaultTextColor = 0x000000; |
51 const TUint KDefaultFrameColor = 0x000000; |
51 const TUint KDefaultFrameColor = 0x000000; |
52 const TUint32 KDefaultWriteBoxBgColor = 0xdddddd; |
52 const TUint32 KDefaultWriteBoxBgColor = 0xdddddd; |
53 const TUint32 KDefaultWriteBoxFrameColor = 0x000000; |
53 const TUint32 KDefaultWriteBoxFrameColor = 0x000000; |
82 // --------------------------------------------------------------------------- |
82 // --------------------------------------------------------------------------- |
83 // c++ destructor |
83 // c++ destructor |
84 // --------------------------------------------------------------------------- |
84 // --------------------------------------------------------------------------- |
85 // |
85 // |
86 CPeninputFingerHwrArWnd::~CPeninputFingerHwrArWnd() |
86 CPeninputFingerHwrArWnd::~CPeninputFingerHwrArWnd() |
87 { |
87 { |
|
88 #ifdef RD_TACTILE_FEEDBACK |
|
89 UiLayout()->DeRegisterFeedbackArea(reinterpret_cast<TInt>(iWritingBox), |
|
90 iWritingBox->Rect()); |
|
91 #endif |
88 delete iLafManager; |
92 delete iLafManager; |
89 } |
93 } |
90 |
94 |
91 // --------------------------------------------------------------------------- |
95 // --------------------------------------------------------------------------- |
92 // Construct control from resource. |
96 // Construct control from resource. |
207 iContextField->SetLineSpace( iLafManager->IcfLineSpaceMargin() ); |
205 iContextField->SetLineSpace( iLafManager->IcfLineSpaceMargin() ); |
208 iContextField->SizeChangedL( iLafManager->IcfRect(), |
206 iContextField->SizeChangedL( iLafManager->IcfRect(), |
209 iLafManager->IcfTextHeight(), |
207 iLafManager->IcfTextHeight(), |
210 iLafManager->IcfFont()->FontMaxHeight(), |
208 iLafManager->IcfFont()->FontMaxHeight(), |
211 iLafManager->IcfFont() ); |
209 iLafManager->IcfFont() ); |
|
210 |
|
211 CalculateGuideLinePos(); |
212 Draw(); |
212 Draw(); |
213 } |
213 } |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // Handle window open |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 void CPeninputFingerHwrArWnd::HandleWindowOpenCommandL() |
|
220 { |
|
221 CalculateGuideLinePos(); |
|
222 } |
214 |
223 |
215 // --------------------------------------------------------------------------- |
224 // --------------------------------------------------------------------------- |
216 // accept editor's text alignment. |
225 // accept editor's text alignment. |
217 // --------------------------------------------------------------------------- |
226 // --------------------------------------------------------------------------- |
218 // |
227 // |
369 |
378 |
370 // --------------------------------------------------------------------------- |
379 // --------------------------------------------------------------------------- |
371 // set writing speed hwr writing. |
380 // set writing speed hwr writing. |
372 // --------------------------------------------------------------------------- |
381 // --------------------------------------------------------------------------- |
373 // |
382 // |
374 void CPeninputFingerHwrArWnd::SetBoxWritingSpeed( const TTimeIntervalMicroSeconds32& aCharDelay ) |
383 void CPeninputFingerHwrArWnd::SetBoxWritingSpeed( TTimeIntervalMicroSeconds32& aCharDelay ) |
375 { |
384 { |
376 iWritingBox->SetCharacterDelay( aCharDelay ); |
385 iWritingBox->SetCharacterDelay( aCharDelay ); |
377 iWritingBox->SetStrokeDelay( 90000 ); |
386 TInt strokeDelay = aCharDelay.Int()/5; |
|
387 TTimeIntervalMicroSeconds32 sDelay(strokeDelay); |
|
388 iWritingBox->SetStrokeDelay( sDelay); |
378 } |
389 } |
379 |
390 |
380 // --------------------------------------------------------------------------- |
391 // --------------------------------------------------------------------------- |
381 // retrieve rect of hwr writingbox. |
392 // retrieve rect of hwr writingbox. |
382 // --------------------------------------------------------------------------- |
393 // --------------------------------------------------------------------------- |
436 // Open the candidate list |
447 // Open the candidate list |
437 // --------------------------------------------------------------------------- |
448 // --------------------------------------------------------------------------- |
438 // |
449 // |
439 void CPeninputFingerHwrArWnd::OpenCandidateList() |
450 void CPeninputFingerHwrArWnd::OpenCandidateList() |
440 { |
451 { |
441 typedef CFepCtrlDropdownList::TListType TDropListType; |
|
442 |
|
443 CPeninputFingerHwrArLayout* hwrLayout = NULL; |
452 CPeninputFingerHwrArLayout* hwrLayout = NULL; |
444 hwrLayout = static_cast<CPeninputFingerHwrArLayout*>( UiLayout() ); |
453 hwrLayout = static_cast<CPeninputFingerHwrArLayout*>( UiLayout() ); |
445 CPeninputFingerHwrArDataStore& datastore = hwrLayout->DataStore(); |
454 CPeninputFingerHwrArDataStore& datastore = hwrLayout->DataStore(); |
446 |
455 |
447 const RPointerArray<HBufC>& candidates = datastore.Candidate(); |
456 const RPointerArray<HBufC>& candidates = datastore.Candidate(); |
448 |
457 |
449 |
458 if(candidates.Count() > 0) |
450 TDropListType unexpandable = CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble; |
459 { |
451 |
460 CFepCtrlDropdownList::TListType unexpandable = CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble; |
452 if ( datastore.PrimaryRange() == ERangeNative ) |
461 |
453 { |
462 if ( datastore.PrimaryRange() == ERangeNative ) |
454 iCandidateList->Hide( EFalse ); |
463 { |
455 TRAP_IGNORE(iCandidateList->SetCandidatesL( candidates, unexpandable )); |
464 iCandidateList->Hide( EFalse ); |
456 iCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
465 TRAP_IGNORE(iCandidateList->SetCandidatesL( candidates, unexpandable )); |
457 } |
466 iCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
458 else |
467 } |
459 { |
468 else |
460 iNumCandidateList->Hide( EFalse ); |
469 { |
461 TRAP_IGNORE(iNumCandidateList->SetCandidatesL( candidates, unexpandable )); |
470 iNumCandidateList->Hide( EFalse ); |
462 iNumCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
471 TRAP_IGNORE(iNumCandidateList->SetCandidatesL( candidates, unexpandable )); |
463 } |
472 iNumCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
464 |
473 } |
465 iArrowLeftBtn->Hide(ETrue); |
474 |
466 iArrowRightBtn->Hide(ETrue); |
475 iArrowLeftBtn->Hide(ETrue); |
467 iArrowUpBtn->Hide(ETrue); |
476 iArrowRightBtn->Hide(ETrue); |
468 iArrowDownBtn->Hide(ETrue); |
477 iArrowUpBtn->Hide(ETrue); |
|
478 iArrowDownBtn->Hide(ETrue); |
|
479 } |
469 } |
480 } |
470 |
481 |
471 // --------------------------------------------------------------------------- |
482 // --------------------------------------------------------------------------- |
472 // Close the candidate list |
483 // Close the candidate list |
473 // --------------------------------------------------------------------------- |
484 // --------------------------------------------------------------------------- |
519 iLafManager = CPeninputFingerHwrArLafManager::NewL(); |
530 iLafManager = CPeninputFingerHwrArLafManager::NewL(); |
520 iLafManager->ReadLafInfo(); |
531 iLafManager->ReadLafInfo(); |
521 |
532 |
522 //crate writing |
533 //crate writing |
523 CreateWritingBoxL(); |
534 CreateWritingBoxL(); |
524 |
535 |
525 //create the handwriting indicator |
536 //create the handwriting indicator |
526 iHandwritingIndicator = CPeninputArabicFingerHwrIndicator::NewL(UiLayout(),EHwrCtrlIdHandwringIndicator); |
537 iHandwritingIndicator = CPeninputArabicFingerHwrIndicator::NewL(UiLayout(),EHwrCtrlIdHandwringIndicator); |
527 AddControlL(iHandwritingIndicator); |
538 iWritingBox->InstallIndicator(iHandwritingIndicator); |
|
539 iWritingBox->ShowIndicator(ETrue); |
528 |
540 |
529 //create icf |
541 //create icf |
530 CreateContextFieldL(); |
542 CreateContextFieldL(); |
531 |
543 |
532 //create candidate lists |
544 //create candidate lists |
709 // create writing box. |
730 // create writing box. |
710 // --------------------------------------------------------------------------- |
731 // --------------------------------------------------------------------------- |
711 // |
732 // |
712 void CPeninputFingerHwrArWnd::CreateWritingBoxL() |
733 void CPeninputFingerHwrArWnd::CreateWritingBoxL() |
713 { |
734 { |
714 iWritingBox = CTransparentHwrWndExt::NewL( TRect( 0,0,0,0 ), UiLayout(), |
735 iWritingBox = CPeninputArabicFingerHwrWritingWnd::NewL( TRect( 0,0,0,0 ), UiLayout(), |
715 EHwrCtrlIdWritingBox, EFalse ); |
736 EHwrCtrlIdWritingBox, EFalse ); |
716 |
737 |
717 AddControlL( iWritingBox ); |
738 AddControlL( iWritingBox ); |
718 |
739 |
719 |
740 |
720 //set it to window |
741 //set it to window |
721 iWritingBox->SetStrokeEndMark( TPoint( -1,0 ) ); |
742 iWritingBox->SetStrokeEndMark( TPoint( -1,0 ) ); |
722 iWritingBox->AddEventObserver( UiLayout() ); |
743 iWritingBox->AddEventObserver( UiLayout() ); |
723 iWritingBox->EnableTraceOutsideWindow( EFalse ); |
744 iWritingBox->EnableTraceOutsideWindow( EFalse ); |
724 iWritingBox->SetWndTransparencyFactor( 0 ); |
745 iWritingBox->SetWndTransparencyFactor( 0 ); |
725 |
|
726 iWritingBox->InstallPenTraceDecoratorL( KNullDesC,EFalse); |
746 iWritingBox->InstallPenTraceDecoratorL( KNullDesC,EFalse); |
727 } |
747 } |
728 |
748 |
729 // --------------------------------------------------------------------------- |
749 // --------------------------------------------------------------------------- |
730 // create all function buttons. |
750 // create all function buttons. |
755 // |
775 // |
756 void CPeninputFingerHwrArWnd::CreateSymbolTableL() |
776 void CPeninputFingerHwrArWnd::CreateSymbolTableL() |
757 { |
777 { |
758 iSymbolTable = CPeninputArabicFingerHwrSymbolTable::NewL(UiLayout(),EHwrCtrlIdSymbolTableVkbGroup); |
778 iSymbolTable = CPeninputArabicFingerHwrSymbolTable::NewL(UiLayout(),EHwrCtrlIdSymbolTableVkbGroup); |
759 iSymbolTable->Hide(ETrue); |
779 iSymbolTable->Hide(ETrue); |
|
780 iSymbolTable->SetResourceId(R_FINGERHWR_ARABIC_SYMBOLTABLE); |
|
781 iSymbolTable->ConstructFromResourceL(); |
760 AddControlL( iSymbolTable ); |
782 AddControlL( iSymbolTable ); |
761 iSymbolTable->AddEventObserver( UiLayout() ); |
783 iSymbolTable->AddEventObserver( UiLayout() ); |
762 } |
784 } |
763 |
785 |
764 // --------------------------------------------------------------------------- |
786 // --------------------------------------------------------------------------- |
871 rect = iLafManager->CtrlRect( iArrowRightBtn->ControlId() ); |
893 rect = iLafManager->CtrlRect( iArrowRightBtn->ControlId() ); |
872 MoveIconButton( iArrowRightBtn, rect, pdx, pdy, ETrue ); |
894 MoveIconButton( iArrowRightBtn, rect, pdx, pdy, ETrue ); |
873 |
895 |
874 rect = iLafManager->CtrlRect( iArrowDownBtn->ControlId() ); |
896 rect = iLafManager->CtrlRect( iArrowDownBtn->ControlId() ); |
875 MoveIconButton( iArrowDownBtn, rect, pdx, pdy, ETrue ); |
897 MoveIconButton( iArrowDownBtn, rect, pdx, pdy, ETrue ); |
876 |
898 |
877 // load vkb key image |
899 // load vkb key image |
878 TSize keysize = iLafManager->VirtualSctpadCellSize().Size(); |
900 TSize keysize = iLafManager->VirtualSctpadCellSize().Size(); |
879 iSymbolTable->LoadVkbKeyImageL(R_FINGER_HWR_SCTPAD_IMAGE, keysize ); |
901 iSymbolTable->LoadVkbKeyImageL(R_FINGER_HWR_SCTPAD_IMAGE, keysize ); |
880 |
902 |
881 // get the key rect |
903 // get the key rect |
882 RArray<TRect> rects; |
904 RArray<TRect> rects; |
883 CleanupClosePushL( rects ); |
905 CleanupClosePushL( rects ); |
884 iLafManager->GetVirtualKeyRects( rects ); |
906 iLafManager->GetVirtualKeyRects( rects ); |
885 |
907 |
886 // load keys |
908 // load keys |
887 if(iLafManager->IsLandscape()) |
909 if(iLafManager->IsLandscape()) |
888 { |
910 { |
889 LoadSymbolVirtualKeysL(R_ARABIC_FINGER_HWR_LANDSCAPE_SYMBOL_TABLE, rects); |
911 LoadSymbolVirtualKeysL(R_ARABIC_FINGER_HWR_LANDSCAPE_SYMBOL_TABLE, rects); |
890 } |
912 } |
891 else |
913 else |
892 { |
914 { |
893 LoadSymbolVirtualKeysL(R_ARABIC_FINGER_HWR_PORTRAIT_SYMBOL_TABLE, rects); |
915 LoadSymbolVirtualKeysL(R_ARABIC_FINGER_HWR_PORTRAIT_SYMBOL_TABLE, rects); |
894 } |
916 } |
|
917 |
895 CleanupStack::PopAndDestroy();//rects |
918 CleanupStack::PopAndDestroy();//rects |
896 |
919 |
897 //move virtual Sctpad |
920 //move virtual Sctpad |
898 TInt rows = iLafManager->VirtualSctpadRowCount(); |
921 TInt rows = iLafManager->VirtualSctpadRowCount(); |
899 TInt cols = iLafManager->VirtualSctpadColCount(); |
922 TInt cols = iLafManager->VirtualSctpadColCount(); |
900 |
923 |
901 rect = iLafManager->CtrlRect(iSymbolTable->ControlId()); |
924 rect = iLafManager->CtrlRect(iSymbolTable->ControlId()); |
902 iSymbolTable->SetRect(rect); |
925 iSymbolTable->SetRect(rect); |
903 |
926 |
904 TSize symButtonSize = iLafManager->SymbolGroupButtonSize(); |
927 iSymbolTable->SizeChanged(iLafManager->GetVirtualKeyRect(), |
905 iSymbolTable->SizeChanged(TSize(),symButtonSize,rows,cols,iLafManager->IsLandscape()); |
928 iLafManager->GetSymBtnArray(), rows, cols, |
|
929 iLafManager->IsLandscape()); |
906 } |
930 } |
907 |
931 |
908 |
932 |
909 // --------------------------------------------------------------------------- |
933 // --------------------------------------------------------------------------- |
910 // layout for chinese range standby. |
934 // layout for chinese range standby. |
1287 iGuideLineBottomTl.iX = rect.iTl.iX + leftrightmargin; |
1311 iGuideLineBottomTl.iX = rect.iTl.iX + leftrightmargin; |
1288 iGuideLineBottomTl.iY = rect.iTl.iY + bottommargin; |
1312 iGuideLineBottomTl.iY = rect.iTl.iY + bottommargin; |
1289 |
1313 |
1290 iGuideLineBottomBr.iX = rect.iBr.iX - leftrightmargin; |
1314 iGuideLineBottomBr.iX = rect.iBr.iX - leftrightmargin; |
1291 iGuideLineBottomBr.iY = rect.iTl.iY + bottommargin; |
1315 iGuideLineBottomBr.iY = rect.iTl.iY + bottommargin; |
|
1316 |
|
1317 iWritingBox->SetBottomGuideLinePosition(iGuideLineBottomTl, iGuideLineBottomBr); |
1292 } |
1318 } |
1293 |
1319 |
1294 // -------------------------------------------------------------------------- |
1320 // -------------------------------------------------------------------------- |
1295 // CPeninputFingerHwrArWnd::DrawGuideLine |
1321 // CPeninputFingerHwrArWnd::DrawGuideLine |
1296 // (other items were commented in a header) |
1322 // (other items were commented in a header) |
1297 // -------------------------------------------------------------------------- |
1323 // -------------------------------------------------------------------------- |
1298 // |
1324 // |
1299 void CPeninputFingerHwrArWnd::DrawGuideLine() |
1325 void CPeninputFingerHwrArWnd::DrawGuideLine() |
1300 { |
1326 { |
1301 if(!iGuideLineOn) |
1327 if(iGuideLineOn) |
1302 { |
1328 { |
1303 iWritingBox->HideGuideLine(ETrue); |
|
1304 } |
|
1305 else |
|
1306 { |
|
1307 iWritingBox->HideGuideLine(EFalse); |
|
1308 TInt style = CTransparentHwrWndExt::EGuideLineBottom; |
1329 TInt style = CTransparentHwrWndExt::EGuideLineBottom; |
1309 iWritingBox->SetGuideLineStyle( style ); |
1330 iWritingBox->SetGuideLineStyle( style ); |
1310 |
1331 |
1311 // if size changing, or guide line pos has not been set |
1332 // if size changing, or guide line pos has not been set |
1312 CalculateGuideLinePos(); |
1333 CalculateGuideLinePos(); |
1313 |
1334 |
1314 iWritingBox->SetBottomGuideLinePosition(iGuideLineBottomTl, iGuideLineBottomBr); |
1335 iWritingBox->HideGuideLine(ETrue); |
1315 } |
1336 } |
|
1337 else |
|
1338 { |
|
1339 iWritingBox->HideGuideLine(EFalse); |
|
1340 } |
|
1341 |
1316 iWritingBox->RefreshUI(); |
1342 iWritingBox->RefreshUI(); |
1317 } |
1343 } |
1318 |
1344 |
1319 // -------------------------------------------------------------------------- |
1345 // -------------------------------------------------------------------------- |
1320 // CPeninputFingerHwrArWnd::OpenSymbolTable |
1346 // CPeninputFingerHwrArWnd::OpenSymbolTable |
1373 // Check if the candadiate list has been shown up |
1399 // Check if the candadiate list has been shown up |
1374 // -------------------------------------------------------------------------- |
1400 // -------------------------------------------------------------------------- |
1375 // |
1401 // |
1376 void CPeninputFingerHwrArWnd::HideIndicator() |
1402 void CPeninputFingerHwrArWnd::HideIndicator() |
1377 { |
1403 { |
1378 if(!iHandwritingIndicator->Hiden()) |
1404 iWritingBox->ShowIndicator(EFalse); |
1379 { |
|
1380 iHandwritingIndicator->Hide(ETrue); |
|
1381 Draw(); |
|
1382 } |
|
1383 } |
1405 } |
1384 |
1406 |
1385 // -------------------------------------------------------------------------- |
1407 // -------------------------------------------------------------------------- |
1386 // CPeninputFingerHwrArWnd::GetCharBeforeCursor |
1408 // CPeninputFingerHwrArWnd::GetCharBeforeCursor |
1387 // Get the char by its position in ICF editor |
1409 // Get the char by its position in ICF editor |
1389 // |
1411 // |
1390 TBool CPeninputFingerHwrArWnd::GetCharBeforeCursor(TInt aCharPos, TUint16& aCharBeforeCursor) |
1412 TBool CPeninputFingerHwrArWnd::GetCharBeforeCursor(TInt aCharPos, TUint16& aCharBeforeCursor) |
1391 { |
1413 { |
1392 TBuf<1> dataBeforeCursor; |
1414 TBuf<1> dataBeforeCursor; |
1393 iContextField->ExtractText( dataBeforeCursor, aCharPos, 1 ); |
1415 iContextField->ExtractText( dataBeforeCursor, aCharPos, 1 ); |
|
1416 |
|
1417 TBool isFound = EFalse; |
1394 if(dataBeforeCursor!= KNullDesC) |
1418 if(dataBeforeCursor!= KNullDesC) |
1395 { |
1419 { |
1396 aCharBeforeCursor = dataBeforeCursor[0]; |
1420 aCharBeforeCursor = dataBeforeCursor[0]; |
1397 return ETrue; |
1421 isFound = ETrue; |
1398 } |
1422 } |
1399 else |
1423 |
1400 { |
1424 return isFound; |
1401 return EFalse; |
|
1402 } |
|
1403 } |
1425 } |
1404 |
1426 |
1405 // End Of File |
1427 // End Of File |