14 * Description: Implementation of main window of finger hwr. |
14 * Description: Implementation of main window of finger hwr. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // INCLUDE |
18 // INCLUDE |
19 #include <peninputfingerhwrarwnd.rsg> |
19 #include <coemain.h> |
|
20 #include <s32mem.h> |
|
21 |
20 #include <aknlayoutscalable_apps.cdl.h> |
22 #include <aknlayoutscalable_apps.cdl.h> |
21 #include <aknlayoutscalable_avkon.cdl.h> |
23 #include <aknlayoutscalable_avkon.cdl.h> |
|
24 #include <aknlayoutdef.h> |
|
25 #include <aknutils.h> |
|
26 #include <aknsutils.h> |
|
27 #include <akniconutils.h> |
|
28 #include <aknfepglobalenums.h> |
|
29 #include <aknfeppeninputenums.h> |
|
30 |
|
31 #include <peninputfingerhwrarwnd.rsg> |
22 #include <peninputlayoutmultilineicf.h> |
32 #include <peninputlayoutmultilineicf.h> |
23 #include <peninputdropdownlist.h> |
33 #include <peninputdropdownlist.h> |
24 #include <peninputrepeatbutton.h> |
34 #include <peninputrepeatbutton.h> |
25 #include <AknLayoutDef.h> |
|
26 #include <AknUtils.h> |
|
27 #include <AknsUtils.h> |
|
28 #include <AknIconUtils.h> |
|
29 #include <coemain.h> |
|
30 #include <s32mem.h> |
|
31 #include <peninputlayoutchoicelist.h> |
|
32 #include <aknfeppeninputenums.h> |
|
33 #include <AknFepGlobalEnums.h> |
|
34 #include <peninputlayoutinputmodechoice.h> |
|
35 #include <peninputrepeatbutton.h> |
|
36 #include <peninputlayout.h> |
|
37 #include <peninputlayoutbubblectrl.h> |
35 #include <peninputlayoutbubblectrl.h> |
38 #include <peninputlayoutvkb.h> |
36 |
39 |
37 // USER INCLUDES |
40 #include <peninputmultiimagebutton.h> |
|
41 #include <peninputpluginutils.h> |
|
42 |
|
43 #include "peninputfingerhwrarwnd.h" |
38 #include "peninputfingerhwrarwnd.h" |
44 #include "peninputfingerhwrarlafmanager.h" |
39 #include "peninputfingerhwrarlafmanager.h" |
45 #include "peninputfingerhwrarevent.h" |
40 #include "peninputfingerhwrarevent.h" |
46 #include "peninputfingerhwrarcontrolid.h" |
41 #include "peninputfingerhwrarcontrolid.h" |
47 #include "peninputfingerhwrarstoreconstants.h" |
42 #include "peninputfingerhwrarstoreconstants.h" |
|
43 #include "peninputfingerhwrarmultipagevkb.h" |
48 #include "peninputfingerhwrarlayout.h" |
44 #include "peninputfingerhwrarlayout.h" |
49 #include "peninputfingerhwrardatastore.h" |
45 #include "peninputfingerhwrardatastore.h" |
50 #include "peninputlayouthwrwnd.h" |
46 #include "peninputlayouthwrwnd.h" |
51 #include "peninputfingerhwrarsymboltable.h" |
47 #include "peninputfingerhwrarsymboltable.h" |
52 #include "peninputfingerhwrarindicator.h" |
48 #include "peninputfingerhwrarindicator.h" |
53 |
49 |
54 #include "peninputfingerhwrarmultipagevkb.h" |
50 const TUint32 KDefaultTextColor = 0x000000; |
55 #include "hbufcarrayar.h" |
51 const TUint KDefaultFrameColor = 0x000000; |
56 |
52 const TUint32 KDefaultWriteBoxBgColor = 0xdddddd; |
57 const TUint32 KDefaultTextColor = 0x000000; |
|
58 const TUint KDefaultFrameColor = 0x000000; |
|
59 const TUint32 KDefaultWriteBoxBgColor = 0xdddddd; |
|
60 const TUint32 KDefaultWriteBoxFrameColor = 0x000000; |
53 const TUint32 KDefaultWriteBoxFrameColor = 0x000000; |
61 |
54 |
62 // --------------------------------------------------------------------------- |
55 // --------------------------------------------------------------------------- |
63 // Symbian Constructor |
56 // Symbian Constructor |
64 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
327 iContextField->HideBubble(); |
320 iContextField->HideBubble(); |
328 } |
321 } |
329 } |
322 } |
330 |
323 |
331 // --------------------------------------------------------------------------- |
324 // --------------------------------------------------------------------------- |
332 // accept editor's char ranges restriction. |
|
333 // --------------------------------------------------------------------------- |
|
334 // |
|
335 void CPeninputFingerHwrArWnd::SetPermittedRanges( const TInt aPermittedRanges ) |
|
336 { |
|
337 if(aPermittedRanges == 0) |
|
338 return; |
|
339 |
|
340 iPermittedRanges = aPermittedRanges; |
|
341 } |
|
342 |
|
343 // --------------------------------------------------------------------------- |
|
344 // get strokes from hwr writing box. |
325 // get strokes from hwr writing box. |
345 // --------------------------------------------------------------------------- |
326 // --------------------------------------------------------------------------- |
346 // |
327 // |
347 const RArray<TPoint>& CPeninputFingerHwrArWnd::StrokeList() |
328 const RArray<TPoint>& CPeninputFingerHwrArWnd::StrokeList() |
348 { |
329 { |
416 |
398 |
417 // --------------------------------------------------------------------------- |
399 // --------------------------------------------------------------------------- |
418 // Change SCT page. |
400 // Change SCT page. |
419 // --------------------------------------------------------------------------- |
401 // --------------------------------------------------------------------------- |
420 // |
402 // |
421 void CPeninputFingerHwrArWnd::ShowSctPage( TInt aPageNo, TInt aPos ) |
403 void CPeninputFingerHwrArWnd::ShowSymbolPage( TInt aPageNo, TInt aPos ) |
422 { |
404 { |
423 iSymbolTable->NavigatePage(aPageNo,aPos); |
405 iSymbolTable->NavigatePage(aPageNo,aPos); |
424 UpdateAllVirtualKeysFeedback( EFingerHwrSymbolRange ); |
|
425 } |
406 } |
426 |
407 |
427 // --------------------------------------------------------------------------- |
408 // --------------------------------------------------------------------------- |
428 // retrieve the ICF control. |
409 // retrieve the ICF control. |
429 // --------------------------------------------------------------------------- |
410 // --------------------------------------------------------------------------- |
450 { |
431 { |
451 return iNumCandidateList; |
432 return iNumCandidateList; |
452 } |
433 } |
453 |
434 |
454 // --------------------------------------------------------------------------- |
435 // --------------------------------------------------------------------------- |
455 // Update layout |
436 // Open the candidate list |
456 // --------------------------------------------------------------------------- |
437 // --------------------------------------------------------------------------- |
457 // |
438 // |
458 void CPeninputFingerHwrArWnd::UpdateLayout( const TBool aIsStandby, const TBool aReloadCandicate) |
439 void CPeninputFingerHwrArWnd::OpenCandidateList() |
459 { |
440 { |
460 TRAP_IGNORE( UpdateLayoutL( aIsStandby, aReloadCandicate) ); |
441 typedef CFepCtrlDropdownList::TListType TDropListType; |
461 } |
|
462 |
|
463 // --------------------------------------------------------------------------- |
|
464 // Update layout |
|
465 // --------------------------------------------------------------------------- |
|
466 // |
|
467 void CPeninputFingerHwrArWnd::UpdateLayoutL( const TBool aIsStandby, |
|
468 const TBool aReloadCandicate) |
|
469 { |
|
470 // Set the candidates when dropdown list is shown |
|
471 if ( !aIsStandby ) |
|
472 { |
|
473 typedef CFepCtrlDropdownList::TListType TDropListType; |
|
474 |
442 |
475 CPeninputFingerHwrArLayout* hwrLayout = NULL; |
443 CPeninputFingerHwrArLayout* hwrLayout = NULL; |
476 hwrLayout = static_cast<CPeninputFingerHwrArLayout*>( UiLayout() ); |
444 hwrLayout = static_cast<CPeninputFingerHwrArLayout*>( UiLayout() ); |
477 CPeninputFingerHwrArDataStore& datastore = hwrLayout->DataStore(); |
445 CPeninputFingerHwrArDataStore& datastore = hwrLayout->DataStore(); |
478 |
446 |
479 const RPointerArray<HBufC>& candidates = datastore.Candidate(); |
447 const RPointerArray<HBufC>& candidates = datastore.Candidate(); |
480 |
448 |
481 |
449 |
482 TDropListType unexpandable = CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble; |
450 TDropListType unexpandable = CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble; |
483 |
451 |
484 if ( datastore.PrimaryRange() == ERangeNative ) |
452 if ( datastore.PrimaryRange() == ERangeNative ) |
485 { |
453 { |
486 iCandidateList->Hide( EFalse ); |
454 iCandidateList->Hide( EFalse ); |
487 |
455 TRAP_IGNORE(iCandidateList->SetCandidatesL( candidates, unexpandable )); |
488 if ( aReloadCandicate ) |
456 iCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
489 { |
457 } |
490 iCandidateList->SetCandidatesL( candidates, unexpandable ); |
458 else |
491 } |
459 { |
492 |
460 iNumCandidateList->Hide( EFalse ); |
493 iCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
461 TRAP_IGNORE(iNumCandidateList->SetCandidatesL( candidates, unexpandable )); |
494 |
462 iNumCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
495 } |
463 } |
496 else |
464 |
497 { |
465 iArrowLeftBtn->Hide(ETrue); |
498 iNumCandidateList->Hide( EFalse ); |
466 iArrowRightBtn->Hide(ETrue); |
499 if ( aReloadCandicate ) |
467 iArrowUpBtn->Hide(ETrue); |
500 { |
468 iArrowDownBtn->Hide(ETrue); |
501 iNumCandidateList->SetCandidatesL( candidates, unexpandable ); |
469 } |
502 } |
470 |
503 |
471 // --------------------------------------------------------------------------- |
504 iNumCandidateList->SetHighlightCell( 0, datastore.Highlight() ); |
472 // Close the candidate list |
505 } |
473 // --------------------------------------------------------------------------- |
506 } |
474 // |
507 else |
475 void CPeninputFingerHwrArWnd::CloseCandidateList() |
508 { |
476 { |
509 iCandidateList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble); |
477 iCandidateList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble); |
510 iNumCandidateList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble); |
478 iNumCandidateList->ResetAndClear(CFepCtrlDropdownList::EListExpandableMultiRowWithoutIconWithBubble); |
511 // hide all the dropdown list in standby state |
479 // hide all the dropdown list in standby state |
512 iCandidateList->Hide( ETrue ); |
480 iCandidateList->Hide( ETrue ); |
513 iNumCandidateList->Hide( ETrue ); |
481 iNumCandidateList->Hide( ETrue ); |
514 } |
482 |
515 |
483 iArrowLeftBtn->Hide(EFalse); |
516 iArrowLeftBtn->Hide( !aIsStandby ); |
484 iArrowRightBtn->Hide(EFalse); |
517 iArrowRightBtn->Hide( !aIsStandby ); |
485 iArrowUpBtn->Hide(EFalse); |
518 iArrowUpBtn->Hide( !aIsStandby ); |
486 iArrowDownBtn->Hide(EFalse); |
519 iArrowDownBtn->Hide( !aIsStandby ); |
487 } |
520 } |
|
521 |
488 |
522 // --------------------------------------------------------------------------- |
489 // --------------------------------------------------------------------------- |
523 // dim arrow buttons. |
490 // dim arrow buttons. |
524 // --------------------------------------------------------------------------- |
491 // --------------------------------------------------------------------------- |
525 // |
492 // |
530 iArrowUpBtn->SetDimmed( aDimArrow ); |
497 iArrowUpBtn->SetDimmed( aDimArrow ); |
531 iArrowDownBtn->SetDimmed( aDimArrow ); |
498 iArrowDownBtn->SetDimmed( aDimArrow ); |
532 } |
499 } |
533 |
500 |
534 // --------------------------------------------------------------------------- |
501 // --------------------------------------------------------------------------- |
535 // retrieve char range of layout, including sct. |
|
536 // --------------------------------------------------------------------------- |
|
537 // |
|
538 TInt CPeninputFingerHwrArWnd::CurrentCharRange() |
|
539 { |
|
540 return iCurCharRange; |
|
541 } |
|
542 |
|
543 // --------------------------------------------------------------------------- |
|
544 // c++ constructor |
502 // c++ constructor |
545 // --------------------------------------------------------------------------- |
503 // --------------------------------------------------------------------------- |
546 // |
504 // |
547 CPeninputFingerHwrArWnd::CPeninputFingerHwrArWnd( |
505 CPeninputFingerHwrArWnd::CPeninputFingerHwrArWnd( |
548 CFepUiLayout* aFepUiLayout, TInt aControlId ) |
506 CFepUiLayout* aFepUiLayout, TInt aControlId ) |
844 |
801 |
845 return button; |
802 return button; |
846 } |
803 } |
847 |
804 |
848 // --------------------------------------------------------------------------- |
805 // --------------------------------------------------------------------------- |
849 // load virtual number pad images. |
|
850 // --------------------------------------------------------------------------- |
|
851 // |
|
852 void CPeninputFingerHwrArWnd::LoadVkbKeyImageL( TInt aResId, const TSize& aKeySize ) |
|
853 { |
|
854 iSymbolTable->LoadVkbKeyImageL(aResId,aKeySize); |
|
855 } |
|
856 |
|
857 // --------------------------------------------------------------------------- |
|
858 // load virtual sct keys. |
806 // load virtual sct keys. |
859 // --------------------------------------------------------------------------- |
807 // --------------------------------------------------------------------------- |
860 // |
808 // |
861 void CPeninputFingerHwrArWnd::LoadVirtualSctpadKeysL( const TInt aResId, |
809 void CPeninputFingerHwrArWnd::LoadSymbolVirtualKeysL( const TInt aResId, |
862 const RArray<TRect>& aCellRects ) |
810 const RArray<TRect>& aCellRects ) |
863 { |
811 { |
864 TAknTextLineLayout txtlayout = iLafManager->SctpadKeyTxtLayout(); |
812 TAknTextLineLayout txtlayout = iLafManager->SctpadKeyTxtLayout(); |
865 iSymbolTable->KeyPad()->SetTextLineLayout( txtlayout ); |
813 iSymbolTable->KeyPad()->SetTextLineLayout( txtlayout ); |
866 |
814 |
929 rect = iLafManager->CtrlRect( iOptionBtn->ControlId() ); |
877 rect = iLafManager->CtrlRect( iOptionBtn->ControlId() ); |
930 MoveIconButton( iOptionBtn, rect, pdx, pdy, ETrue ); |
878 MoveIconButton( iOptionBtn, rect, pdx, pdy, ETrue ); |
931 |
879 |
932 // load vkb key image |
880 // load vkb key image |
933 TSize keysize = iLafManager->VirtualSctpadCellSize().Size(); |
881 TSize keysize = iLafManager->VirtualSctpadCellSize().Size(); |
934 LoadVkbKeyImageL(R_FINGER_HWR_SCTPAD_IMAGE, keysize ); |
882 iSymbolTable->LoadVkbKeyImageL(R_FINGER_HWR_SCTPAD_IMAGE, keysize ); |
935 |
883 |
936 // get the key rect |
884 // get the key rect |
937 RArray<TRect> rects; |
885 RArray<TRect> rects; |
938 CleanupClosePushL( rects ); |
886 CleanupClosePushL( rects ); |
939 iLafManager->GetVirtualKeyRects( rects ); |
887 iLafManager->GetVirtualKeyRects( rects ); |
940 |
888 |
941 // load keys |
889 // load keys |
942 if(iLafManager->IsLandscape()) |
890 if(iLafManager->IsLandscape()) |
943 { |
891 { |
944 LoadVirtualSctpadKeysL(R_ARABIC_FINGER_HWR_LANDSCAPE_SYMBOL_TABLE, rects); |
892 LoadSymbolVirtualKeysL(R_ARABIC_FINGER_HWR_LANDSCAPE_SYMBOL_TABLE, rects); |
945 } |
893 } |
946 else |
894 else |
947 { |
895 { |
948 LoadVirtualSctpadKeysL(R_ARABIC_FINGER_HWR_PORTRAIT_SYMBOL_TABLE, rects); |
896 LoadSymbolVirtualKeysL(R_ARABIC_FINGER_HWR_PORTRAIT_SYMBOL_TABLE, rects); |
949 } |
897 } |
950 CleanupStack::PopAndDestroy();//rects |
898 CleanupStack::PopAndDestroy();//rects |
951 |
899 |
952 //move virtual Sctpad |
900 //move virtual Sctpad |
953 TInt rows = iLafManager->VirtualSctpadRowCount(); |
901 TInt rows = iLafManager->VirtualSctpadRowCount(); |
968 void CPeninputFingerHwrArWnd::SwitchToStandbyView() |
916 void CPeninputFingerHwrArWnd::SwitchToStandbyView() |
969 { |
917 { |
970 // hide following controls |
918 // hide following controls |
971 iCandidateList->Hide( ETrue ); |
919 iCandidateList->Hide( ETrue ); |
972 iNumCandidateList->Hide( ETrue ); |
920 iNumCandidateList->Hide( ETrue ); |
973 iSymbolTable->Hide( ETrue ); |
921 iSymbolTable->Hide( ETrue); |
974 |
922 |
975 // show following controls |
923 // show following controls |
976 iArrowLeftBtn->Hide( EFalse ); |
924 iArrowLeftBtn->Hide( EFalse ); |
977 iArrowRightBtn->Hide( EFalse ); |
925 iArrowRightBtn->Hide( EFalse ); |
978 iArrowUpBtn->Hide( EFalse ); |
926 iArrowUpBtn->Hide( EFalse ); |
979 iArrowDownBtn->Hide( EFalse ); |
927 iArrowDownBtn->Hide( EFalse ); |
980 iOptionBtn->Hide( EFalse ); |
928 iOptionBtn->Hide( EFalse ); |
981 |
929 iSymbolTableBtn->SetHighlight( EFalse); |
982 iSymbolTableBtn->Hide( EFalse ); |
930 iContextField->SetReady(ETrue); |
983 iSymbolTableBtn->SetHighlight( EFalse); |
|
984 |
|
985 UpdateAllVirtualKeysFeedback( EFingerHwrNativeRange ); |
|
986 Draw(); |
931 Draw(); |
987 } |
932 } |
988 |
933 |
989 // --------------------------------------------------------------------------- |
934 // --------------------------------------------------------------------------- |
990 // layout for symbol range standby. |
935 // layout for symbol range standby. |
1002 iNumCandidateList->Hide( ETrue ); |
947 iNumCandidateList->Hide( ETrue ); |
1003 iArrowLeftBtn->Hide( ETrue ); |
948 iArrowLeftBtn->Hide( ETrue ); |
1004 iArrowRightBtn->Hide( ETrue ); |
949 iArrowRightBtn->Hide( ETrue ); |
1005 iArrowUpBtn->Hide( ETrue ); |
950 iArrowUpBtn->Hide( ETrue ); |
1006 iArrowDownBtn->Hide( ETrue ); |
951 iArrowDownBtn->Hide( ETrue ); |
1007 iOptionBtn->Hide( EFalse ); |
952 |
|
953 // set the symboltable button highlighted |
1008 iSymbolTableBtn->SetHighlight( ETrue ); |
954 iSymbolTableBtn->SetHighlight( ETrue ); |
1009 |
955 |
1010 TInt pageno = ( iCurCharRangeNoSct == EFingerHwrNativeRange ) ? 0 : 1; |
956 // avoid overlap refresh problem after opening symbil table |
1011 ShowSctPage( pageno, EPagePosPageNo ); |
957 // so set this control to be not ready |
1012 |
958 iContextField->SetReady(EFalse); |
1013 UpdateAllVirtualKeysFeedback( EFingerHwrSymbolRange ); |
|
1014 iSymbolTable->OpenSymbolTable(); |
959 iSymbolTable->OpenSymbolTable(); |
1015 } |
960 } |
1016 |
961 |
1017 |
962 |
1018 // --------------------------------------------------------------------------- |
963 // --------------------------------------------------------------------------- |
1361 // (other items were commented in a header) |
1297 // (other items were commented in a header) |
1362 // -------------------------------------------------------------------------- |
1298 // -------------------------------------------------------------------------- |
1363 // |
1299 // |
1364 void CPeninputFingerHwrArWnd::DrawGuideLine() |
1300 void CPeninputFingerHwrArWnd::DrawGuideLine() |
1365 { |
1301 { |
1366 if(iGuideLineOn) |
1302 if(!iGuideLineOn) |
1367 { |
1303 { |
1368 iWritingBox->HideGuideLine(ETrue); |
1304 iWritingBox->HideGuideLine(ETrue); |
1369 } |
1305 } |
1370 else |
1306 else |
1371 { |
1307 { |
|
1308 iWritingBox->HideGuideLine(EFalse); |
1372 TInt style = CTransparentHwrWndExt::EGuideLineBottom; |
1309 TInt style = CTransparentHwrWndExt::EGuideLineBottom; |
1373 iWritingBox->SetGuideLineStyle( style ); |
1310 iWritingBox->SetGuideLineStyle( style ); |
1374 |
1311 |
1375 // if size changing, or guide line pos has not been set |
1312 // if size changing, or guide line pos has not been set |
1376 CalculateGuideLinePos(); |
1313 CalculateGuideLinePos(); |
1377 |
1314 |
1378 iWritingBox->SetBottomGuideLinePosition(iGuideLineBottomTl, iGuideLineBottomBr); |
1315 iWritingBox->SetBottomGuideLinePosition(iGuideLineBottomTl, iGuideLineBottomBr); |
1379 |
1316 } |
1380 iWritingBox->RefreshUI(); |
1317 iWritingBox->RefreshUI(); |
1381 } |
|
1382 } |
1318 } |
1383 |
1319 |
1384 // -------------------------------------------------------------------------- |
1320 // -------------------------------------------------------------------------- |
1385 // CPeninputFingerHwrArWnd::OpenSymbolTable |
1321 // CPeninputFingerHwrArWnd::OpenSymbolTable |
1386 // Open the symbol table |
1322 // Open the symbol table |