41 #include "peninputsplititutwesternuimgr.h" |
41 #include "peninputsplititutwesternuimgr.h" |
42 #include "peninputsplititutconverter.h" |
42 #include "peninputsplititutconverter.h" |
43 #include "peninputcommonbgctrl.h" |
43 #include "peninputcommonbgctrl.h" |
44 |
44 |
45 _LIT(KBmpFileName, "z:\\resource\\apps\\peninputsplititut.mbm"); |
45 _LIT(KBmpFileName, "z:\\resource\\apps\\peninputsplititut.mbm"); |
|
46 _LIT(KEmptyString, ""); |
46 |
47 |
47 const TInt KImageMajorSkinId = EAknsMajorGeneric; |
48 const TInt KImageMajorSkinId = EAknsMajorGeneric; |
48 const TUint KDefaultSpellTextColor = 0; |
49 const TUint KDefaultSpellTextColor = 0; |
49 |
50 |
50 const TInt KSpaceUnicode = 32; |
51 const TInt KSpaceUnicode = 32; |
259 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)), |
260 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)), |
260 EPosRight2); |
261 EPosRight2); |
261 iStandardItutKp->SetTextLineLayout( |
262 iStandardItutKp->SetTextLineLayout( |
262 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)), |
263 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)), |
263 EPosRight3); |
264 EPosRight3); |
264 |
|
265 TRect* iconRect = static_cast<TRect*>( iDataMgr->RequestData( EStarIconRect )); |
|
266 // Set the star icon rect |
|
267 iStandardItutKp->SetStarIconRect( *iconRect ); |
|
268 iconRect = static_cast<TRect*>( iDataMgr->RequestData( EShiftIconRect )); |
|
269 // Set the shift icon rect |
|
270 iStandardItutKp->SetShiftIconRect( *iconRect ); |
|
271 |
265 |
272 TResourceReader reader; |
266 TResourceReader reader; |
273 CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId); |
267 CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId); |
274 |
268 |
275 // construct keys |
269 // construct keys |
789 KAknsIIDQsnFrInputPreviewSideL, |
783 KAknsIIDQsnFrInputPreviewSideL, |
790 KAknsIIDQsnFrInputPreviewMiddle, |
784 KAknsIIDQsnFrInputPreviewMiddle, |
791 KAknsIIDQsnFrInputPreviewSideR ); |
785 KAknsIIDQsnFrInputPreviewSideR ); |
792 iICF->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH)); |
786 iICF->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH)); |
793 |
787 |
794 iICF->MsgBubbleCtrl()->SetTextL( KNullDesC ); |
788 iICF->MsgBubbleCtrl()->SetTextL( KEmptyString ); |
795 |
789 |
796 iICF->SetTextMargin( iDataMgr->iIcfTextLeftMargin, |
790 iICF->SetTextMargin( iDataMgr->iIcfTextLeftMargin, |
797 iDataMgr->iIcfTextRightMargin, |
791 iDataMgr->iIcfTextRightMargin, |
798 iDataMgr->iIcfTextTopMargin, |
792 iDataMgr->iIcfTextTopMargin, |
799 iDataMgr->iIcfTextBottomMargin ); |
793 iDataMgr->iIcfTextBottomMargin ); |
800 |
794 |
801 iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMargin ); |
795 iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMargin ); |
802 |
796 |
803 SetSpellIndiBubble(); |
797 SetIndiBubble(); |
804 iICF->Hide( ETrue ); |
798 iICF->Hide( ETrue ); |
805 } |
|
806 |
|
807 // --------------------------------------------------------------------------- |
|
808 // CSplitItutWindow::CreateSplitIndiBubbleL |
|
809 // --------------------------------------------------------------------------- |
|
810 // |
|
811 void CSplitItutWindow::CreateSplitIndiBubbleL() |
|
812 { |
|
813 // char count bubble |
|
814 TRect bubbleRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(ESplitIndiPaneRect)); |
|
815 iSplitIndiBubble = CBubbleCtrl::NewL(bubbleRect,iLayoutOwner,ECtrlIdSplitIndiBubble); |
|
816 iSplitIndiBubble->SetTextFormat(TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(ESplitIndiTextLine))); |
|
817 iSplitIndiBubble->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
818 iSplitIndiBubble->SetBitmapParam(NULL, |
|
819 NULL, |
|
820 KAknsIIDQsnFrInputPreviewSideL, |
|
821 KAknsIIDQsnFrInputPreviewMiddle, |
|
822 KAknsIIDQsnFrInputPreviewSideR); |
|
823 AddControlL(iSplitIndiBubble); |
|
824 } |
799 } |
825 |
800 |
826 |
801 |
827 // --------------------------------------------------------------------------- |
802 // --------------------------------------------------------------------------- |
828 // CSplitItutWindow::ConstructL |
803 // CSplitItutWindow::ConstructL |
972 // |
946 // |
973 TInt CSplitItutWindow::SizeChanged() |
947 TInt CSplitItutWindow::SizeChanged() |
974 { |
948 { |
975 // resize all controls |
949 // resize all controls |
976 SetCtrlRect(iStandardItutKp, EKeypadRect); |
950 SetCtrlRect(iStandardItutKp, EKeypadRect); |
977 SetCtrlRect(iSplitIndiBubble, ESplitIndiPaneRect); |
|
978 |
951 |
979 iStandardItutKp->SetTextLineLayout( |
952 iStandardItutKp->SetTextLineLayout( |
980 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)), |
953 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)), |
981 EPosLeft); |
954 EPosLeft); |
982 iStandardItutKp->SetTextLineLayout( |
955 iStandardItutKp->SetTextLineLayout( |
986 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)), |
959 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)), |
987 EPosRight2); |
960 EPosRight2); |
988 iStandardItutKp->SetTextLineLayout( |
961 iStandardItutKp->SetTextLineLayout( |
989 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)), |
962 TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)), |
990 EPosRight3); |
963 EPosRight3); |
991 |
|
992 TRect* iconRect = static_cast<TRect*>( iDataMgr->RequestData( EStarIconRect )); |
|
993 // Set the star icon rect |
|
994 iStandardItutKp->SetStarIconRect( *iconRect ); |
|
995 iconRect = static_cast<TRect*>( iDataMgr->RequestData( EShiftIconRect )); |
|
996 // Set the shift icon rect |
|
997 iStandardItutKp->SetShiftIconRect( *iconRect ); |
|
998 |
964 |
999 RPointerArray<CVirtualKey>& keys = |
965 RPointerArray<CVirtualKey>& keys = |
1000 const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray()); |
966 const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray()); |
1001 RArray<TRect>& cellRects = |
967 RArray<TRect>& cellRects = |
1002 TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects)); |
968 TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects)); |
1488 unicodesArr1.Close(); |
1454 unicodesArr1.Close(); |
1489 unicodesInt.Close(); |
1455 unicodesInt.Close(); |
1490 |
1456 |
1491 } |
1457 } |
1492 |
1458 |
1493 void CSplitItutWindow::UpdateSplitIndiBubbleL( TUint8* aData ) |
1459 void CSplitItutWindow::UpdateIndiBubbleL( TUint8* aData ) |
1494 { |
1460 { |
1495 RDesReadStream readStream; |
1461 // if icf is hidden, not call updateindibubblel |
1496 TFepIndicatorInfo indicatorData; |
|
1497 |
|
1498 TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) ); |
|
1499 readStream.Open(countPtr); |
|
1500 CleanupClosePushL(readStream); |
|
1501 |
|
1502 indicatorData.iIndicatorImgID = readStream.ReadInt32L(); |
|
1503 indicatorData.iIndicatorMaskID = readStream.ReadInt32L(); |
|
1504 indicatorData.iIndicatorTextImgID = readStream.ReadInt32L(); |
|
1505 indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L(); |
|
1506 |
|
1507 CleanupStack::PopAndDestroy(&readStream); |
|
1508 |
|
1509 if ( indicatorData.iIndicatorImgID != 0 && |
|
1510 indicatorData.iIndicatorMaskID != 0 && |
|
1511 indicatorData.iIndicatorTextImgID != 0 && |
|
1512 indicatorData.iIndicatorTextMaskID != 0) |
|
1513 { |
|
1514 iDataMgr->SetSplitIndicatorData(indicatorData); |
|
1515 iImDimensionSet = ETrue; |
|
1516 |
|
1517 SetBubbleImageL(*iSplitIndiBubble, TItutDataConverter::AnyToRect( |
|
1518 iDataMgr->RequestData(ESplitIndiIconRect)), |
|
1519 indicatorData.iIndicatorImgID, |
|
1520 indicatorData.iIndicatorMaskID, |
|
1521 indicatorData.iIndicatorTextImgID, |
|
1522 indicatorData.iIndicatorTextMaskID); |
|
1523 iSplitIndiBubble->Hide(EFalse); |
|
1524 } |
|
1525 |
|
1526 } |
|
1527 |
|
1528 void CSplitItutWindow::UpdateSpellIndiBubbleL( TUint8* aData ) |
|
1529 { |
|
1530 // if icf is hidden, not call updateindibubblel |
|
1531 if( iICF->Hiden() ) |
1462 if( iICF->Hiden() ) |
1532 { |
1463 { |
1533 return; |
1464 return; |
1534 } |
1465 } |
1535 RDesReadStream readStream; |
1466 RDesReadStream readStream; |
1549 if ( indicatorData.iIndicatorImgID != 0 && |
1480 if ( indicatorData.iIndicatorImgID != 0 && |
1550 indicatorData.iIndicatorMaskID != 0 && |
1481 indicatorData.iIndicatorMaskID != 0 && |
1551 indicatorData.iIndicatorTextImgID != 0 && |
1482 indicatorData.iIndicatorTextImgID != 0 && |
1552 indicatorData.iIndicatorTextMaskID != 0) |
1483 indicatorData.iIndicatorTextMaskID != 0) |
1553 { |
1484 { |
1554 iDataMgr->SetSpellIndicatorData( indicatorData ); |
1485 iDataMgr->SetIndicatorData( indicatorData ); |
1555 iImDimensionSet = ETrue; |
1486 iImDimensionSet = ETrue; |
1556 |
1487 |
1557 SetBubbleImageL(*iICF->MsgBubbleCtrl(), |
1488 SetIndiBubbleImageL( indicatorData.iIndicatorImgID, |
1558 TItutDataConverter::AnyToRect( |
1489 indicatorData.iIndicatorMaskID, |
1559 iDataMgr->RequestData( ESpellIndiIconWithoutTextRect )), |
1490 indicatorData.iIndicatorTextImgID, |
1560 indicatorData.iIndicatorImgID, |
1491 indicatorData.iIndicatorTextMaskID ); |
1561 indicatorData.iIndicatorMaskID, |
|
1562 indicatorData.iIndicatorTextImgID, |
|
1563 indicatorData.iIndicatorTextMaskID ); |
|
1564 |
1492 |
1565 TBuf<KTextLength> text; |
1493 TBuf<KTextLength> text; |
1566 iICF->MsgBubbleCtrl()->GetText( text ); |
1494 iICF->MsgBubbleCtrl()->GetText( text ); |
1567 iICF->ShowBubble( text, iICF->MsgBubbleCtrl()->Rect()); |
1495 iICF->ShowBubble( text, iICF->MsgBubbleCtrl()->Rect()); |
1568 } |
1496 } |
1672 CleanupStack::PopAndDestroy( dataBuf ); |
1600 CleanupStack::PopAndDestroy( dataBuf ); |
1673 CleanupStack::PopAndDestroy( &readStream ); |
1601 CleanupStack::PopAndDestroy( &readStream ); |
1674 } |
1602 } |
1675 |
1603 |
1676 // --------------------------------------------------------------------------- |
1604 // --------------------------------------------------------------------------- |
1677 // CSplitItutWindow::SetBubbleImageL |
1605 // CSplitItutWindow::SetIndiBubbleImageL |
1678 // --------------------------------------------------------------------------- |
1606 // --------------------------------------------------------------------------- |
1679 // |
1607 // |
1680 void CSplitItutWindow::SetBubbleImageL( CBubbleCtrl& aBubble, |
1608 void CSplitItutWindow::SetIndiBubbleImageL( const TInt aImgID1, |
1681 const TRect& aRect, |
|
1682 const TInt aImgID1, |
|
1683 const TInt aMaskID1, |
1609 const TInt aMaskID1, |
1684 const TInt aImgID2, |
1610 const TInt aImgID2, |
1685 const TInt aMaskID2 ) |
1611 const TInt aMaskID2 ) |
1686 { |
1612 { |
1687 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
1613 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
1722 CleanupStack::PushL( bmp2 ); |
1648 CleanupStack::PushL( bmp2 ); |
1723 CleanupStack::PushL( mask2 ); |
1649 CleanupStack::PushL( mask2 ); |
1724 |
1650 |
1725 AknIconUtils::GetContentDimensions( bmp2, iIndicatorTextSize ); |
1651 AknIconUtils::GetContentDimensions( bmp2, iIndicatorTextSize ); |
1726 |
1652 |
1727 TRect boundRect = aRect; |
1653 TRect boundRect; |
|
1654 boundRect = TItutDataConverter::AnyToRect( |
|
1655 iDataMgr->RequestData( EIndiIconWithoutTextRect )); |
|
1656 |
1728 TRect imgrect, textrect; |
1657 TRect imgrect, textrect; |
1729 |
1658 |
1730 CalIndicatorRect( boundRect, imgrect, textrect, EIndiAlignCenter ); |
1659 CalIndicatorRect( boundRect, imgrect, textrect, EIndiAlignCenter ); |
1731 AknIconUtils::SetSize( bmp1, imgrect.Size(), EAspectRatioNotPreserved ); |
1660 AknIconUtils::SetSize( bmp1, imgrect.Size(), EAspectRatioNotPreserved ); |
1732 AknIconUtils::SetSize( mask1, imgrect.Size(), EAspectRatioNotPreserved ); |
1661 AknIconUtils::SetSize( mask1, imgrect.Size(), EAspectRatioNotPreserved ); |
1734 AknIconUtils::SetSize( mask2, textrect.Size(), EAspectRatioNotPreserved ); |
1663 AknIconUtils::SetSize( mask2, textrect.Size(), EAspectRatioNotPreserved ); |
1735 |
1664 |
1736 CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256); |
1665 CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256); |
1737 CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256); |
1666 CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256); |
1738 |
1667 |
1739 aBubble.SetBitmapParam( bmp3, mask3, |
1668 iICF->MsgBubbleCtrl()->SetBitmapParam( bmp3, mask3, |
1740 KAknsIIDQsnFrInputPreviewSideL, |
1669 KAknsIIDQsnFrInputPreviewSideL, |
1741 KAknsIIDQsnFrInputPreviewMiddle, |
1670 KAknsIIDQsnFrInputPreviewMiddle, |
1742 KAknsIIDQsnFrInputPreviewSideR ); |
1671 KAknsIIDQsnFrInputPreviewSideR ); |
1743 |
1672 |
1744 CleanupStack::PopAndDestroy( mask2 ); |
1673 CleanupStack::PopAndDestroy( mask2 ); |
1745 CleanupStack::PopAndDestroy( bmp2 ); |
1674 CleanupStack::PopAndDestroy( bmp2 ); |
1746 CleanupStack::PopAndDestroy( mask1 ); |
1675 CleanupStack::PopAndDestroy( mask1 ); |
1747 CleanupStack::PopAndDestroy( bmp1 ); |
1676 CleanupStack::PopAndDestroy( bmp1 ); |
1748 } |
1677 } |
1749 |
1678 |
1750 // --------------------------------------------------------------------------- |
1679 // --------------------------------------------------------------------------- |
1751 // CSplitItutWindow::SetSplitIndiBubble |
1680 // CSplitItutWindow::SetIndiBubble |
1752 // --------------------------------------------------------------------------- |
1681 // --------------------------------------------------------------------------- |
1753 // |
1682 // |
1754 void CSplitItutWindow::SetSplitIndiBubble() |
1683 void CSplitItutWindow::SetIndiBubble() |
1755 { |
1684 { |
1756 if (iSplitIndiBubble) |
1685 if ( iICF ) |
1757 { |
|
1758 TAknTextLineLayout textLine = TItutDataConverter::AnyToTextLine( |
|
1759 iDataMgr->RequestData(ESplitIndiTextLine)); |
|
1760 TRect bubbleRect = TItutDataConverter::AnyToRect( |
|
1761 iDataMgr->RequestData(ESplitIndiPaneRect)); |
|
1762 TRect iconRect = TItutDataConverter::AnyToRect( |
|
1763 iDataMgr->RequestData(ESplitIndiIconRect)); |
|
1764 TSize offset; |
|
1765 offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY; |
|
1766 offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX; |
|
1767 TSize size(iconRect.Width(), iconRect.Height()); |
|
1768 |
|
1769 iSplitIndiBubble->SetRect(bubbleRect); |
|
1770 iSplitIndiBubble->SetIconOffsetAndSize(offset, size); |
|
1771 iSplitIndiBubble->SetTextFormat(textLine); |
|
1772 iSplitIndiBubble->SetTextColorIndex(EAknsCIQsnTextColorsCG67); |
|
1773 } |
|
1774 } |
|
1775 |
|
1776 // --------------------------------------------------------------------------- |
|
1777 // CSplitItutWindow::SetSpellIndiBubble |
|
1778 // --------------------------------------------------------------------------- |
|
1779 // |
|
1780 void CSplitItutWindow::SetSpellIndiBubble() |
|
1781 { |
|
1782 if (iICF) |
|
1783 { |
1686 { |
1784 TRect bubbleRect = TItutDataConverter::AnyToRect( |
1687 TRect bubbleRect = TItutDataConverter::AnyToRect( |
1785 iDataMgr->RequestData( ESpellIndiPaneWithoutTextRect )); |
1688 iDataMgr->RequestData( EIndiPaneWithoutTextRect )); |
1786 TRect iconRect = TItutDataConverter::AnyToRect( |
1689 TRect iconRect = TItutDataConverter::AnyToRect( |
1787 iDataMgr->RequestData( ESpellIndiIconWithoutTextRect )); |
1690 iDataMgr->RequestData( EIndiIconWithoutTextRect )); |
1788 |
1691 |
1789 TSize offset; |
1692 TSize offset; |
1790 offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY; |
1693 offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY; |
1791 offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX; |
1694 offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX; |
1792 TSize size( iconRect.Width(), iconRect.Height()); |
1695 TSize size( iconRect.Width(), iconRect.Height()); |