# HG changeset patch # User qifeima <> # Date 1275562630 -28800 # Node ID 18b321db488405e9ee60c50067c4f4037e5c439f # Parent edfc90759b9f90465d5de8760fdda915f536f911 *m enhance diff -r edfc90759b9f -r 18b321db4884 group/bld.inf --- a/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 +++ b/group/bld.inf Thu Jun 03 18:57:10 2010 +0800 @@ -20,9 +20,11 @@ #include #include "../imgeditor_plat/group/bld.inf" +#include "../imageeditorengine/group/bld.inf" #include "../imageeditor/group/bld.inf" -#include "../imageeditorengine/group/bld.inf" + PRJ_EXPORTS +PRJ_MMPFILES diff -r edfc90759b9f -r 18b321db4884 imageeditor/ImageEditorManager/src/ImageEditorPluginScanner.cpp --- a/imageeditor/ImageEditorManager/src/ImageEditorPluginScanner.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/ImageEditorManager/src/ImageEditorPluginScanner.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -178,7 +178,7 @@ if( scanCount == matchCount && matchCount == iStorage->CountPlugins() ) { LOG(KImageEditorLogFile, "CPluginScanner: plug-in storage up to date"); - return EFalse; // no update needed + return ETrue; // no update needed } else { diff -r edfc90759b9f -r 18b321db4884 imageeditor/ImageEditorUI/bwins/ImageEditorUI.DEF --- a/imageeditor/ImageEditorUI/bwins/ImageEditorUI.DEF Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/ImageEditorUI/bwins/ImageEditorUI.DEF Thu Jun 03 18:57:10 2010 +0800 @@ -1,129 +1,130 @@ -EXPORTS - ?LaunchSendQueryL@CImageEditorUIView@@QBEXABVTSendingCapabilities@@AAVRFile@@@Z @ 1 NONAME ; void CImageEditorUIView::LaunchSendQueryL(class TSendingCapabilities const &, class RFile &) const - ?ShowToolTip@SDrawUtils@@SAXPAVCAknInfoPopupNoteController@@PAVCCoeControl@@VTPoint@@W4TGulAlignmentValue@@ABVTDesC16@@@Z @ 2 NONAME ; void SDrawUtils::ShowToolTip(class CAknInfoPopupNoteController *, class CCoeControl *, class TPoint, enum TGulAlignmentValue, class TDesC16 const &) - ?LaunchSaveChangesQueryL@CImageEditorUIView@@QBEHXZ @ 3 NONAME ; int CImageEditorUIView::LaunchSaveChangesQueryL(void) const - ?LaunchExitWithoutSavingQueryL@CImageEditorUIView@@QBEHXZ @ 4 NONAME ; int CImageEditorUIView::LaunchExitWithoutSavingQueryL(void) const - ?SetImageL@CImageEditorControlBase@@UAEXPAVCFbsBitmap@@@Z @ 5 NONAME ; void CImageEditorControlBase::SetImageL(class CFbsBitmap *) - ?SetSliderPosition@CSingleParamControl@@QAEXH@Z @ 6 NONAME ; void CSingleParamControl::SetSliderPosition(int) - ?SetSaveFlag@CImageEditorUIView@@QAEXH@Z @ 7 NONAME ; void CImageEditorUIView::SetSaveFlag(int) - ?LaunchProgressNoteL@SDrawUtils@@SAXPAPAVCAknProgressDialog@@HABVTDesC16@@HPAVMProgressDialogCallback@@@Z @ 8 NONAME ; void SDrawUtils::LaunchProgressNoteL(class CAknProgressDialog * *, int, class TDesC16 const &, int, class MProgressDialogCallback *) - ?GetTouchPanDirections@CImageEditorUIView@@QAEXAAH0@Z @ 9 NONAME ; void CImageEditorUIView::GetTouchPanDirections(int &, int &) - ?CountComponentControls@CImageEditorControlBase@@UBEHXZ @ 10 NONAME ; int CImageEditorControlBase::CountComponentControls(void) const - ?SetBusy@CImageEditorControlBase@@UAEXXZ @ 11 NONAME ; void CImageEditorControlBase::SetBusy(void) - ?SetCaption@CSingleParamControl@@QAEXABVTDesC16@@@Z @ 12 NONAME ; void CSingleParamControl::SetCaption(class TDesC16 const &) - ?LaunchLoadWaitDialogL@CImageEditorUIView@@QBEXPAPAVCAknWaitDialog@@PAVMProgressDialogCallback@@@Z @ 13 NONAME ; void CImageEditorUIView::LaunchLoadWaitDialogL(class CAknWaitDialog * *, class MProgressDialogCallback *) const - ?LaunchListQueryDialogL@SDrawUtils@@SAHPAVMDesC16Array@@ABVTDesC16@@@Z @ 14 NONAME ; int SDrawUtils::LaunchListQueryDialogL(class MDesC16Array *, class TDesC16 const &) - ??0CImageEditorControlBase@@QAE@XZ @ 15 NONAME ; CImageEditorControlBase::CImageEditorControlBase(void) - ?GetDimmedMenuItems@CImageEditorControlBase@@UAE?AVTBitField@@XZ @ 16 NONAME ; class TBitField CImageEditorControlBase::GetDimmedMenuItems(void) - ?SetView@CSingleParamControl@@UAEXPAVCAknView@@@Z @ 17 NONAME ; void CSingleParamControl::SetView(class CAknView *) - ?Draw@CSingleParamControl@@EBEXABVTRect@@@Z @ 18 NONAME ; void CSingleParamControl::Draw(class TRect const &) const - ?HandleStatusPaneSizeChange@CImageEditorUIView@@UAEXXZ @ 19 NONAME ; void CImageEditorUIView::HandleStatusPaneSizeChange(void) - ?DynInitMenuPaneL@CImageEditorUIView@@UAEXHPAVCEikMenuPane@@@Z @ 20 NONAME ; void CImageEditorUIView::DynInitMenuPaneL(int, class CEikMenuPane *) - ?DoDeactivate@CImageEditorUIView@@EAEXXZ @ 21 NONAME ; void CImageEditorUIView::DoDeactivate(void) - ?SetImageL@CImageEditorControlBase@@UAEXPBVCFbsBitmap@@@Z @ 22 NONAME ; void CImageEditorControlBase::SetImageL(class CFbsBitmap const *) - ?GetSoftkeyIndexL@CImageEditorControlBase@@UAEHXZ @ 23 NONAME ; int CImageEditorControlBase::GetSoftkeyIndexL(void) - ?LaunchColorSelectionGridL@SDrawUtils@@SAHAAVTRgb@@@Z @ 24 NONAME ; int SDrawUtils::LaunchColorSelectionGridL(class TRgb &) - ?AddPluginUiItemL@CImageEditorUIView@@QAEXPBVCPluginInfo@@@Z @ 25 NONAME ; void CImageEditorUIView::AddPluginUiItemL(class CPluginInfo const *) - ?SetUndoFlag@CImageEditorUIView@@QAEXH@Z @ 26 NONAME ; void CImageEditorUIView::SetUndoFlag(int) - ?SetFullScreen@CImageEditorUIView@@QAEXXZ @ 27 NONAME ; void CImageEditorUIView::SetFullScreen(void) - ?ResetBusy@CImageEditorUIView@@QAEXXZ @ 28 NONAME ; void CImageEditorUIView::ResetBusy(void) - ??1CColorSelectionGrid@@UAE@XZ @ 29 NONAME ; CColorSelectionGrid::~CColorSelectionGrid(void) - ??1CSingleParamControl@@UAE@XZ @ 30 NONAME ; CSingleParamControl::~CSingleParamControl(void) - ?ResetFullScreen@CImageEditorUIView@@QAEXXZ @ 31 NONAME ; void CImageEditorUIView::ResetFullScreen(void) - ?Id@CImageEditorUIView@@UBE?AVTUid@@XZ @ 32 NONAME ; class TUid CImageEditorUIView::Id(void) const - ?SetTitlePaneTextL@CImageEditorUIView@@QAEXABVTDesC16@@@Z @ 33 NONAME ; void CImageEditorUIView::SetTitlePaneTextL(class TDesC16 const &) - ?DrawGuide@SDrawUtils@@SAXAAVCGraphicsContext@@ABVTRect@@W4TGuideType@1@ABVTRgb@@@Z @ 34 NONAME ; void SDrawUtils::DrawGuide(class CGraphicsContext &, class TRect const &, enum SDrawUtils::TGuideType, class TRgb const &) - ?ShowConfirmationNoteL@CImageEditorUIView@@QBEXABVTDesC16@@@Z @ 35 NONAME ; void CImageEditorUIView::ShowConfirmationNoteL(class TDesC16 const &) const - ?InZoomingState@CImageEditorUIView@@QAEHXZ @ 36 NONAME ; int CImageEditorUIView::InZoomingState(void) - ?ConstructL@CPreviewControlBase@@UAEXABVTRect@@PAVCCoeControl@@@Z @ 37 NONAME ; void CPreviewControlBase::ConstructL(class TRect const &, class CCoeControl *) - ??0CColorSelectionGrid@@QAE@XZ @ 38 NONAME ; CColorSelectionGrid::CColorSelectionGrid(void) - ??0CSingleParamControl@@QAE@XZ @ 39 NONAME ; CSingleParamControl::CSingleParamControl(void) - ?CountImageSizesAndPositions@CSingleParamControl@@AAEXXZ @ 40 NONAME ; void CSingleParamControl::CountImageSizesAndPositions(void) - ?SetSelectedUiItemL@CSingleParamControl@@UAEXPAVCPluginInfo@@@Z @ 41 NONAME ; void CSingleParamControl::SetSelectedUiItemL(class CPluginInfo *) - ?SizeChanged@CSingleParamControl@@UAEXXZ @ 42 NONAME ; void CSingleParamControl::SizeChanged(void) - ?NewL@CSingleParamControl@@SAPAV1@ABVTRect@@PAVCCoeControl@@H@Z @ 43 NONAME ; class CSingleParamControl * CSingleParamControl::NewL(class TRect const &, class CCoeControl *, int) - ?ComponentControl@CImageEditorControlBase@@UBEPAVCCoeControl@@H@Z @ 44 NONAME ; class CCoeControl * CImageEditorControlBase::ComponentControl(int) const - ?ConstructL@CImageEditorUIView@@QAEXXZ @ 45 NONAME ; void CImageEditorUIView::ConstructL(void) - ?LaunchColorSelectionPopupL@SDrawUtils@@SAHPBVCFbsBitmap@@VTRect@@AAVTRgb@@@Z @ 46 NONAME ; int SDrawUtils::LaunchColorSelectionPopupL(class CFbsBitmap const *, class TRect, class TRgb &) - ?GetNaviPaneTextL@CImageEditorControlBase@@UAE?AVTPtrC16@@AAH0@Z @ 47 NONAME ; class TPtrC16 CImageEditorControlBase::GetNaviPaneTextL(int &, int &) - ?ConstructL@CColorSelectionGrid@@UAEXPBVCCoeControl@@H@Z @ 48 NONAME ; void CColorSelectionGrid::ConstructL(class CCoeControl const *, int) - ?SetSliderMinimumAndMaximum@CSingleParamControl@@QAEXHH@Z @ 49 NONAME ; void CSingleParamControl::SetSliderMinimumAndMaximum(int, int) - ?HandleCommandL@CImageEditorUIView@@UAEXH@Z @ 50 NONAME ; void CImageEditorUIView::HandleCommandL(int) - ?ViewScreenModeCompatible@CImageEditorUIView@@MAEHH@Z @ 51 NONAME ; int CImageEditorUIView::ViewScreenModeCompatible(int) - ?SizeChanged@CImageEditorControlBase@@MAEXXZ @ 52 NONAME ; void CImageEditorControlBase::SizeChanged(void) - ?OfferKeyEventL@CSingleParamControl@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 53 NONAME ; enum TKeyResponse CSingleParamControl::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) - ?ResetBusy@CImageEditorControlBase@@UAEXXZ @ 54 NONAME ; void CImageEditorControlBase::ResetBusy(void) - ??1CMultiLineQueryDialog@@UAE@XZ @ 55 NONAME ; CMultiLineQueryDialog::~CMultiLineQueryDialog(void) - ?SetImageL@CImageEditorUIView@@QAEXPAVCFbsBitmap@@@Z @ 56 NONAME ; void CImageEditorUIView::SetImageL(class CFbsBitmap *) - ?LaunchTextQueryDialogL@SDrawUtils@@SAHAAVTDes16@@ABVTDesC16@@@Z @ 57 NONAME ; int SDrawUtils::LaunchTextQueryDialogL(class TDes16 &, class TDesC16 const &) - ??0CImageEditorUIView@@QAE@XZ @ 58 NONAME ; CImageEditorUIView::CImageEditorUIView(void) - ?SetMiddleSoftKeyL@CImageEditorUIView@@QAEXABVTDesC16@@H@Z @ 59 NONAME ; void CImageEditorUIView::SetMiddleSoftKeyL(class TDesC16 const &, int) - ?HandlePluginCommandL@CSingleParamControl@@UAEXH@Z @ 60 NONAME ; void CSingleParamControl::HandlePluginCommandL(int) - ?HandleClientRectChange@CImageEditorUIView@@QAEXXZ @ 61 NONAME ; void CImageEditorUIView::HandleClientRectChange(void) - ?DrawBeveledRect@SDrawUtils@@SAXAAVCGraphicsContext@@ABVTRect@@ABVTRgb@@22@Z @ 62 NONAME ; void SDrawUtils::DrawBeveledRect(class CGraphicsContext &, class TRect const &, class TRgb const &, class TRgb const &, class TRgb const &) - ?OfferKeyEventL@CMultiLineQueryDialog@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 63 NONAME ; enum TKeyResponse CMultiLineQueryDialog::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) - ??1CImageEditorControlBase@@UAE@XZ @ 64 NONAME ; CImageEditorControlBase::~CImageEditorControlBase(void) - ?ClearTitlePaneTextL@CImageEditorUIView@@QAEXXZ @ 65 NONAME ; void CImageEditorUIView::ClearTitlePaneTextL(void) - ?DoActivateL@CImageEditorUIView@@EAEXABVTVwsViewId@@VTUid@@ABVTDesC8@@@Z @ 66 NONAME ; void CImageEditorUIView::DoActivateL(class TVwsViewId const &, class TUid, class TDesC8 const &) - ??0CMultiLineQueryDialog@@AAE@AAVTDes16@@ABW4TTone@CAknQueryDialog@@@Z @ 67 NONAME ; CMultiLineQueryDialog::CMultiLineQueryDialog(class TDes16 &, enum CAknQueryDialog::TTone const &) - ?OfferKeyEventL@CImageEditorControlBase@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 68 NONAME ; enum TKeyResponse CImageEditorControlBase::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) - ?SetSoftKey2L@CImageEditorUIView@@QAEXABVTDesC16@@H@Z @ 69 NONAME ; void CImageEditorUIView::SetSoftKey2L(class TDesC16 const &, int) - ?GetSoftkeyIndexL@CSingleParamControl@@UAEHXZ @ 70 NONAME ; int CSingleParamControl::GetSoftkeyIndexL(void) - ?LaunchSaveWaitDialogL@CImageEditorUIView@@QBEXPAPAVCAknProgressDialog@@HPAVMProgressDialogCallback@@@Z @ 71 NONAME ; void CImageEditorUIView::LaunchSaveWaitDialogL(class CAknProgressDialog * *, int, class MProgressDialogCallback *) const - ??1CImageEditorUIView@@UAE@XZ @ 72 NONAME ; CImageEditorUIView::~CImageEditorUIView(void) - ?GetNaviPaneTextL@CSingleParamControl@@UAE?AVTPtrC16@@AAH0@Z @ 73 NONAME ; class TPtrC16 CSingleParamControl::GetNaviPaneTextL(int &, int &) - ?SetImageL@CPreviewControlBase@@UAEXPAVCFbsBitmap@@@Z @ 74 NONAME ; void CPreviewControlBase::SetImageL(class CFbsBitmap *) - ??1CPreviewControlBase@@UAE@XZ @ 75 NONAME ; CPreviewControlBase::~CPreviewControlBase(void) - ?LaunchQueryDialogL@SDrawUtils@@SAHABVTDesC16@@@Z @ 76 NONAME ; int SDrawUtils::LaunchQueryDialogL(class TDesC16 const &) - ?SetParObserver@CSingleParamControl@@QAEXPAVMSingleParControlObserver@@@Z @ 77 NONAME ; void CSingleParamControl::SetParObserver(class MSingleParControlObserver *) - ?NewL@CPreviewControlBase@@SAPAV1@ABVTRect@@PAVCCoeControl@@@Z @ 78 NONAME ; class CPreviewControlBase * CPreviewControlBase::NewL(class TRect const &, class CCoeControl *) - ?LaunchSaveImageQueryL@CImageEditorUIView@@QBEHXZ @ 79 NONAME ; int CImageEditorUIView::LaunchSaveImageQueryL(void) const - ?ComponentControl@CSingleParamControl@@UBEPAVCCoeControl@@H@Z @ 80 NONAME ; class CCoeControl * CSingleParamControl::ComponentControl(int) const - ?SetView@CImageEditorControlBase@@UAEXPAVCAknView@@@Z @ 81 NONAME ; void CImageEditorControlBase::SetView(class CAknView *) - ?HandlePointerEventL@CSingleParamControl@@UAEXABUTPointerEvent@@@Z @ 82 NONAME ; void CSingleParamControl::HandlePointerEventL(struct TPointerEvent const &) - ?LaunchMultiLineTextQueryDialogL@SDrawUtils@@SAHAAVTDes16@@ABVTDesC16@@@Z @ 83 NONAME ; int SDrawUtils::LaunchMultiLineTextQueryDialogL(class TDes16 &, class TDesC16 const &) - ?NewL@CMultiLineQueryDialog@@SAPAV1@AAVTDes16@@ABW4TTone@CAknQueryDialog@@@Z @ 84 NONAME ; class CMultiLineQueryDialog * CMultiLineQueryDialog::NewL(class TDes16 &, enum CAknQueryDialog::TTone const &) - ?ActivatePluginL@CImageEditorUIView@@QAEXPAVCCoeControl@@@Z @ 85 NONAME ; void CImageEditorUIView::ActivatePluginL(class CCoeControl *) - ?Draw@CImageEditorControlBase@@EBEXABVTRect@@@Z @ 86 NONAME ; void CImageEditorControlBase::Draw(class TRect const &) const - ?DrawFlatRect@SDrawUtils@@SAXAAVCGraphicsContext@@ABVTRect@@ABVTRgb@@22@Z @ 87 NONAME ; void SDrawUtils::DrawFlatRect(class CGraphicsContext &, class TRect const &, class TRgb const &, class TRgb const &, class TRgb const &) - ?CountComponentControls@CSingleParamControl@@UBEHXZ @ 88 NONAME ; int CSingleParamControl::CountComponentControls(void) const - ?LaunchCancelTextInputQueryL@CImageEditorUIView@@QBEHXZ @ 89 NONAME ; int CImageEditorUIView::LaunchCancelTextInputQueryL(void) const - ?SetIcon@CSingleParamControl@@QAEXPAVCEikImage@@@Z @ 90 NONAME ; void CSingleParamControl::SetIcon(class CEikImage *) - ?UpdateLayoutL@CImageEditorUIView@@QBEXH@Z @ 91 NONAME ; void CImageEditorUIView::UpdateLayoutL(int) const - ?SetImageL@CPreviewControlBase@@UAEXPBVCFbsBitmap@@@Z @ 92 NONAME ; void CPreviewControlBase::SetImageL(class CFbsBitmap const *) - ?ShowInformationNoteL@CImageEditorUIView@@QBEXABVTDesC16@@@Z @ 93 NONAME ; void CImageEditorUIView::ShowInformationNoteL(class TDesC16 const &) const - ?SetImageFileName@CImageEditorUIView@@QAEXABVTDesC16@@@Z @ 94 NONAME ; void CImageEditorUIView::SetImageFileName(class TDesC16 const &) - ?SetSendAppUi@CImageEditorUIView@@QAEXPAVCSendUi@@@Z @ 95 NONAME ; void CImageEditorUIView::SetSendAppUi(class CSendUi *) - ?SetSelectedUiItemL@CImageEditorControlBase@@UAEXPAVCPluginInfo@@@Z @ 96 NONAME ; void CImageEditorControlBase::SetSelectedUiItemL(class CPluginInfo *) - ?LaunchWaitNoteL@SDrawUtils@@SAXPAPAVCAknWaitDialog@@HABVTDesC16@@PAVMProgressDialogCallback@@@Z @ 97 NONAME ; void SDrawUtils::LaunchWaitNoteL(class CAknWaitDialog * *, int, class TDesC16 const &, class MProgressDialogCallback *) - ?ConstructL@CImageEditorControlBase@@UAEXABVTRect@@PAVCCoeControl@@@Z @ 98 NONAME ; void CImageEditorControlBase::ConstructL(class TRect const &, class CCoeControl *) - ?SetZoomModeL@CImageEditorUIView@@QAEXABW4TZoomMode@@@Z @ 99 NONAME ; void CImageEditorUIView::SetZoomModeL(enum TZoomMode const &) - ?MoveSlider@CSingleParamControl@@AAEXH@Z @ 100 NONAME ; void CSingleParamControl::MoveSlider(int) - ?Draw@CPreviewControlBase@@EBEXABVTRect@@@Z @ 101 NONAME ; void CPreviewControlBase::Draw(class TRect const &) const - ?SetSliderStepAmount@CSingleParamControl@@QAEXE@Z @ 102 NONAME ; void CSingleParamControl::SetSliderStepAmount(unsigned char) - ?SetNaviPaneTextL@CImageEditorUIView@@QAEXABVTDesC16@@HH@Z @ 103 NONAME ; void CImageEditorUIView::SetNaviPaneTextL(class TDesC16 const &, int, int) - ?SetCustomButtonsL@CImageEditorUIView@@QBEXH@Z @ 104 NONAME ; void CImageEditorUIView::SetCustomButtonsL(int) const - ?GetIndicatorBitmapL@SDrawUtils@@SAHAAPAVCFbsBitmap@@0HH@Z @ 105 NONAME ; int SDrawUtils::GetIndicatorBitmapL(class CFbsBitmap * &, class CFbsBitmap * &, int, int) - ?HandlePluginCommandL@CImageEditorControlBase@@UAEXH@Z @ 106 NONAME ; void CImageEditorControlBase::HandlePluginCommandL(int) - ?Busy@CImageEditorControlBase@@UBEHXZ @ 107 NONAME ; int CImageEditorControlBase::Busy(void) const - ?ActivateMainViewL@CImageEditorUIView@@QAEXXZ @ 108 NONAME ; void CImageEditorUIView::ActivateMainViewL(void) - ?GetSelectedPluginInfoL@CImageEditorUIView@@QAEPAVCPluginInfo@@XZ @ 109 NONAME ; class CPluginInfo * CImageEditorUIView::GetSelectedPluginInfoL(void) - ?HandlePointerEventL@CImageEditorControlBase@@MAEXABUTPointerEvent@@@Z @ 110 NONAME ; void CImageEditorControlBase::HandlePointerEventL(struct TPointerEvent const &) - ?SetSliderStep@CSingleParamControl@@QAEXI@Z @ 111 NONAME ; void CSingleParamControl::SetSliderStep(unsigned int) - ?LaunchWaitDialog@CImageEditorUIView@@QBEXXZ @ 112 NONAME ; void CImageEditorUIView::LaunchWaitDialog(void) const - ?GetContextMenuResourceId@CImageEditorControlBase@@UAEHXZ @ 113 NONAME ; int CImageEditorControlBase::GetContextMenuResourceId(void) - ?LaunchQueryDialogOkOnlyL@SDrawUtils@@SAHABVTDesC16@@@Z @ 114 NONAME ; int SDrawUtils::LaunchQueryDialogOkOnlyL(class TDesC16 const &) - ?DrawPreviewImage@CPreviewControlBase@@UBEXABVTRect@@@Z @ 115 NONAME ; void CPreviewControlBase::DrawPreviewImage(class TRect const &) const - ?HideWaitDialog@CImageEditorUIView@@QBEXXZ @ 116 NONAME ; void CImageEditorUIView::HideWaitDialog(void) const - ?PrepareL@CImageEditorControlBase@@UAEXXZ @ 117 NONAME ; void CImageEditorControlBase::PrepareL(void) - ?LaunchSendQueryL@CImageEditorUIView@@QBEXABVTSendingCapabilities@@AAV?$TBuf@$0BAA@@@@Z @ 118 NONAME ; void CImageEditorUIView::LaunchSendQueryL(class TSendingCapabilities const &, class TBuf<256> &) const - ?ClearNaviPaneTextL@CImageEditorUIView@@QAEXXZ @ 119 NONAME ; void CImageEditorUIView::ClearNaviPaneTextL(void) - ?SizeChanged@CColorSelectionGrid@@MAEXXZ @ 120 NONAME ; void CColorSelectionGrid::SizeChanged(void) - ?ConstructL@CSingleParamControl@@UAEXABVTRect@@PAVCCoeControl@@H@Z @ 121 NONAME ; void CSingleParamControl::ConstructL(class TRect const &, class CCoeControl *, int) - ?ShowToolTip@SDrawUtils@@SAXPAVCAknInfoPopupNoteController@@PAVCCoeControl@@VTRect@@ABVTDesC16@@@Z @ 122 NONAME ; void SDrawUtils::ShowToolTip(class CAknInfoPopupNoteController *, class CCoeControl *, class TRect, class TDesC16 const &) - ?SetSoftKey1L@CImageEditorUIView@@QAEXABVTDesC16@@H@Z @ 123 NONAME ; void CImageEditorUIView::SetSoftKey1L(class TDesC16 const &, int) - ?SetBusy@CImageEditorUIView@@QAEXXZ @ 124 NONAME ; void CImageEditorUIView::SetBusy(void) - ?Position@CSingleParamControl@@QBEHXZ @ 125 NONAME ; int CSingleParamControl::Position(void) const - ?GetContainer@CImageEditorUIView@@QBEPAVCCoeControl@@XZ @ 126 NONAME ; class CCoeControl * CImageEditorUIView::GetContainer(void) const - ?IsMemoryInCriticalLevel@CImageEditorUIView@@QAEHXZ @ 127 NONAME ; int CImageEditorUIView::IsMemoryInCriticalLevel(void) - +EXPORTS + ?ShowToolTip@SDrawUtils@@SAXPAVCAknInfoPopupNoteController@@PAVCCoeControl@@VTPoint@@W4TGulAlignmentValue@@ABVTDesC16@@@Z @ 1 NONAME ; void SDrawUtils::ShowToolTip(class CAknInfoPopupNoteController *, class CCoeControl *, class TPoint, enum TGulAlignmentValue, class TDesC16 const &) + ?LaunchExitWithoutSavingQueryL@CImageEditorUIView@@QBEHXZ @ 2 NONAME ; int CImageEditorUIView::LaunchExitWithoutSavingQueryL(void) const + ?SetSliderPosition@CSingleParamControl@@QAEXH@Z @ 3 NONAME ; void CSingleParamControl::SetSliderPosition(int) + ?LaunchProgressNoteL@SDrawUtils@@SAXPAPAVCAknProgressDialog@@HABVTDesC16@@HPAVMProgressDialogCallback@@@Z @ 4 NONAME ; void SDrawUtils::LaunchProgressNoteL(class CAknProgressDialog * *, int, class TDesC16 const &, int, class MProgressDialogCallback *) + ?IsMemoryInCriticalLevel@CImageEditorUIView@@QAEHXZ @ 5 NONAME ; int CImageEditorUIView::IsMemoryInCriticalLevel(void) + ?GetTouchPanDirections@CImageEditorUIView@@QAEXAAH0@Z @ 6 NONAME ; void CImageEditorUIView::GetTouchPanDirections(int &, int &) + ?CountComponentControls@CImageEditorControlBase@@UBEHXZ @ 7 NONAME ; int CImageEditorControlBase::CountComponentControls(void) const + ?SetCaption@CSingleParamControl@@QAEXABVTDesC16@@@Z @ 8 NONAME ; void CSingleParamControl::SetCaption(class TDesC16 const &) + ?LaunchLoadWaitDialogL@CImageEditorUIView@@QBEXPAPAVCAknWaitDialog@@PAVMProgressDialogCallback@@@Z @ 9 NONAME ; void CImageEditorUIView::LaunchLoadWaitDialogL(class CAknWaitDialog * *, class MProgressDialogCallback *) const + ?LaunchListQueryDialogL@SDrawUtils@@SAHPAVMDesC16Array@@ABVTDesC16@@@Z @ 10 NONAME ; int SDrawUtils::LaunchListQueryDialogL(class MDesC16Array *, class TDesC16 const &) + ??0CImageEditorControlBase@@QAE@XZ @ 11 NONAME ; CImageEditorControlBase::CImageEditorControlBase(void) + ?GetDimmedMenuItems@CImageEditorControlBase@@UAE?AVTBitField@@XZ @ 12 NONAME ; class TBitField CImageEditorControlBase::GetDimmedMenuItems(void) + ?Draw@CSingleParamControl@@EBEXABVTRect@@@Z @ 13 NONAME ; void CSingleParamControl::Draw(class TRect const &) const + ?DoDeactivate@CImageEditorUIView@@EAEXXZ @ 14 NONAME ; void CImageEditorUIView::DoDeactivate(void) + ?LaunchColorSelectionGridL@SDrawUtils@@SAHAAVTRgb@@@Z @ 15 NONAME ; int SDrawUtils::LaunchColorSelectionGridL(class TRgb &) + ?ResetBusy@CImageEditorUIView@@QAEXXZ @ 16 NONAME ; void CImageEditorUIView::ResetBusy(void) + ?ResetFullScreen@CImageEditorUIView@@QAEXXZ @ 17 NONAME ; void CImageEditorUIView::ResetFullScreen(void) + ?Id@CImageEditorUIView@@UBE?AVTUid@@XZ @ 18 NONAME ; class TUid CImageEditorUIView::Id(void) const + ?SetTitlePaneTextL@CImageEditorUIView@@QAEXABVTDesC16@@@Z @ 19 NONAME ; void CImageEditorUIView::SetTitlePaneTextL(class TDesC16 const &) + ?CountImageSizesAndPositions@CSingleParamControl@@AAEXXZ @ 20 NONAME ; void CSingleParamControl::CountImageSizesAndPositions(void) + ?SizeChanged@CSingleParamControl@@UAEXXZ @ 21 NONAME ; void CSingleParamControl::SizeChanged(void) + ?NewL@CSingleParamControl@@SAPAV1@ABVTRect@@PAVCCoeControl@@H@Z @ 22 NONAME ; class CSingleParamControl * CSingleParamControl::NewL(class TRect const &, class CCoeControl *, int) + ?ComponentControl@CImageEditorControlBase@@UBEPAVCCoeControl@@H@Z @ 23 NONAME ; class CCoeControl * CImageEditorControlBase::ComponentControl(int) const + ?LaunchColorSelectionPopupL@SDrawUtils@@SAHPBVCFbsBitmap@@VTRect@@AAVTRgb@@@Z @ 24 NONAME ; int SDrawUtils::LaunchColorSelectionPopupL(class CFbsBitmap const *, class TRect, class TRgb &) + ?GetNaviPaneTextL@CImageEditorControlBase@@UAE?AVTPtrC16@@AAH0@Z @ 25 NONAME ; class TPtrC16 CImageEditorControlBase::GetNaviPaneTextL(int &, int &) + ?OfferKeyEventL@CSingleParamControl@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 26 NONAME ; enum TKeyResponse CSingleParamControl::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?ResetBusy@CImageEditorControlBase@@UAEXXZ @ 27 NONAME ; void CImageEditorControlBase::ResetBusy(void) + ??1CMultiLineQueryDialog@@UAE@XZ @ 28 NONAME ; CMultiLineQueryDialog::~CMultiLineQueryDialog(void) + ?SetMiddleSoftKeyL@CImageEditorUIView@@QAEXABVTDesC16@@H@Z @ 29 NONAME ; void CImageEditorUIView::SetMiddleSoftKeyL(class TDesC16 const &, int) + ?HandlePluginCommandL@CSingleParamControl@@UAEXH@Z @ 30 NONAME ; void CSingleParamControl::HandlePluginCommandL(int) + ?DrawBeveledRect@SDrawUtils@@SAXAAVCGraphicsContext@@ABVTRect@@ABVTRgb@@22@Z @ 31 NONAME ; void SDrawUtils::DrawBeveledRect(class CGraphicsContext &, class TRect const &, class TRgb const &, class TRgb const &, class TRgb const &) + ?OfferKeyEventL@CMultiLineQueryDialog@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 32 NONAME ; enum TKeyResponse CMultiLineQueryDialog::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?ClearTitlePaneTextL@CImageEditorUIView@@QAEXXZ @ 33 NONAME ; void CImageEditorUIView::ClearTitlePaneTextL(void) + ?SetSoftKey2L@CImageEditorUIView@@QAEXABVTDesC16@@H@Z @ 34 NONAME ; void CImageEditorUIView::SetSoftKey2L(class TDesC16 const &, int) + ??1CImageEditorUIView@@UAE@XZ @ 35 NONAME ; CImageEditorUIView::~CImageEditorUIView(void) + ?GetNaviPaneTextL@CSingleParamControl@@UAE?AVTPtrC16@@AAH0@Z @ 36 NONAME ; class TPtrC16 CSingleParamControl::GetNaviPaneTextL(int &, int &) + ??1CPreviewControlBase@@UAE@XZ @ 37 NONAME ; CPreviewControlBase::~CPreviewControlBase(void) + ?LaunchQueryDialogL@SDrawUtils@@SAHABVTDesC16@@@Z @ 38 NONAME ; int SDrawUtils::LaunchQueryDialogL(class TDesC16 const &) + ?LaunchSaveImageQueryL@CImageEditorUIView@@QBEHXZ @ 39 NONAME ; int CImageEditorUIView::LaunchSaveImageQueryL(void) const + ?ComponentControl@CSingleParamControl@@UBEPAVCCoeControl@@H@Z @ 40 NONAME ; class CCoeControl * CSingleParamControl::ComponentControl(int) const + ?SetView@CImageEditorControlBase@@UAEXPAVCAknView@@@Z @ 41 NONAME ; void CImageEditorControlBase::SetView(class CAknView *) + ?LaunchMultiLineTextQueryDialogL@SDrawUtils@@SAHAAVTDes16@@ABVTDesC16@@@Z @ 42 NONAME ; int SDrawUtils::LaunchMultiLineTextQueryDialogL(class TDes16 &, class TDesC16 const &) + ?ActivatePluginL@CImageEditorUIView@@QAEXPAVCCoeControl@@@Z @ 43 NONAME ; void CImageEditorUIView::ActivatePluginL(class CCoeControl *) + ?CountComponentControls@CSingleParamControl@@UBEHXZ @ 44 NONAME ; int CSingleParamControl::CountComponentControls(void) const + ?SetIcon@CSingleParamControl@@QAEXPAVCEikImage@@@Z @ 45 NONAME ; void CSingleParamControl::SetIcon(class CEikImage *) + ?UpdateLayoutL@CImageEditorUIView@@QBEXH@Z @ 46 NONAME ; void CImageEditorUIView::UpdateLayoutL(int) const + ?MoveSlider@CSingleParamControl@@AAEXH@Z @ 47 NONAME ; void CSingleParamControl::MoveSlider(int) + ?Draw@CPreviewControlBase@@EBEXABVTRect@@@Z @ 48 NONAME ; void CPreviewControlBase::Draw(class TRect const &) const + ?SetNaviPaneTextL@CImageEditorUIView@@QAEXABVTDesC16@@HH@Z @ 49 NONAME ; void CImageEditorUIView::SetNaviPaneTextL(class TDesC16 const &, int, int) + ?HandlePluginCommandL@CImageEditorControlBase@@UAEXH@Z @ 50 NONAME ; void CImageEditorControlBase::HandlePluginCommandL(int) + ?Busy@CImageEditorControlBase@@UBEHXZ @ 51 NONAME ; int CImageEditorControlBase::Busy(void) const + ?HandlePointerEventL@CImageEditorControlBase@@MAEXABUTPointerEvent@@@Z @ 52 NONAME ; void CImageEditorControlBase::HandlePointerEventL(struct TPointerEvent const &) + ?SetSliderStep@CSingleParamControl@@QAEXI@Z @ 53 NONAME ; void CSingleParamControl::SetSliderStep(unsigned int) + ?LaunchWaitDialog@CImageEditorUIView@@QBEXXZ @ 54 NONAME ; void CImageEditorUIView::LaunchWaitDialog(void) const + ?GetContextMenuResourceId@CImageEditorControlBase@@UAEHXZ @ 55 NONAME ; int CImageEditorControlBase::GetContextMenuResourceId(void) + ?DrawPreviewImage@CPreviewControlBase@@UBEXABVTRect@@@Z @ 56 NONAME ; void CPreviewControlBase::DrawPreviewImage(class TRect const &) const + ?HideWaitDialog@CImageEditorUIView@@QBEXXZ @ 57 NONAME ; void CImageEditorUIView::HideWaitDialog(void) const + ?PrepareL@CImageEditorControlBase@@UAEXXZ @ 58 NONAME ; void CImageEditorControlBase::PrepareL(void) + ?LaunchSendQueryL@CImageEditorUIView@@QBEXABVTSendingCapabilities@@AAV?$TBuf@$0BAA@@@@Z @ 59 NONAME ; void CImageEditorUIView::LaunchSendQueryL(class TSendingCapabilities const &, class TBuf<256> &) const + ?ClearNaviPaneTextL@CImageEditorUIView@@QAEXXZ @ 60 NONAME ; void CImageEditorUIView::ClearNaviPaneTextL(void) + ?SetSoftKey1L@CImageEditorUIView@@QAEXABVTDesC16@@H@Z @ 61 NONAME ; void CImageEditorUIView::SetSoftKey1L(class TDesC16 const &, int) + ?SetBusy@CImageEditorUIView@@QAEXXZ @ 62 NONAME ; void CImageEditorUIView::SetBusy(void) + ?Position@CSingleParamControl@@QBEHXZ @ 63 NONAME ; int CSingleParamControl::Position(void) const + ?GetContainer@CImageEditorUIView@@QBEPAVCCoeControl@@XZ @ 64 NONAME ; class CCoeControl * CImageEditorUIView::GetContainer(void) const + ?LaunchSendQueryL@CImageEditorUIView@@QBEXABVTSendingCapabilities@@AAVRFile@@@Z @ 65 NONAME ; void CImageEditorUIView::LaunchSendQueryL(class TSendingCapabilities const &, class RFile &) const + ?LaunchSaveChangesQueryL@CImageEditorUIView@@QBEHXZ @ 66 NONAME ; int CImageEditorUIView::LaunchSaveChangesQueryL(void) const + ?SetImageL@CImageEditorControlBase@@UAEXPAVCFbsBitmap@@@Z @ 67 NONAME ; void CImageEditorControlBase::SetImageL(class CFbsBitmap *) + ?SetSaveFlag@CImageEditorUIView@@QAEXH@Z @ 68 NONAME ; void CImageEditorUIView::SetSaveFlag(int) + ?SetBusy@CImageEditorControlBase@@UAEXXZ @ 69 NONAME ; void CImageEditorControlBase::SetBusy(void) + ?SetView@CSingleParamControl@@UAEXPAVCAknView@@@Z @ 70 NONAME ; void CSingleParamControl::SetView(class CAknView *) + ?HandleStatusPaneSizeChange@CImageEditorUIView@@UAEXXZ @ 71 NONAME ; void CImageEditorUIView::HandleStatusPaneSizeChange(void) + ?DynInitMenuPaneL@CImageEditorUIView@@UAEXHPAVCEikMenuPane@@@Z @ 72 NONAME ; void CImageEditorUIView::DynInitMenuPaneL(int, class CEikMenuPane *) + ?SetImageL@CImageEditorControlBase@@UAEXPBVCFbsBitmap@@@Z @ 73 NONAME ; void CImageEditorControlBase::SetImageL(class CFbsBitmap const *) + ?GetSoftkeyIndexL@CImageEditorControlBase@@UAEHXZ @ 74 NONAME ; int CImageEditorControlBase::GetSoftkeyIndexL(void) + ?AddPluginUiItemL@CImageEditorUIView@@QAEXPBVCPluginInfo@@@Z @ 75 NONAME ; void CImageEditorUIView::AddPluginUiItemL(class CPluginInfo const *) + ??1CColorSelectionGrid@@UAE@XZ @ 76 NONAME ; CColorSelectionGrid::~CColorSelectionGrid(void) + ?SetFullScreen@CImageEditorUIView@@QAEXXZ @ 77 NONAME ; void CImageEditorUIView::SetFullScreen(void) + ?SetUndoFlag@CImageEditorUIView@@QAEXH@Z @ 78 NONAME ; void CImageEditorUIView::SetUndoFlag(int) + ??1CSingleParamControl@@UAE@XZ @ 79 NONAME ; CSingleParamControl::~CSingleParamControl(void) + ?DrawGuide@SDrawUtils@@SAXAAVCGraphicsContext@@ABVTRect@@W4TGuideType@1@ABVTRgb@@@Z @ 80 NONAME ; void SDrawUtils::DrawGuide(class CGraphicsContext &, class TRect const &, enum SDrawUtils::TGuideType, class TRgb const &) + ?InZoomingState@CImageEditorUIView@@QAEHXZ @ 81 NONAME ; int CImageEditorUIView::InZoomingState(void) + ?ShowConfirmationNoteL@CImageEditorUIView@@QBEXABVTDesC16@@@Z @ 82 NONAME ; void CImageEditorUIView::ShowConfirmationNoteL(class TDesC16 const &) const + ?ConstructL@CPreviewControlBase@@UAEXABVTRect@@PAVCCoeControl@@@Z @ 83 NONAME ; void CPreviewControlBase::ConstructL(class TRect const &, class CCoeControl *) + ??0CColorSelectionGrid@@QAE@XZ @ 84 NONAME ; CColorSelectionGrid::CColorSelectionGrid(void) + ??0CSingleParamControl@@QAE@XZ @ 85 NONAME ; CSingleParamControl::CSingleParamControl(void) + ?SetSelectedUiItemL@CSingleParamControl@@UAEXPAVCPluginInfo@@@Z @ 86 NONAME ; void CSingleParamControl::SetSelectedUiItemL(class CPluginInfo *) + ?ConstructL@CImageEditorUIView@@QAEXXZ @ 87 NONAME ; void CImageEditorUIView::ConstructL(void) + ?ConstructL@CColorSelectionGrid@@UAEXPBVCCoeControl@@H@Z @ 88 NONAME ; void CColorSelectionGrid::ConstructL(class CCoeControl const *, int) + ?HandleCommandL@CImageEditorUIView@@UAEXH@Z @ 89 NONAME ; void CImageEditorUIView::HandleCommandL(int) + ?SetSliderMinimumAndMaximum@CSingleParamControl@@QAEXHH@Z @ 90 NONAME ; void CSingleParamControl::SetSliderMinimumAndMaximum(int, int) + ?ViewScreenModeCompatible@CImageEditorUIView@@MAEHH@Z @ 91 NONAME ; int CImageEditorUIView::ViewScreenModeCompatible(int) + ?SizeChanged@CImageEditorControlBase@@MAEXXZ @ 92 NONAME ; void CImageEditorControlBase::SizeChanged(void) + ?SetImageL@CImageEditorUIView@@QAEXPAVCFbsBitmap@@@Z @ 93 NONAME ; void CImageEditorUIView::SetImageL(class CFbsBitmap *) + ??0CImageEditorUIView@@QAE@XZ @ 94 NONAME ; CImageEditorUIView::CImageEditorUIView(void) + ?LaunchTextQueryDialogL@SDrawUtils@@SAHAAVTDes16@@ABVTDesC16@@@Z @ 95 NONAME ; int SDrawUtils::LaunchTextQueryDialogL(class TDes16 &, class TDesC16 const &) + ?HandleClientRectChange@CImageEditorUIView@@QAEXXZ @ 96 NONAME ; void CImageEditorUIView::HandleClientRectChange(void) + ??1CImageEditorControlBase@@UAE@XZ @ 97 NONAME ; CImageEditorControlBase::~CImageEditorControlBase(void) + ?DoActivateL@CImageEditorUIView@@EAEXABVTVwsViewId@@VTUid@@ABVTDesC8@@@Z @ 98 NONAME ; void CImageEditorUIView::DoActivateL(class TVwsViewId const &, class TUid, class TDesC8 const &) + ??0CMultiLineQueryDialog@@AAE@AAVTDes16@@ABW4TTone@CAknQueryDialog@@@Z @ 99 NONAME ; CMultiLineQueryDialog::CMultiLineQueryDialog(class TDes16 &, enum CAknQueryDialog::TTone const &) + ?IsDrawPlugin@CImageEditorUIContainer@@QAEXH@Z @ 100 NONAME ; void CImageEditorUIContainer::IsDrawPlugin(int) + ?OfferKeyEventL@CImageEditorControlBase@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 101 NONAME ; enum TKeyResponse CImageEditorControlBase::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?GetSoftkeyIndexL@CSingleParamControl@@UAEHXZ @ 102 NONAME ; int CSingleParamControl::GetSoftkeyIndexL(void) + ?LaunchSaveWaitDialogL@CImageEditorUIView@@QBEXPAPAVCAknProgressDialog@@HPAVMProgressDialogCallback@@@Z @ 103 NONAME ; void CImageEditorUIView::LaunchSaveWaitDialogL(class CAknProgressDialog * *, int, class MProgressDialogCallback *) const + ?SetImageL@CPreviewControlBase@@UAEXPAVCFbsBitmap@@@Z @ 104 NONAME ; void CPreviewControlBase::SetImageL(class CFbsBitmap *) + ?SetParObserver@CSingleParamControl@@QAEXPAVMSingleParControlObserver@@@Z @ 105 NONAME ; void CSingleParamControl::SetParObserver(class MSingleParControlObserver *) + ?NewL@CPreviewControlBase@@SAPAV1@ABVTRect@@PAVCCoeControl@@@Z @ 106 NONAME ; class CPreviewControlBase * CPreviewControlBase::NewL(class TRect const &, class CCoeControl *) + ?HandlePointerEventL@CSingleParamControl@@UAEXABUTPointerEvent@@@Z @ 107 NONAME ; void CSingleParamControl::HandlePointerEventL(struct TPointerEvent const &) + ?NewL@CMultiLineQueryDialog@@SAPAV1@AAVTDes16@@ABW4TTone@CAknQueryDialog@@@Z @ 108 NONAME ; class CMultiLineQueryDialog * CMultiLineQueryDialog::NewL(class TDes16 &, enum CAknQueryDialog::TTone const &) + ?DrawFlatRect@SDrawUtils@@SAXAAVCGraphicsContext@@ABVTRect@@ABVTRgb@@22@Z @ 109 NONAME ; void SDrawUtils::DrawFlatRect(class CGraphicsContext &, class TRect const &, class TRgb const &, class TRgb const &, class TRgb const &) + ?Draw@CImageEditorControlBase@@EBEXABVTRect@@@Z @ 110 NONAME ; void CImageEditorControlBase::Draw(class TRect const &) const + ?LaunchCancelTextInputQueryL@CImageEditorUIView@@QBEHXZ @ 111 NONAME ; int CImageEditorUIView::LaunchCancelTextInputQueryL(void) const + ?SetImageL@CPreviewControlBase@@UAEXPBVCFbsBitmap@@@Z @ 112 NONAME ; void CPreviewControlBase::SetImageL(class CFbsBitmap const *) + ?SetImageFileName@CImageEditorUIView@@QAEXABVTDesC16@@@Z @ 113 NONAME ; void CImageEditorUIView::SetImageFileName(class TDesC16 const &) + ?ShowInformationNoteL@CImageEditorUIView@@QBEXABVTDesC16@@@Z @ 114 NONAME ; void CImageEditorUIView::ShowInformationNoteL(class TDesC16 const &) const + ?ConstructL@CImageEditorControlBase@@UAEXABVTRect@@PAVCCoeControl@@@Z @ 115 NONAME ; void CImageEditorControlBase::ConstructL(class TRect const &, class CCoeControl *) + ?LaunchWaitNoteL@SDrawUtils@@SAXPAPAVCAknWaitDialog@@HABVTDesC16@@PAVMProgressDialogCallback@@@Z @ 116 NONAME ; void SDrawUtils::LaunchWaitNoteL(class CAknWaitDialog * *, int, class TDesC16 const &, class MProgressDialogCallback *) + ?SetSelectedUiItemL@CImageEditorControlBase@@UAEXPAVCPluginInfo@@@Z @ 117 NONAME ; void CImageEditorControlBase::SetSelectedUiItemL(class CPluginInfo *) + ?SetSendAppUi@CImageEditorUIView@@QAEXPAVCSendUi@@@Z @ 118 NONAME ; void CImageEditorUIView::SetSendAppUi(class CSendUi *) + ?SetZoomModeL@CImageEditorUIView@@QAEXABW4TZoomMode@@@Z @ 119 NONAME ; void CImageEditorUIView::SetZoomModeL(enum TZoomMode const &) + ?SetCustomButtonsL@CImageEditorUIView@@QBEXH@Z @ 120 NONAME ; void CImageEditorUIView::SetCustomButtonsL(int) const + ?SetSliderStepAmount@CSingleParamControl@@QAEXE@Z @ 121 NONAME ; void CSingleParamControl::SetSliderStepAmount(unsigned char) + ?GetIndicatorBitmapL@SDrawUtils@@SAHAAPAVCFbsBitmap@@0HH@Z @ 122 NONAME ; int SDrawUtils::GetIndicatorBitmapL(class CFbsBitmap * &, class CFbsBitmap * &, int, int) + ?ActivateMainViewL@CImageEditorUIView@@QAEXXZ @ 123 NONAME ; void CImageEditorUIView::ActivateMainViewL(void) + ?GetSelectedPluginInfoL@CImageEditorUIView@@QAEPAVCPluginInfo@@XZ @ 124 NONAME ; class CPluginInfo * CImageEditorUIView::GetSelectedPluginInfoL(void) + ?LaunchQueryDialogOkOnlyL@SDrawUtils@@SAHABVTDesC16@@@Z @ 125 NONAME ; int SDrawUtils::LaunchQueryDialogOkOnlyL(class TDesC16 const &) + ?SizeChanged@CColorSelectionGrid@@MAEXXZ @ 126 NONAME ; void CColorSelectionGrid::SizeChanged(void) + ?ConstructL@CSingleParamControl@@UAEXABVTRect@@PAVCCoeControl@@H@Z @ 127 NONAME ; void CSingleParamControl::ConstructL(class TRect const &, class CCoeControl *, int) + ?ShowToolTip@SDrawUtils@@SAXPAVCAknInfoPopupNoteController@@PAVCCoeControl@@VTRect@@ABVTDesC16@@@Z @ 128 NONAME ; void SDrawUtils::ShowToolTip(class CAknInfoPopupNoteController *, class CCoeControl *, class TRect, class TDesC16 const &) + diff -r edfc90759b9f -r 18b321db4884 imageeditor/ImageEditorUI/group/ImageEditorUI.mmp --- a/imageeditor/ImageEditorUI/group/ImageEditorUI.mmp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/ImageEditorUI/group/ImageEditorUI.mmp Thu Jun 03 18:57:10 2010 +0800 @@ -69,7 +69,6 @@ SOURCE ImageEditorUIView.cpp SOURCE ImageEditorUIContainer.cpp SOURCE ImageEditorControlBase.cpp -SOURCE PreviewControlBase.cpp SOURCE SingleParamControl.cpp SOURCE ColorSelectionGrid.cpp SOURCE DrawUtils.cpp @@ -77,7 +76,7 @@ SOURCE WaitIndicator.cpp SOURCE TControlItem.cpp SOURCE ColorSelectionPopup.cpp -SOURCE CMultiLineQueryDialog.cpp +SOURCE CMultiLineQueryDialog.cpp PreviewControlBase.cpp USERINCLUDE . USERINCLUDE ../inc diff -r edfc90759b9f -r 18b321db4884 imageeditor/ImageEditorUI/inc/ImageEditorUIContainer.h --- a/imageeditor/ImageEditorUI/inc/ImageEditorUIContainer.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/ImageEditorUI/inc/ImageEditorUIContainer.h Thu Jun 03 18:57:10 2010 +0800 @@ -54,11 +54,17 @@ /** @name Methods:*/ //@{ + /* IsDrawPlugin + * + * Judge if it is draw plug-in. + * @return - + */ + IMPORT_C void IsDrawPlugin(TBool aFlag); /* Second phase constructor * * @param aRect - frame rectangle for container * @return - */ + */ void ConstructL (const TRect & aRect); /* Destructor @@ -116,8 +122,7 @@ * @param aKeyEvent - the key event * @return - */ - virtual void CImageEditorUIContainer::HandlePointerEventL( - const TPointerEvent &aPointerEvent ); + virtual void CImageEditorUIContainer::HandlePointerEventL(const TPointerEvent &aPointerEvent); /* CountComponentControls * @@ -246,11 +251,6 @@ */ virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); - -//@} - -/** @name Members:*/ -//@{ //@} private: @@ -308,6 +308,8 @@ TInt iXDirChange; TInt iYDirChange; + //for draw plguin + TBool iIsDrawPlugin; // Wait indicator (own) CWaitIndicator* iWaitIndicator; diff -r edfc90759b9f -r 18b321db4884 imageeditor/ImageEditorUI/src/ColorSelectionPopup.cpp --- a/imageeditor/ImageEditorUI/src/ColorSelectionPopup.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/ImageEditorUI/src/ColorSelectionPopup.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -264,8 +264,6 @@ CWindowGc& gc = SystemGc(); - CPreviewControlBase::DrawPreviewImage (Rect()); - // Change brush to null to enable transparent drawing gc.SetBrushStyle (CGraphicsContext::ENullBrush); @@ -904,7 +902,6 @@ { if( AknLayoutUtils::PenEnabled() ) { - TBool draw( EFalse ); switch( aPointerEvent.iType ) { case TPointerEvent::EButton1Down: @@ -920,7 +917,6 @@ } #endif /* RD_TACTILE_FEEDBACK */ iPopup->HandlePointerEventL( aPointerEvent ); - draw = ETrue; } break; } @@ -936,7 +932,6 @@ } #endif /* RD_TACTILE_FEEDBACK */ iPopup->HandlePointerEventL( aPointerEvent ); - draw = ETrue; } break; } @@ -954,11 +949,6 @@ break; } } - - if ( draw ) - { - DrawDeferred(); - } } } diff -r edfc90759b9f -r 18b321db4884 imageeditor/ImageEditorUI/src/ImageEditorUIContainer.cpp --- a/imageeditor/ImageEditorUI/src/ImageEditorUIContainer.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/ImageEditorUI/src/ImageEditorUIContainer.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -67,6 +67,12 @@ ActivateL(); } +//judge if it is draw plug-in +EXPORT_C void CImageEditorUIContainer::IsDrawPlugin(TBool aFlag) + { + iIsDrawPlugin = aFlag; + } + //============================================================================= CImageEditorUIContainer::~CImageEditorUIContainer() { @@ -95,7 +101,10 @@ if (iControl) { ((CImageEditorControlBase *)iControl)->SetView(iEditorView); - iControl->SetRect(Rect() ); + if(!iIsDrawPlugin) + { + iControl->SetRect(Rect() ); + } } DrawDeferred(); } @@ -111,8 +120,7 @@ } //============================================================================= -TKeyResponse CImageEditorUIContainer::OfferKeyEventL( - const TKeyEvent & aKeyEvent, TEventCode aType) +TKeyResponse CImageEditorUIContainer::OfferKeyEventL(const TKeyEvent & aKeyEvent, TEventCode aType) { if (Busy() ) { @@ -123,8 +131,7 @@ TKeyResponse res = EKeyWasNotConsumed; if (iControl) { - res = ((CCoeControl*)iControl)->OfferKeyEventL(aKeyEvent, - aType); + res = ((CCoeControl*)iControl)->OfferKeyEventL(aKeyEvent,aType); } return res; } @@ -147,8 +154,7 @@ } //============================================================================= -void CImageEditorUIContainer::HandlePointerEventL( - const TPointerEvent &aPointerEvent) +void CImageEditorUIContainer::HandlePointerEventL(const TPointerEvent &aPointerEvent) { if (Busy() ) { @@ -162,12 +168,10 @@ } else { - switch (aPointerEvent.iType) { case TPointerEvent::EButton1Down: - { - + { #ifdef RD_TACTILE_FEEDBACK if ( iTouchFeedBack ) { @@ -175,8 +179,7 @@ RDebug::Printf( "ImageEditor::ImageEditorUIContainer: ETouchFeedback" ); } #endif /* RD_TACTILE_FEEDBACK */ - - if ( !iEditorView->InZoomingState() ) + if ( !iEditorView->InZoomingState() ) { iEditorView->HandleCommandL(EImageEditorMenuCmdApplyEffect); } @@ -188,21 +191,17 @@ } case TPointerEvent::EDrag: { - iXDirChange = iTappedPosition.iX - - aPointerEvent.iPosition.iX; - iYDirChange = iTappedPosition.iY - - aPointerEvent.iPosition.iY; + iXDirChange = iTappedPosition.iX - aPointerEvent.iPosition.iX; + iYDirChange = iTappedPosition.iY - aPointerEvent.iPosition.iY; // Compare total change in pixels (absolute value) to // threshold value. This is to prevent calling engine's // Pan-function in every minimal movement - if ( (Abs(iXDirChange) + Abs(iYDirChange) ) - > KTouchPanTotalMoveThreshold) + if ( (Abs(iXDirChange) + Abs(iYDirChange) ) > KTouchPanTotalMoveThreshold ) { iTappedPosition = aPointerEvent.iPosition; iEditorView->HandleCommandL(EImageEditorCmdTouchPan); } - break; } case TPointerEvent::EButton1Up: @@ -216,11 +215,8 @@ break; } } - } - } - } //============================================================================= @@ -314,17 +310,14 @@ MAknsControlContext* cc = AknsDrawUtils::ControlContext( this); AknsDrawUtils::DrawBackground(skin, cc, this, gc, TPoint(0, 0), Rect(), KAknsDrawParamDefault); - } } - iWaitIndicator->DrawItem(gc); } //============================================================================= void CImageEditorUIContainer::HandleControlEventL(CCoeControl * /*aControl*/, - TCoeEvent /*aEventType*/ -) + TCoeEvent /*aEventType*/) { } diff -r edfc90759b9f -r 18b321db4884 imageeditor/ImageEditorUI/src/ImageEditorUIView.cpp --- a/imageeditor/ImageEditorUI/src/ImageEditorUIView.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/ImageEditorUI/src/ImageEditorUIView.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -1,29 +1,25 @@ /* -* Copyright (c) 2010 Ixonos Plc. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* Ixonos Plc -* -* Description: -* Image Editor's view class that handles all view related issues. -* -*/ - - - + * Copyright (c) 2010 Ixonos Plc. + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - Initial contribution + * + * Contributors: + * Ixonos Plc + * + * Description: + * Image Editor's view class that handles all view related issues. + * + */ // INCLUDE FILES #include #include #include - #include #include #include @@ -36,36 +32,30 @@ #include #include #include - #include #include #include #include #include - #include #include "ImageEditorUI.hrh" #include "ImageEditorUIPanics.h" #include "ImageEditorUIView.h" #include "ImageEditorUIContainer.h" #include "ImageEditorUtils.h" - #include "DrawUtils.h" #include "PluginInfo.h" #include "ResolutionUtil.h" - #include "ImageEditorControlBase.h" #include "SingleParamControl.h" #include "imageeditordebugutils.h" #include "plugingrid.h" -//#include "platform_security_literals.hrh" - +#include "text.rsg" #ifdef AIW_PRINT_PROVIDER_USED #include #include #include #endif - // CONSTANTS _LIT (KResourceDir, "\\resource\\apps\\"); _LIT (KResourceFile, "imageeditorui.rsc"); @@ -80,1436 +70,1384 @@ #define LANDSCAPE_ARG(x) #endif - //============================================================================= EXPORT_C void CImageEditorUIView::ConstructL() -{ - LOG(KImageEditorLogFile, "CImageEditorUIView::ConstructL()"); + { + LOG(KImageEditorLogFile, "CImageEditorUIView::ConstructL()"); - // Read resource + // Read resource TFileName resourcefile; resourcefile.Append(KResourceDir); resourcefile.Append(KResourceFile); - User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); - // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile - // to search for a localised resource in proper search order - iResLoader.OpenL ( resourcefile ); - - // Construct base view - BaseConstructL (R_IMAGEEDITORUI_VIEW); + User::LeaveIfError(CompleteWithAppPath(resourcefile)); + // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile + // to search for a localised resource in proper search order + iResLoader.OpenL(resourcefile); + + // Construct base view + BaseConstructL(R_IMAGEEDITORUI_VIEW); - // Get reference to status pane - CEikStatusPane * sp = AppUi()->StatusPane(); + // Get reference to status pane + CEikStatusPane * sp = AppUi()->StatusPane(); - // Get reference to navi pane - iNaviPane = - (CAknNavigationControlContainer *) sp->ControlL (TUid::Uid (EEikStatusPaneUidNavi)); + // Get reference to navi pane + iNaviPane = (CAknNavigationControlContainer *) sp->ControlL(TUid::Uid( + EEikStatusPaneUidNavi)); - // Get reference to title pane - iTitlePane = - (CAknTitlePane *) sp->ControlL (TUid::Uid (EEikStatusPaneUidTitle)); + // Get reference to title pane + iTitlePane = (CAknTitlePane *) sp->ControlL(TUid::Uid( + EEikStatusPaneUidTitle)); // Initialize soft key ID:s (needs to be changed if cba resource in // R_IMAGEEDITORUI_VIEW changes) iSoftkey1 = EAknSoftkeyEmpty; iSoftkey2 = EAknSoftkeyEmpty; iMSK = EAknSoftkeyEmpty; - - iInPlugin = EFalse; - - iPopupController = CAknInfoPopupNoteController::NewL(); - + + iInPlugin = EFalse; + + iPopupController = CAknInfoPopupNoteController::NewL(); + // Read strings needed for zoom popup - HBufC8 * res8 = CEikonEnv::Static()->AllocReadResourceAsDes8LC ( R_ZOOM_TEXTS ); - TResourceReader resource; - //Set resource reader buffer - resource.SetBuffer( res8 ); + HBufC8 * res8 = CEikonEnv::Static()->AllocReadResourceAsDes8LC(R_ZOOM_TEXTS); + TResourceReader resource; + //Set resource reader buffer + resource.SetBuffer(res8); + + //Read zoom text count + TInt16 arraycount = (TInt16) resource.ReadInt16(); + + // There have to be as many zoom texts as there are zoom states + __ASSERT_ALWAYS( arraycount == ENumOfZooms, User::Panic(KComponentName, + EImageEditorPanicZoomTextCountDoesntMatch) ); - //Read zoom text count - TInt16 arraycount = ( TInt16 )resource.ReadInt16(); - - // There have to be as many zoom texts as there are zoom states - __ASSERT_ALWAYS( arraycount == ENumOfZooms, User::Panic(KComponentName, - EImageEditorPanicZoomTextCountDoesntMatch) ); - - if ( arraycount > 0 ) - { - //Construct a new descriptor array - if ( !iZoomTexts ) - { - iZoomTexts = new ( ELeave ) CDesCArraySeg( 16 ); - } + if (arraycount > 0) + { + //Construct a new descriptor array + if (!iZoomTexts) + { + iZoomTexts = new (ELeave) CDesCArraySeg(16); + } - //Read text to array - for ( TInt i = 0; i < arraycount; ++i ) - { - //Construct a flat descriptor array and read all the texts - HBufC * parameter = resource.ReadHBufCL(); - CleanupStack::PushL( parameter ); - TPtrC ptr = parameter->Des(); - iZoomTexts->AppendL ( ptr ); - CleanupStack::PopAndDestroy(); // parameter - } - } - CleanupStack::PopAndDestroy (); // res8 + //Read text to array + for (TInt i = 0; i < arraycount; ++i) + { + //Construct a flat descriptor array and read all the texts + HBufC * parameter = resource.ReadHBufCL(); + CleanupStack::PushL(parameter); + TPtrC ptr = parameter->Des(); + iZoomTexts->AppendL(ptr); + CleanupStack::PopAndDestroy(); // parameter + } + } + CleanupStack::PopAndDestroy(); // res8 #ifdef AIW_PRINT_PROVIDER_USED - iServiceHandler = CAiwServiceHandler::NewL(); + iServiceHandler = CAiwServiceHandler::NewL(); // Attach menu services. - iServiceHandler->AttachMenuL(R_IMAGEEDITORUI_MENUPANE, R_IMAGE_EDITOR_INTEREST); + iServiceHandler->AttachMenuL(R_IMAGEEDITORUI_MENUPANE, + R_IMAGE_EDITOR_INTEREST); #endif - LOG(KImageEditorLogFile, "CImageEditorUIView: Constructred succesfully"); -} + LOG(KImageEditorLogFile, "CImageEditorUIView: Constructred succesfully"); + } //============================================================================= EXPORT_C CImageEditorUIView::CImageEditorUIView() : -CAknView (), -iResLoader ( *iEikonEnv ), -iBusy(ETrue), -iContainerInStack(EFalse) -{ - -} + CAknView(), iResLoader(*iEikonEnv), iBusy(ETrue), iContainerInStack(EFalse) + { + } //============================================================================= EXPORT_C CImageEditorUIView::~CImageEditorUIView() -{ + { LOG(KImageEditorLogFile, "CImageEditorUIView::~CImageEditorUIView()"); iResLoader.Close(); #ifdef AIW_PRINT_PROVIDER_USED - delete iServiceHandler; + delete iServiceHandler; #endif - if (iNaviPane && iNaviDecorator) - { - iNaviPane->Pop (iNaviDecorator); - delete iNaviDecorator; - iNaviDecorator = 0; - } - iNaviDecorator = 0; - - if ( iNaviPane && iPreviousNaviDecorator ) - { - iNaviPane->Pop ( iPreviousNaviDecorator ); - delete iPreviousNaviDecorator; - iPreviousNaviDecorator = 0; - } - iPreviousNaviDecorator = 0; - + if (iNaviPane && iNaviDecorator) + { + iNaviPane->Pop(iNaviDecorator); + delete iNaviDecorator; + iNaviDecorator = 0; + } + iNaviDecorator = 0; + + if (iNaviPane && iPreviousNaviDecorator) + { + iNaviPane->Pop(iPreviousNaviDecorator); + delete iPreviousNaviDecorator; + iPreviousNaviDecorator = 0; + } + iPreviousNaviDecorator = 0; + RemoveContainerFromStack(); - if ( iContainer ) - { - delete iContainer; - iContainer = 0; - } - - iArray.Reset(); + if (iContainer) + { + delete iContainer; + iContainer = 0; + } + + iArray.Reset(); + + iNaviPane = NULL; + iTitlePane = NULL; + iControl = NULL; + iPreview = NULL; + iSendAppUi = NULL; - iNaviPane = NULL; - iTitlePane = NULL; - iControl = NULL; - iPreview = NULL; - iSendAppUi = NULL; - - if ( iPopupController ) - { - delete iPopupController; - } - - if ( iZoomTexts ) - { - iZoomTexts->Reset(); - delete iZoomTexts; - } - + if (iPopupController) + { + delete iPopupController; + } + + if (iZoomTexts) + { + iZoomTexts->Reset(); + delete iZoomTexts; + } + LOG(KImageEditorLogFile, "CImageEditorUIView: View deleted"); -} + } //============================================================================= EXPORT_C TUid CImageEditorUIView::Id() const -{ - return KViewId; -} + { + return KViewId; + } //============================================================================= -EXPORT_C void CImageEditorUIView::UpdateLayoutL ( TInt LANDSCAPE_ARG(aScreenMode) ) const - { - CEikStatusPane* sp = StatusPane(); - __ASSERT_ALWAYS( sp, User::Panic(KComponentName, EImageEditorPanicStatusPaneNotAccessible) ); +EXPORT_C void CImageEditorUIView::UpdateLayoutL(TInt LANDSCAPE_ARG(aScreenMode)) const + { + CEikStatusPane* sp = StatusPane(); + __ASSERT_ALWAYS( sp, User::Panic(KComponentName, EImageEditorPanicStatusPaneNotAccessible) ); #ifdef LANDSCAPE_SUPPORT - TPixelsAndRotation rotation; - iEikonEnv->ScreenDevice()->GetScreenModeSizeAndRotation(aScreenMode, rotation); + TPixelsAndRotation rotation; + iEikonEnv->ScreenDevice()->GetScreenModeSizeAndRotation(aScreenMode,rotation); LOGFMT2(KImageEditorLogFile, "CImageEditorUIView: View mode: ScreenMode: %d, Rotation: %d", aScreenMode, rotation.iRotation); - switch (rotation.iRotation) - { - case CFbsBitGc::EGraphicsOrientationRotated270: // view mode - { - LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated270"); + switch (rotation.iRotation) + { + case CFbsBitGc::EGraphicsOrientationRotated270: // view mode + { + LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated270"); #ifndef SWAP_SOFTKEY_POSITIONS - sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT); + sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT); #else - sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT); + sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT); #endif - break; - } + break; + } - case CFbsBitGc::EGraphicsOrientationRotated90: // camcorder mode - { - LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated90"); + case CFbsBitGc::EGraphicsOrientationRotated90: // camcorder mode + { + LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated90"); #ifndef SWAP_SOFTKEY_POSITIONS - sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT); + sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT); #else - sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT); + sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT); #endif - break; - } + break; + } - case CFbsBitGc::EGraphicsOrientationNormal: - default: - { - if( CResolutionUtil::Self()->GetLandscape() ) - { - sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL /*R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT*/ ); - } - else - { - sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); - } - break; - } - } + case CFbsBitGc::EGraphicsOrientationNormal: + default: + { + if (CResolutionUtil::Self()->GetLandscape()) + { + sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL /*R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT*/); + } + else + { + sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); + } + break; + } + } #endif - if (iFullScreen) - { - // Hide status pane - sp->MakeVisible (EFalse); - } - else - { - // Make status pane visible - sp->MakeVisible (ETrue); + if (iFullScreen) + { + // Hide status pane + sp->MakeVisible(EFalse); + } + else + { + // Make status pane visible + sp->MakeVisible(ETrue); #ifdef LANDSCAPE_SUPPORT - // And now the CBA... - TRect rect = ClientRect(); + // And now the CBA... + TRect rect = ClientRect(); - CEikButtonGroupContainer* cba = Cba(); - __ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) ); + CEikButtonGroupContainer* cba = Cba(); + __ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) ); - MEikButtonGroup* bgrp = cba->ButtonGroup(); - STATIC_CAST( CEikCba*, bgrp)->SetBoundingRect(rect); - cba->HandleResourceChange(KEikDynamicLayoutVariantSwitch); + MEikButtonGroup* bgrp = cba->ButtonGroup(); + STATIC_CAST( CEikCba*, bgrp)->SetBoundingRect(rect); + cba->HandleResourceChange(KEikDynamicLayoutVariantSwitch); #endif - } - - } + } + } //============================================================================= EXPORT_C TBool CImageEditorUIView::ViewScreenModeCompatible(TInt /*aScreenMode*/) - { - // Supports any screen size - return ETrue; - } - + { + // Supports any screen size + return ETrue; + } //============================================================================= -EXPORT_C void CImageEditorUIView::HandleCommandL (TInt aCommand) -{ +EXPORT_C void CImageEditorUIView::HandleCommandL(TInt aCommand) + { - // If focus is gained or lost - if ( (aCommand == EImageEditorFocusGained) || (aCommand == EImageEditorFocusLost) ) - { - if (iContainer && iControl) - { - ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand); + // If focus is gained or lost + if ((aCommand == EImageEditorFocusGained) || (aCommand + == EImageEditorFocusLost)) + { + if (iContainer && iControl) + { + ((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand); + } } - } - // If soft key 1 pressed - else if ( iInPlugin && (aCommand == iSoftkey1) && (aCommand != EAknSoftkeyOptions) ) - { - if ( iContainer && iContainer->Busy() ) - { + // If soft key 1 pressed + else if (iInPlugin && (aCommand == iSoftkey1) && (aCommand + != EAknSoftkeyOptions)) + { + if (iContainer && iContainer->Busy()) + { return; - } - else - { - ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand); - } - } - - // If soft key 2 pressed - else if ( iInPlugin && (aCommand == iSoftkey2) ) - { - if ( iContainer && iContainer->Busy() ) - { - return; + } + else + { + ((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand); + } } - else - { - ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand); - } - } - - // If msk pressed - else if ( iInPlugin && (aCommand == iMSK) ) - { - if ( iContainer && iContainer->Busy() ) - { + + // If soft key 2 pressed + else if (iInPlugin && (aCommand == iSoftkey2)) + { + if (iContainer && iContainer->Busy()) + { return; - } - else - { - ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand); + } + else + { + ((CImageEditorControlBase *) iControl)->HandlePluginCommandL( + aCommand); + } } - } - - // Menu plug-in item selected - else if ( iInPlugin && MenuItemPressedL(aCommand) ) - { - ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand); - } + + // If msk pressed + else if (iInPlugin && (aCommand == iMSK)) + { + if (iContainer && iContainer->Busy()) + { + return; + } + else + { + ((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand); + } + } - else - { - switch (aCommand) - { - case EImageEditorPreGlobalZoomChange: - case EImageEditorGlobalZoomChanged: - case EImageEditorGlobalCropChanged: - case EImageEditorPreGlobalPanChange: - case EImageEditorGlobalPanChanged: - case EImageEditorGlobalRotationChanged: + // Menu plug-in item selected + else if (iInPlugin && MenuItemPressedL(aCommand)) + { + ((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand); + } + + else + { + switch (aCommand) + { + case EImageEditorPreGlobalZoomChange: + case EImageEditorGlobalZoomChanged: + case EImageEditorGlobalCropChanged: + case EImageEditorPreGlobalPanChange: + case EImageEditorGlobalPanChanged: + case EImageEditorGlobalRotationChanged: case EImageEditorPreScreenModeChange: case EImageEditorPostScreenModeChange: - { - if (iInPlugin) - { - ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand); - } - return; - } - - case EAknSoftkeyBack: - { - if ( iContainer && iContainer->Busy() ) - { + { + if (iInPlugin) + { + ((CImageEditorControlBase *) iControl)->HandlePluginCommandL(aCommand); + } return; } - else - { - AppUi()->HandleCommandL (EImageEditorSoftkeyCmdBack); - break; - } - } - case EImageEditorUpdateSoftkeys: - { - if (iInPlugin) - { - UpdateSoftkeysL(); - } - break; - } - case EImageEditorUpdateNavipane: - { - if (iInPlugin) - { - UpdateNaviPaneL(); - } - break; - } - case EImageEditorTryDisplayMenuBar: - { - CEikMenuBar* menu = MenuBar(); - __ASSERT_ALWAYS( menu, User::Panic(KComponentName, EImageEditorPanicMenuNotAccessible) ); - menu->TryDisplayMenuBarL(); - break; - } - case EImageEditorDoPrint: - { + case EAknSoftkeyBack: + { + if (iContainer && iContainer->Busy()) + { + return; + } + else + { + AppUi()->HandleCommandL(EImageEditorSoftkeyCmdBack); + break; + } + } + case EImageEditorUpdateSoftkeys: + { + if (iInPlugin) + { + UpdateSoftkeysL(); + } + break; + } + case EImageEditorUpdateNavipane: + { + if (iInPlugin) + { + UpdateNaviPaneL(); + } + break; + } + case EImageEditorTryDisplayMenuBar: + { + CEikMenuBar* menu = MenuBar(); + __ASSERT_ALWAYS( menu, User::Panic(KComponentName, EImageEditorPanicMenuNotAccessible) ); + menu->TryDisplayMenuBarL(); + break; + } + case EImageEditorDoPrint: + { #ifdef AIW_PRINT_PROVIDER_USED - CAiwGenericParamList& in = iServiceHandler->InParamListL(); + CAiwGenericParamList& in = iServiceHandler->InParamListL(); - TFileName filename(iImageFileName); - TAiwVariant variant(filename); - TAiwGenericParam param(EGenericParamFile, variant); - - in.AppendL(param); + TFileName filename(iImageFileName); + TAiwVariant variant(filename); + TAiwGenericParam param(EGenericParamFile, variant); - iServiceHandler->ExecuteMenuCmdL( - iSelectedPrintMenuCmd, - in, - iServiceHandler->OutParamListL() - ); + in.AppendL(param); + + iServiceHandler->ExecuteMenuCmdL(iSelectedPrintMenuCmd, in, + iServiceHandler->OutParamListL()); #endif - break; - } - default: - { - // Print and save - if (aCommand >= EImageEditorMenuAiwPrintBase && - aCommand <= EImageEditorMenuAiwPrintLast) - { - iSelectedPrintMenuCmd = aCommand; - AppUi()->HandleCommandL (EImageEditorSaveAndPrint); - } - else - { - AppUi()->HandleCommandL (aCommand); - } - break; - } - } - } -} + break; + } + default: + { + // Print and save + if (aCommand >= EImageEditorMenuAiwPrintBase && aCommand + <= EImageEditorMenuAiwPrintLast) + { + iSelectedPrintMenuCmd = aCommand; + AppUi()->HandleCommandL(EImageEditorSaveAndPrint); + } + else + { + AppUi()->HandleCommandL(aCommand); + } + break; + } + } + } + } //============================================================================= EXPORT_C void CImageEditorUIView::HandleClientRectChange() -{ - LOG(KImageEditorLogFile, "CImageEditorUIView: Client rect changed"); + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Client rect changed"); - if (iContainer) - { - iContainer->SetRect ( ClientRect() ); - } -} + if (iContainer) + { + iContainer->SetRect(ClientRect()); + } + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetImageL (CFbsBitmap * aBitmap) -{ - iPreview = aBitmap; - if (iContainer) - { - iContainer->SetImageL (aBitmap); - } -} +EXPORT_C void CImageEditorUIView::SetImageL(CFbsBitmap * aBitmap) + { + iPreview = aBitmap; + if (iContainer) + { + iContainer->SetImageL(aBitmap); + } + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetImageFileName (const TDesC& aFileName) -{ - iImageFileName.Copy(aFileName); -} - - +EXPORT_C void CImageEditorUIView::SetImageFileName(const TDesC& aFileName) + { + iImageFileName.Copy(aFileName); + } //============================================================================= -EXPORT_C CCoeControl * CImageEditorUIView::GetContainer () const -{ +EXPORT_C CCoeControl * CImageEditorUIView::GetContainer() const + { return iContainer; -} + } //============================================================================= -EXPORT_C void CImageEditorUIView::ActivatePluginL (CCoeControl * aControl) -{ - LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin"); +EXPORT_C void CImageEditorUIView::ActivatePluginL(CCoeControl * aControl) + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin"); - // Activate the plugin based on UI type - switch ( iArray[iIndex]->PluginUiType() ) - { - case 1: // EPluginUiTypeNone - { - // For non-UI plug-ins active main view and render - iInPlugin = EFalse; - ActivateMainViewL(); - HandleCommandL (EImageEditorCmdRender); - break; + // Activate the plugin based on UI type + switch (iArray[iIndex]->PluginUiType()) + { + case 1: // EPluginUiTypeNone + { + // For non-UI plug-ins active main view and render + iInPlugin = EFalse; + ActivateMainViewL(); + HandleCommandL(EImageEditorCmdRender); + break; + } + case 2: // EPluginUiTypeSingleParam + case 3: // EPluginUiTypeMultiParam + case 4: // EPluginUiTypeCustomized + { + iInPlugin = ETrue; - } - case 2: // EPluginUiTypeSingleParam - case 3: // EPluginUiTypeMultiParam - case 4: // EPluginUiTypeCustomized - { - iInPlugin = ETrue; + // Set control + iControl = aControl; + if (iContainer) + { + iContainer->SetControl(iControl); + } - // Set control - iControl = aControl; - if (iContainer) - { - iContainer->SetControl (iControl); - } + // Set plug-in item + if (iControl) + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling SetSelectedUiItemL"); - // Set plug-in item - if (iControl) - { - LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling SetSelectedUiItemL"); + ((CImageEditorControlBase *) iControl)->SetSelectedUiItemL( iArray[iIndex]); + } - ((CImageEditorControlBase *)iControl)->SetSelectedUiItemL (iArray[iIndex]); - } + // Prepare the plug-in item + if (iControl) + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling "); - // Prepare the plug-in item - if (iControl) - { - LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling PrepareL"); + ((CImageEditorControlBase *) iControl)->PrepareL(); + } - ((CImageEditorControlBase *)iControl)->PrepareL (); - } + // Update soft keys + UpdateSoftkeysL(); - // Update soft keys - UpdateSoftkeysL(); + // Update navigation pane + UpdateNaviPaneL(); - // Update navigation pane - UpdateNaviPaneL(); - - break; - } - default: - { - iInPlugin = ETrue; + break; + } + default: + { + iInPlugin = ETrue; - // Set control - iControl = aControl; - if (iContainer) - { - iContainer->SetControl (iControl); - } - break; - } - } -} + // Set control + iControl = aControl; + if (iContainer) + { + iContainer->SetControl(iControl); + } + break; + } + } + } //============================================================================= EXPORT_C void CImageEditorUIView::ActivateMainViewL() -{ + { - LOG(KImageEditorLogFile, "CImageEditorUIView: Activating main view"); + LOG(KImageEditorLogFile, "CImageEditorUIView: Activating main view"); - iInPlugin = EFalse; + iInPlugin = EFalse; - // Reset buttons + // Reset buttons iSoftkey1 = EAknSoftkeyOptions; iSoftkey2 = EAknSoftkeyBack; iMSK = EImageEditorMenuCmdApplyEffect; - - if ( InZoomingState() ) - { - if ( iZoomMode == ( ENumOfZooms - 1 ) ) - { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL ); - } - else - { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN ); - } - } - else - { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY ); - } - // Reset navi pane - ClearNaviPaneTextL(); + if (InZoomingState()) + { + if (iZoomMode == (ENumOfZooms - 1)) + { + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL); + } + else + { + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN); + } + } + else + { + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY); + } - // Set control in container to NULL - iControl = 0; - if (iContainer) - { - iContainer->SetControl (iControl); - } - -} + // Reset navi pane + ClearNaviPaneTextL(); + + // Set control in container to NULL + iControl = 0; + if (iContainer) + { + iContainer->SetControl(iControl); + } + + } //============================================================================= -EXPORT_C CPluginInfo * CImageEditorUIView::GetSelectedPluginInfoL () -{ - TInt selectedItem; - TInt dialog_ok = CPluginSelectionDialog::RunDlgLD(&iPreview, selectedItem, &iArray, ClientRect()); +EXPORT_C CPluginInfo * CImageEditorUIView::GetSelectedPluginInfoL() + { + TInt selectedItem; + TInt dialog_ok = CPluginSelectionDialog::RunDlgLD(&iPreview, selectedItem, + &iArray, ClientRect()); - if (dialog_ok && selectedItem != KErrCancel) - { - iIndex = selectedItem; - return iArray[selectedItem]; - } - else - { - if ( InZoomingState() ) - { - if ( iZoomMode == ( ENumOfZooms - 1 ) ) - { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL ); - } - else - { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN ); - } - } - else - { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY ); - } - return NULL; - } -} + if (dialog_ok && selectedItem != KErrCancel) + { + iIndex = selectedItem; + return iArray[selectedItem]; + } + else + { + if (InZoomingState()) + { + if (iZoomMode == (ENumOfZooms - 1)) + { + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL); + } + else + { + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN); + } + } + else + { + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY); + } + return NULL; + } + } //============================================================================= -EXPORT_C void CImageEditorUIView::AddPluginUiItemL (const CPluginInfo * aPluginInfo) -{ - TLinearOrder order (CPluginInfo::ComparePluginOrder); - iArray.InsertInOrder (aPluginInfo, order); -} +EXPORT_C void CImageEditorUIView::AddPluginUiItemL( + const CPluginInfo * aPluginInfo) + { + TLinearOrder order(CPluginInfo::ComparePluginOrder); + iArray.InsertInOrder(aPluginInfo, order); + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetCustomButtonsL (TInt aResourceID) const -{ - LOG(KImageEditorLogFile, "CImageEditorUIView: Setting buttons"); +EXPORT_C void CImageEditorUIView::SetCustomButtonsL(TInt aResourceID) const + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Setting buttons"); - CEikButtonGroupContainer* cba = Cba(); - __ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) ); + CEikButtonGroupContainer* cba = Cba(); + __ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) ); - cba->SetCommandSetL (aResourceID); - cba->DrawDeferred(); -} + cba->SetCommandSetL(aResourceID); + cba->DrawDeferred(); + } //============================================================================= -EXPORT_C TInt CImageEditorUIView::LaunchSaveChangesQueryL () const -{ +EXPORT_C TInt CImageEditorUIView::LaunchSaveChangesQueryL() const + { // Create dialog prompt - HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_LIST_QUERY_SAVE_CONFIRMATION); - + HBufC * prompt = iEikonEnv->AllocReadResourceLC( + R_LIST_QUERY_SAVE_CONFIRMATION); + // Execute query dialog - TInt ret = SDrawUtils::LaunchQueryDialogL (*prompt); + TInt ret = SDrawUtils::LaunchQueryDialogL(*prompt); CleanupStack::PopAndDestroy(); // prompt return ret; -} + } //============================================================================= -EXPORT_C TInt CImageEditorUIView::LaunchExitWithoutSavingQueryL () const -{ +EXPORT_C TInt CImageEditorUIView::LaunchExitWithoutSavingQueryL() const + { // Create dialog prompt - HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_LIST_QUERY_EXIT_WITHOUT_SAVING_CONFIRMATION); - + HBufC * prompt = iEikonEnv->AllocReadResourceLC( + R_LIST_QUERY_EXIT_WITHOUT_SAVING_CONFIRMATION); + // Execute query dialog - TInt ret = SDrawUtils::LaunchQueryDialogL (*prompt); + TInt ret = SDrawUtils::LaunchQueryDialogL(*prompt); CleanupStack::PopAndDestroy(); // prompt return ret; -} + } //============================================================================= -EXPORT_C TInt CImageEditorUIView::LaunchCancelTextInputQueryL () const -{ - +EXPORT_C TInt CImageEditorUIView::LaunchCancelTextInputQueryL() const + { + // Create dialog prompt // At the moment query is not in use and corresponding string is removed // from the loc file. To enable this, a new string has to be defined. - HBufC * prompt = iEikonEnv->AllocReadResourceLC(R_LIST_QUERY_CANCEL_TEXT_INPUT); - + HBufC * prompt = iEikonEnv->AllocReadResourceLC( + R_LIST_QUERY_CANCEL_TEXT_INPUT); + // Execute query dialog - TInt ret = SDrawUtils::LaunchQueryDialogOkOnlyL (*prompt); + TInt ret = SDrawUtils::LaunchQueryDialogOkOnlyL(*prompt); CleanupStack::PopAndDestroy(); // save_conf, prompt return ret; -} + } //============================================================================= -EXPORT_C void CImageEditorUIView::LaunchSendQueryL ( - const TSendingCapabilities& aCaps, - TFileName& aFileName - ) const -{ - if (iSendAppUi) - { - CMessageData* msgData = CMessageData::NewLC(); - msgData->AppendAttachmentL(aFileName); +EXPORT_C void CImageEditorUIView::LaunchSendQueryL( + const TSendingCapabilities& aCaps, TFileName& aFileName) const + { + if (iSendAppUi) + { + CMessageData* msgData = CMessageData::NewLC(); + msgData->AppendAttachmentL(aFileName); - iSendAppUi->ShowQueryAndSendL (msgData, aCaps); + iSendAppUi->ShowQueryAndSendL(msgData, aCaps); CleanupStack::PopAndDestroy(msgData); - } -} + } + } //============================================================================= -EXPORT_C void CImageEditorUIView::LaunchSendQueryL ( - const TSendingCapabilities& aCaps, - RFile& aFileHandle - ) const -{ - if (iSendAppUi) - { - CMessageData* msgData = CMessageData::NewLC(); - msgData->AppendAttachmentHandleL(aFileHandle); +EXPORT_C void CImageEditorUIView::LaunchSendQueryL( + const TSendingCapabilities& aCaps, RFile& aFileHandle) const + { + if (iSendAppUi) + { + CMessageData* msgData = CMessageData::NewLC(); + msgData->AppendAttachmentHandleL(aFileHandle); - iSendAppUi->ShowQueryAndSendL (msgData, aCaps); + iSendAppUi->ShowQueryAndSendL(msgData, aCaps); CleanupStack::PopAndDestroy(msgData); - } -} - + } + } //============================================================================= EXPORT_C void CImageEditorUIView::LaunchSaveWaitDialogL( - CAknProgressDialog** aSelfPtr, - TInt aFinalValue, - MProgressDialogCallback* aCallback - ) const -{ + CAknProgressDialog** aSelfPtr, TInt aFinalValue, + MProgressDialogCallback* aCallback) const + { // Create dialog prompt HBufC * prompt; - - TApaAppCaption caption; - TRAPD( err, ResolveCaptionNameL( caption ) ); - - // If something goes wrong, show basic "Saving" note - if ( err ) - { - prompt = iEikonEnv->AllocReadResourceLC( R_WAIT_NOTE_SAVING ); - } - else - { - prompt = StringLoader::LoadLC( R_WAIT_NOTE_SAVING_TO, caption ); - } - + + TApaAppCaption caption; + TRAPD( err, ResolveCaptionNameL( caption ) ); + + // If something goes wrong, show basic "Saving" note + if (err) + { + prompt = iEikonEnv->AllocReadResourceLC(R_WAIT_NOTE_SAVING); + } + else + { + prompt = StringLoader::LoadLC(R_WAIT_NOTE_SAVING_TO, caption); + } + // Launch wait dialog with Cancel softkey - SDrawUtils::LaunchProgressNoteL ( - aSelfPtr, - R_PROGRESS_DIALOG, - *prompt, - aFinalValue, - aCallback - ); + SDrawUtils::LaunchProgressNoteL(aSelfPtr, R_PROGRESS_DIALOG, *prompt, + aFinalValue, aCallback); CleanupStack::PopAndDestroy(); // prompt -} + } //============================================================================= -void CImageEditorUIView::ResolveCaptionNameL( TApaAppCaption& aCaption ) const - { - RApaLsSession appArcSession; - CleanupClosePushL( appArcSession ); - User::LeaveIfError( appArcSession.Connect() ); - - // Get Media Gallery caption - TApaAppInfo appInfo; - User::LeaveIfError( appArcSession.GetAppInfo( appInfo, TUid::Uid( KMediaGalleryUID3 ) ) ); - - aCaption = appInfo.iCaption; - - CleanupStack::PopAndDestroy( &appArcSession ); - } - +void CImageEditorUIView::ResolveCaptionNameL(TApaAppCaption& aCaption) const + { + RApaLsSession appArcSession; + CleanupClosePushL(appArcSession); + User::LeaveIfError(appArcSession.Connect()); + + // Get Media Gallery caption + TApaAppInfo appInfo; + User::LeaveIfError(appArcSession.GetAppInfo(appInfo, TUid::Uid( + KMediaGalleryUID3))); + + aCaption = appInfo.iCaption; + + CleanupStack::PopAndDestroy(&appArcSession); + } + //============================================================================= EXPORT_C void CImageEditorUIView::LaunchLoadWaitDialogL( - CAknWaitDialog** aSelfPtr, - MProgressDialogCallback* aCallback - ) const -{ + CAknWaitDialog** aSelfPtr, MProgressDialogCallback* aCallback) const + { // Create dialog prompt - HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_WAIT_NOTE_LOADING); + HBufC * prompt = iEikonEnv->AllocReadResourceLC(R_WAIT_NOTE_LOADING); // Launch wait dialog with empty softkeys - SDrawUtils::LaunchWaitNoteL ( - aSelfPtr, - R_WAIT_DIALOG, - *prompt, - aCallback - ); + SDrawUtils::LaunchWaitNoteL(aSelfPtr, R_WAIT_DIALOG, *prompt, aCallback); CleanupStack::PopAndDestroy(); // prompt -} + } //============================================================================= EXPORT_C void CImageEditorUIView::LaunchWaitDialog() const -{ - // Show empty set of cba buttons while animation on the screen - SetCustomButtonsL ( R_AVKON_SOFTKEYS_EMPTY ); + { + // Show empty set of cba buttons while animation on the screen + SetCustomButtonsL(R_AVKON_SOFTKEYS_EMPTY); iContainer->ShowWaitNote(); -} + } //============================================================================= EXPORT_C void CImageEditorUIView::HideWaitDialog() const -{ + { iContainer->HideWaitNote(); -} + } //============================================================================= -EXPORT_C void CImageEditorUIView::ShowInformationNoteL (const TDesC& aNoteText) const -{ +EXPORT_C void CImageEditorUIView::ShowInformationNoteL(const TDesC& aNoteText) const + { - CAknGlobalNote * globalnote = CAknGlobalNote::NewLC(); - globalnote->ShowNoteL (EAknGlobalInformationNote, aNoteText); + CAknGlobalNote * globalnote = CAknGlobalNote::NewLC(); + globalnote->ShowNoteL(EAknGlobalInformationNote, aNoteText); - CleanupStack::PopAndDestroy(); // globalnote + CleanupStack::PopAndDestroy(); // globalnote -} + } //============================================================================= -EXPORT_C void CImageEditorUIView::ShowConfirmationNoteL (const TDesC& aNoteText) const -{ +EXPORT_C void CImageEditorUIView::ShowConfirmationNoteL(const TDesC& aNoteText) const + { - CAknGlobalNote * globalnote = CAknGlobalNote::NewLC(); - globalnote->ShowNoteL (EAknGlobalConfirmationNote, aNoteText); + CAknGlobalNote * globalnote = CAknGlobalNote::NewLC(); + globalnote->ShowNoteL(EAknGlobalConfirmationNote, aNoteText); - CleanupStack::PopAndDestroy(); // globalnote + CleanupStack::PopAndDestroy(); // globalnote -} + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetNaviPaneTextL ( - const TDesC & aText, - TBool aLeftNaviPaneScrollButtonVisibile, - TBool aRightNaviPaneScrollButtonVisible ) - { - LOG(KImageEditorLogFile, "CImageEditorUIView: Setting navi pane text"); +EXPORT_C void CImageEditorUIView::SetNaviPaneTextL(const TDesC & aText, + TBool aLeftNaviPaneScrollButtonVisibile, + TBool aRightNaviPaneScrollButtonVisible) + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Setting navi pane text"); + + if (iNaviPane) + { + // Create a new decorator + CAknNavigationDecorator* newNaviDecorator = + iNaviPane->CreateNavigationLabelL(aText); + CleanupStack::PushL(newNaviDecorator); - if (iNaviPane ) - { - // Create a new decorator - CAknNavigationDecorator* newNaviDecorator = - iNaviPane->CreateNavigationLabelL (aText); - CleanupStack::PushL (newNaviDecorator); - - // Set the navi scroll indicators for the new decorator - newNaviDecorator->SetScrollButtonDimmed( - CAknNavigationDecorator::ELeftButton, - !aLeftNaviPaneScrollButtonVisibile ); - newNaviDecorator->SetScrollButtonDimmed( - CAknNavigationDecorator::ERightButton, - !aRightNaviPaneScrollButtonVisible ); - if ( aLeftNaviPaneScrollButtonVisibile || aRightNaviPaneScrollButtonVisible ) - { - newNaviDecorator->MakeScrollButtonVisible( ETrue ); - } - - // Set new decorator on top of Navi Pane's decorator stack - // (topmost decorator is the one to show) - iNaviPane->PushL (*newNaviDecorator); + // Set the navi scroll indicators for the new decorator + newNaviDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ELeftButton, + !aLeftNaviPaneScrollButtonVisibile); + newNaviDecorator->SetScrollButtonDimmed( + CAknNavigationDecorator::ERightButton, + !aRightNaviPaneScrollButtonVisible); + if (aLeftNaviPaneScrollButtonVisibile + || aRightNaviPaneScrollButtonVisible) + { + newNaviDecorator->MakeScrollButtonVisible(ETrue); + } + + // Set new decorator on top of Navi Pane's decorator stack + // (topmost decorator is the one to show) + iNaviPane->PushL(*newNaviDecorator); - // remove old "previous decorator" from decorator stack and delete it - if ( iPreviousNaviDecorator ) - { - iNaviPane->Pop( iPreviousNaviDecorator ); - delete iPreviousNaviDecorator; - iPreviousNaviDecorator = NULL; - } - - // update decorator pointers to new ones - iPreviousNaviDecorator = iNaviDecorator; - iNaviDecorator = newNaviDecorator; - - // set observer for the currently shown decorator - (iNaviPane->Top())->SetNaviDecoratorObserver( iContainer ); + // remove old "previous decorator" from decorator stack and delete it + if (iPreviousNaviDecorator) + { + iNaviPane->Pop(iPreviousNaviDecorator); + delete iPreviousNaviDecorator; + iPreviousNaviDecorator = NULL; + } - CleanupStack::Pop (newNaviDecorator); - } + // update decorator pointers to new ones + iPreviousNaviDecorator = iNaviDecorator; + iNaviDecorator = newNaviDecorator; - } + // set observer for the currently shown decorator + (iNaviPane->Top())->SetNaviDecoratorObserver(iContainer); + + CleanupStack::Pop(newNaviDecorator); + } + + } //============================================================================= EXPORT_C void CImageEditorUIView::ClearNaviPaneTextL() -{ - LOG(KImageEditorLogFile, "CImageEditorUIView: Clearing navi pane text"); - if (iNaviPane) - { - if (iNaviDecorator) - { - iNaviPane->Pop (iNaviDecorator); - delete iNaviDecorator; - iNaviDecorator = 0; - } - - if (iPreviousNaviDecorator) - { - iNaviPane->Pop (iPreviousNaviDecorator); - delete iPreviousNaviDecorator; - iPreviousNaviDecorator = 0; - } - HBufC * title = iEikonEnv->AllocReadResourceLC (R_MAIN_VIEW_TITLE); - iNaviDecorator = iNaviPane->CreateNavigationLabelL ( title->Des() ); - iPreviousNaviDecorator = iNaviPane->CreateNavigationLabelL ( title->Des() ); - - iNaviPane->PushL (*iPreviousNaviDecorator); - iNaviPane->PushL (*iNaviDecorator); - iNaviPane->DrawDeferred(); - iNaviDecorator->DrawDeferred(); - CleanupStack::PopAndDestroy(); // title - } -} + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Clearing navi pane text"); + if (iNaviPane) + { + if (iNaviDecorator) + { + iNaviPane->Pop(iNaviDecorator); + delete iNaviDecorator; + iNaviDecorator = 0; + } + + if (iPreviousNaviDecorator) + { + iNaviPane->Pop(iPreviousNaviDecorator); + delete iPreviousNaviDecorator; + iPreviousNaviDecorator = 0; + } + HBufC * title = iEikonEnv->AllocReadResourceLC(R_MAIN_VIEW_TITLE); + iNaviDecorator = iNaviPane->CreateNavigationLabelL(title->Des()); + iPreviousNaviDecorator + = iNaviPane->CreateNavigationLabelL(title->Des()); + + iNaviPane->PushL(*iPreviousNaviDecorator); + iNaviPane->PushL(*iNaviDecorator); + iNaviPane->DrawDeferred(); + iNaviDecorator->DrawDeferred(); + CleanupStack::PopAndDestroy(); // title + } + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetTitlePaneTextL (const TDesC & aText) -{ - iTitlePane->SetTextL (aText); -} +EXPORT_C void CImageEditorUIView::SetTitlePaneTextL(const TDesC & aText) + { + iTitlePane->SetTextL(aText); + } //============================================================================= EXPORT_C void CImageEditorUIView::ClearTitlePaneTextL() -{ - iTitlePane->SetTextL ( KNullDesC ); -} + { + iTitlePane->SetTextL(KNullDesC); + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetSoftKey1L ( - const TDesC & aText, - const TInt aCommand - ) -{ - CEikButtonGroupContainer * cba = Cba(); - // TInt replace_position = cba->PositionById (iSoftkey1); - TInt replace_position( CEikButtonGroupContainer::ELeftSoftkeyPosition ); - cba->SetCommandL (replace_position, aCommand, aText); - cba->DrawDeferred(); - iSoftkey1 = aCommand; -} +EXPORT_C void CImageEditorUIView::SetSoftKey1L(const TDesC & aText, + const TInt aCommand) + { + CEikButtonGroupContainer * cba = Cba(); + // TInt replace_position = cba->PositionById (iSoftkey1); + TInt replace_position(CEikButtonGroupContainer::ELeftSoftkeyPosition); + cba->SetCommandL(replace_position, aCommand, aText); + cba->DrawDeferred(); + iSoftkey1 = aCommand; + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetSoftKey2L ( - const TDesC & aText, - const TInt aCommand - ) -{ - CEikButtonGroupContainer * cba = Cba(); - //TInt replace_position = cba->PositionById (iSoftkey2); - TInt replace_position( CEikButtonGroupContainer::ERightSoftkeyPosition ); - cba->SetCommandL (replace_position, aCommand, aText); - cba->DrawDeferred(); - iSoftkey2 = aCommand; -} +EXPORT_C void CImageEditorUIView::SetSoftKey2L(const TDesC & aText, + const TInt aCommand) + { + CEikButtonGroupContainer * cba = Cba(); + //TInt replace_position = cba->PositionById (iSoftkey2); + TInt replace_position(CEikButtonGroupContainer::ERightSoftkeyPosition); + cba->SetCommandL(replace_position, aCommand, aText); + cba->DrawDeferred(); + iSoftkey2 = aCommand; + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetMiddleSoftKeyL ( - const TDesC & aText, - const TInt aCommand - ) -{ - CEikButtonGroupContainer * cba = Cba(); - - if ( aCommand == EAknSoftkeyContextOptions ) - { - TInt contextMenuId = - ((CImageEditorControlBase *)iControl)->GetContextMenuResourceId(); - if ( contextMenuId ) - { - MenuBar()->SetContextMenuTitleResourceId( contextMenuId ); - } - } - - TInt replace_position( CEikButtonGroupContainer::EMiddleSoftkeyPosition ); - cba->SetCommandL ( replace_position, aCommand, aText ); - cba->DrawDeferred(); - iMSK = aCommand; -} +EXPORT_C void CImageEditorUIView::SetMiddleSoftKeyL(const TDesC & aText, + const TInt aCommand) + { + CEikButtonGroupContainer * cba = Cba(); + + if (aCommand == EAknSoftkeyContextOptions) + { + TInt + contextMenuId = + ((CImageEditorControlBase *) iControl)->GetContextMenuResourceId(); + if (contextMenuId) + { + //if in doodle don't show select dialog. + if (contextMenuId != R_TEXT_CONTEXT_MENUBAR) + { + MenuBar()->SetContextMenuTitleResourceId(contextMenuId); + } + } + } + + TInt replace_position(CEikButtonGroupContainer::EMiddleSoftkeyPosition); + cba->SetCommandL(replace_position, aCommand, aText); + cba->DrawDeferred(); + iMSK = aCommand; + } //============================================================================= EXPORT_C void CImageEditorUIView::SetBusy() -{ - + { + if (iContainer) - { + { iContainer->SetBusy(); + } + + iBusy = ETrue; + RemoveContainerFromStack(); + } - - iBusy = ETrue; - RemoveContainerFromStack(); - -} //============================================================================= EXPORT_C void CImageEditorUIView::ResetBusy() -{ + { AddContainerToStack(); iBusy = EFalse; - - if (iContainer) - { + + if (iContainer) + { iContainer->ResetBusy(); + } } -} //============================================================================= -EXPORT_C void CImageEditorUIView::SetUndoFlag (const TBool aUndo) -{ - iCanUndo = aUndo; -} +EXPORT_C void CImageEditorUIView::SetUndoFlag(const TBool aUndo) + { + iCanUndo = aUndo; + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetSaveFlag (const TBool aSave) -{ - iCanSave = aSave; -} +EXPORT_C void CImageEditorUIView::SetSaveFlag(const TBool aSave) + { + iCanSave = aSave; + } //============================================================================= EXPORT_C void CImageEditorUIView::SetFullScreen() -{ - if (iContainer) - { - iContainer->SetFullScreen(); - } - iFullScreen = ETrue; -} + { + if (iContainer) + { + iContainer->SetFullScreen(); + } + iFullScreen = ETrue; + } //============================================================================= EXPORT_C void CImageEditorUIView::ResetFullScreen() -{ - if (iContainer) - { - iContainer->ResetFullScreen(); - } - iFullScreen = EFalse; -} + { + if (iContainer) + { + iContainer->ResetFullScreen(); + } + iFullScreen = EFalse; + } //============================================================================= -EXPORT_C void CImageEditorUIView::SetZoomModeL ( const TZoomMode& aMode ) -{ +EXPORT_C void CImageEditorUIView::SetZoomModeL(const TZoomMode& aMode) + { iZoomMode = aMode; - + HandleZoomModeChangeL(); - -} + } //============================================================================= void CImageEditorUIView::HandleZoomModeChangeL() - { - - if ( !iInPlugin && iZoomMode != EZoomNormal ) - { - if ( iZoomMode != ( ENumOfZooms - 1 ) ) - { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN ); - } - else - { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_CANCEL ); - } - } - else if ( !iInPlugin && iZoomMode == EZoomNormal ) - { + { - SetCustomButtonsL( R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY ); - } - + if (!iInPlugin && iZoomMode != EZoomNormal) + { + if (iZoomMode != (ENumOfZooms - 1)) + { + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL_ZOOMIN); + } + else + { + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_CANCEL); + } + } + else if (!iInPlugin && iZoomMode == EZoomNormal) + { + + SetCustomButtonsL(R_IMAGEEDITORUI_SK_OPTIONS_BACK_APPLY); + } + // hide previous tooltip iPopupController->HideInfoPopupNote(); - - // show tooltip (also if in plugin) - if ( iZoomMode != EZoomNormal ) - { - - SDrawUtils::ShowToolTip ( iPopupController, - ( CCoeControl* )iContainer, - TPoint( iContainer->Rect().iTl.iX, - iContainer->Rect().iTl.iY ), - EHRightVTop, - iZoomTexts->MdcaPoint( iZoomMode ) ); - } - - } + + // show tooltip (also if in plugin) + if (iZoomMode != EZoomNormal) + { + + SDrawUtils::ShowToolTip(iPopupController, (CCoeControl*) iContainer, + TPoint(iContainer->Rect().iTl.iX, iContainer->Rect().iTl.iY), + EHRightVTop, iZoomTexts->MdcaPoint(iZoomMode)); + } + + } //============================================================================= -EXPORT_C void CImageEditorUIView::DynInitMenuPaneL ( - TInt aResourceId, - CEikMenuPane * aMenuPane - ) - { - // This is called by the framework, aMenuPane should never be null pointer... - __ASSERT_ALWAYS( aMenuPane, User::Panic(KComponentName, EImageEditorPanicMenuNotAccessible) ); +EXPORT_C void CImageEditorUIView::DynInitMenuPaneL(TInt aResourceId, + CEikMenuPane * aMenuPane) + { + // This is called by the framework, aMenuPane should never be null pointer... + __ASSERT_ALWAYS( aMenuPane, User::Panic(KComponentName, EImageEditorPanicMenuNotAccessible) ); #ifdef AIW_PRINT_PROVIDER_USED - if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) ) - { - // Return if AIW submenu - return; - } + if (iServiceHandler->HandleSubmenuL(*aMenuPane)) + { + // Return if AIW submenu + return; + } #endif - - if ( aResourceId != R_IMAGEEDITORUI_MENUPANE ) - { - return; - } + + if (aResourceId != R_IMAGEEDITORUI_MENUPANE) + { + return; + } - // In busy mode - if ( iBusy ) - { - DimAllL ( aResourceId, *aMenuPane ); - } - // In idle mode - else - { - // In plug-in mode - if ( iInPlugin ) - { - DimAllL ( aResourceId, *aMenuPane ); - InsertPluginItemsL ( *aMenuPane ); - + // In busy mode + if (iBusy) + { + DimAllL(aResourceId, *aMenuPane); + } + // In idle mode + else + { + // In plug-in mode + if (iInPlugin) + { + DimAllL(aResourceId, *aMenuPane); + InsertPluginItemsL(*aMenuPane); + #ifdef FULLSCREEN_AVAILABLE - // After plugin specific items, add menu commands that are common - // for all plugins' options menus - // In normal screen mode - if ( !iFullScreen ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, EFalse ); - } + // After plugin specific items, add menu commands that are common + // for all plugins' options menus + // In normal screen mode + if ( !iFullScreen ) + { + aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, EFalse ); + } - // In full screen mode - else - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, EFalse ); - } + // In full screen mode + + else + { + aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, EFalse ); + } #endif // FULLSCREEN_AVAILABLE - - aMenuPane->SetItemDimmed ( EImageEditorMenuCmdHelp, EFalse ); - aMenuPane->SetItemDimmed ( EImageEditorMenuCmdExit, EFalse ); - } - else if ( InZoomingState() ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdUndo, ETrue ); + aMenuPane->SetItemDimmed(EImageEditorMenuCmdHelp, EFalse); + aMenuPane->SetItemDimmed(EImageEditorMenuCmdExit, EFalse); + } + else if (InZoomingState()) + { + aMenuPane->SetItemDimmed(EImageEditorMenuCmdUndo, ETrue); #ifdef FULLSCREEN_AVAILABLE - aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, ETrue ); - aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, ETrue ); + aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, ETrue ); + aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, ETrue ); #endif // FULLSCREEN_AVAILABLE - - if ( !iCanSave || IsMemoryInCriticalLevel() ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdSave, ETrue ); - } - - TInt position; - if ( aMenuPane->MenuItemExists( EImageEditorMenuCmdSend, - position ) ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdSend, ETrue ); - } - if ( aMenuPane->MenuItemExists( EImageEditorAiwCriteriaPrint, - position ) ) - { - aMenuPane->SetItemDimmed( EImageEditorAiwCriteriaPrint, ETrue ); - } - - if ( iZoomMode == EZoomIn3 ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdZoomIn, ETrue ); - } - // Set "Apply Effect" item to be after "Zoom Out" in zooming - // state's options menu - if ( aMenuPane->MenuItemExists( EImageEditorMenuCmdApplyEffect, - position ) ) - { - CEikMenuPaneItem::SData data = - aMenuPane->ItemData( EImageEditorMenuCmdApplyEffect ); - aMenuPane->DeleteMenuItem( EImageEditorMenuCmdApplyEffect ); - aMenuPane->AddMenuItemL( data, EImageEditorMenuCmdZoomOut ); - } - } - // In main view mode - else - { + if (!iCanSave || IsMemoryInCriticalLevel()) + { + aMenuPane->SetItemDimmed(EImageEditorMenuCmdSave, ETrue); + } + + TInt position; + if (aMenuPane->MenuItemExists(EImageEditorMenuCmdSend, position)) + { + aMenuPane->SetItemDimmed(EImageEditorMenuCmdSend, ETrue); + } + if (aMenuPane->MenuItemExists(EImageEditorAiwCriteriaPrint,position)) + { + aMenuPane->SetItemDimmed(EImageEditorAiwCriteriaPrint, ETrue); + } + + if (iZoomMode == EZoomIn3) + { + aMenuPane->SetItemDimmed(EImageEditorMenuCmdZoomIn, ETrue); + } + // Set "Apply Effect" item to be after "Zoom Out" in zooming + // state's options menu + if (aMenuPane->MenuItemExists(EImageEditorMenuCmdApplyEffect,position)) + { + CEikMenuPaneItem::SData data = aMenuPane->ItemData( + EImageEditorMenuCmdApplyEffect); + aMenuPane->DeleteMenuItem(EImageEditorMenuCmdApplyEffect); + aMenuPane->AddMenuItemL(data, EImageEditorMenuCmdZoomOut); + } + } + // In main view mode + else + { #ifdef AIW_PRINT_PROVIDER_USED - + #else - aMenuPane->SetItemDimmed( EImageEditorAiwCriteriaPrint, ETrue ); + aMenuPane->SetItemDimmed( EImageEditorAiwCriteriaPrint, ETrue ); #endif - // Display CSendUi menu item - if ( iSendAppUi ) - { - iSendAppUi->AddSendMenuItemL( - *aMenuPane, - SIE_SENDUI_MENU_ITEM_INDEX, - EImageEditorMenuCmdSend, - TSendingCapabilities (0, 0, TSendingCapabilities::ESupportsAttachments) ); - } + // Display CSendUi menu item + if (iSendAppUi) + { + iSendAppUi->AddSendMenuItemL(*aMenuPane, + SIE_SENDUI_MENU_ITEM_INDEX, EImageEditorMenuCmdSend, + TSendingCapabilities(0, 0, + TSendingCapabilities::ESupportsAttachments)); + } - // Nothing to undo - if ( !iCanUndo ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdUndo, ETrue ); - } + // Nothing to undo + if (!iCanUndo) + { + aMenuPane->SetItemDimmed(EImageEditorMenuCmdUndo, ETrue); + } #ifdef FULLSCREEN_AVAILABLE - // In full screen mode - if ( iFullScreen ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, ETrue ); - } + // In full screen mode + if ( iFullScreen ) + { + aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, ETrue ); + } - // In normal screen mode - else - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, ETrue ); - } + // In normal screen mode + + else + { + aMenuPane->SetItemDimmed( EImageEditorMenuCmdNormalScreen, ETrue ); + } #endif // FULLSCREEN_AVAILABLE - if ( !iCanSave || IsMemoryInCriticalLevel() ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdSave, ETrue ); - } - - if ( iZoomMode == EZoomNormal ) - { - aMenuPane->SetItemDimmed( EImageEditorMenuCmdZoomOut, ETrue ); - aMenuPane->SetItemDimmed( EImageEditorMenuCmdFitToScreen, ETrue ); - } - + if (!iCanSave || IsMemoryInCriticalLevel()) + { + aMenuPane->SetItemDimmed(EImageEditorMenuCmdSave, ETrue); + } + + if (iZoomMode == EZoomNormal) + { + aMenuPane->SetItemDimmed(EImageEditorMenuCmdZoomOut, ETrue); + aMenuPane->SetItemDimmed(EImageEditorMenuCmdFitToScreen, ETrue); + } + #ifdef AIW_PRINT_PROVIDER_USED - if ( iServiceHandler->IsAiwMenu( aResourceId ) ) - { - CAiwGenericParamList& in = iServiceHandler->InParamListL(); - - TFileName filename( iImageFileName ); - TAiwVariant variant( filename ); - TAiwGenericParam param( EGenericParamFile, variant ); - - in.AppendL( param ); + if (iServiceHandler->IsAiwMenu(aResourceId)) + { + CAiwGenericParamList& in = iServiceHandler->InParamListL(); - iServiceHandler->InitializeMenuPaneL( *aMenuPane, - aResourceId, - EImageEditorMenuAiwPrintBase, - in); - } + TFileName filename(iImageFileName); + TAiwVariant variant(filename); + TAiwGenericParam param(EGenericParamFile, variant); + + in.AppendL(param); + + iServiceHandler->InitializeMenuPaneL(*aMenuPane, aResourceId, + EImageEditorMenuAiwPrintBase, in); + } #endif - } - } - } + } + } + } //============================================================================= EXPORT_C void CImageEditorUIView::SetSendAppUi(CSendUi* aSendAppUi) - { - iSendAppUi = aSendAppUi; - } - + { + iSendAppUi = aSendAppUi; + } //============================================================================= EXPORT_C void CImageEditorUIView::HandleStatusPaneSizeChange() -{ - -} - -//============================================================================= -void CImageEditorUIView::DimAllL ( - TInt /*aResourceId*/, - CEikMenuPane & aMenuPane - ) const -{ - LOG(KImageEditorLogFile, "CImageEditorUIView::DimAllL"); + { - aMenuPane.SetItemDimmed (EImageEditorMenuCmdApplyEffect, ETrue); - aMenuPane.SetItemDimmed (EImageEditorMenuCmdExit, ETrue); - aMenuPane.SetItemDimmed (EImageEditorMenuCmdUndo, ETrue); -#ifdef FULLSCREEN_AVAILABLE - aMenuPane.SetItemDimmed (EImageEditorMenuCmdFullScreen, ETrue); - aMenuPane.SetItemDimmed (EImageEditorMenuCmdNormalScreen, ETrue); -#endif // FULLSCREEN_AVAILABLE - aMenuPane.SetItemDimmed (EImageEditorMenuCmdZoomIn, ETrue); - aMenuPane.SetItemDimmed (EImageEditorMenuCmdZoomOut, ETrue); - aMenuPane.SetItemDimmed (EImageEditorMenuCmdSave, ETrue); - aMenuPane.SetItemDimmed (EImageEditorAiwCriteriaPrint, ETrue); - aMenuPane.SetItemDimmed (EImageEditorMenuCmdHelp, ETrue); - aMenuPane.SetItemDimmed (EImageEditorMenuCmdFitToScreen, ETrue); -} + } //============================================================================= -void CImageEditorUIView::UpdateSoftkeysL () -{ - __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) ); +void CImageEditorUIView::DimAllL(TInt /*aResourceId*/, CEikMenuPane & aMenuPane) const + { + LOG(KImageEditorLogFile, "CImageEditorUIView::DimAllL"); - // Get plug-in info - CPluginInfo * pgn_info = iArray[iIndex]; - - // Get soft key pair index - TInt sk_index = ((CImageEditorControlBase *)iControl)->GetSoftkeyIndexL(); + aMenuPane.SetItemDimmed(EImageEditorMenuCmdApplyEffect, ETrue); + aMenuPane.SetItemDimmed(EImageEditorMenuCmdExit, ETrue); + aMenuPane.SetItemDimmed(EImageEditorMenuCmdUndo, ETrue); +#ifdef FULLSCREEN_AVAILABLE + aMenuPane.SetItemDimmed (EImageEditorMenuCmdFullScreen, ETrue); + aMenuPane.SetItemDimmed (EImageEditorMenuCmdNormalScreen, ETrue); +#endif // FULLSCREEN_AVAILABLE + aMenuPane.SetItemDimmed(EImageEditorMenuCmdZoomIn, ETrue); + aMenuPane.SetItemDimmed(EImageEditorMenuCmdZoomOut, ETrue); + aMenuPane.SetItemDimmed(EImageEditorMenuCmdSave, ETrue); + aMenuPane.SetItemDimmed(EImageEditorAiwCriteriaPrint, ETrue); + aMenuPane.SetItemDimmed(EImageEditorMenuCmdHelp, ETrue); + aMenuPane.SetItemDimmed(EImageEditorMenuCmdFitToScreen, ETrue); + } - // Set soft key 1 - SetSoftKey1L ( - pgn_info->Sk1Texts()[sk_index], - pgn_info->Sk1Cmds()[sk_index] - ); +//============================================================================= +void CImageEditorUIView::UpdateSoftkeysL() + { + __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) ); + + // Get plug-in info + CPluginInfo * pgn_info = iArray[iIndex]; + + // Get soft key pair index + TInt sk_index = ((CImageEditorControlBase *) iControl)->GetSoftkeyIndexL(); - // Set soft key 2 - SetSoftKey2L ( - pgn_info->Sk2Texts()[sk_index], - pgn_info->Sk2Cmds()[sk_index] - ); - - // Set middle soft key - SetMiddleSoftKeyL ( - pgn_info->MSKTexts()[sk_index], - pgn_info->MSKCmds()[sk_index] - ); -} + // Set soft key 1 + SetSoftKey1L(pgn_info->Sk1Texts()[sk_index], pgn_info->Sk1Cmds()[sk_index]); + + // Set soft key 2 + SetSoftKey2L(pgn_info->Sk2Texts()[sk_index], pgn_info->Sk2Cmds()[sk_index]); + + // Set middle soft key + SetMiddleSoftKeyL(pgn_info->MSKTexts()[sk_index], + pgn_info->MSKCmds()[sk_index]); + } //============================================================================= void CImageEditorUIView::UpdateNaviPaneL() -{ - __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) ); + { + __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) ); - TBool leftNaviPaneScrollButtonVisibile; - TBool rightNaviPaneScrollButtonVisible; - TPtrC naviText = ((CImageEditorControlBase *)iControl)->GetNaviPaneTextL( - leftNaviPaneScrollButtonVisibile, - rightNaviPaneScrollButtonVisible ); + TBool leftNaviPaneScrollButtonVisibile; + TBool rightNaviPaneScrollButtonVisible; + TPtrC naviText = ((CImageEditorControlBase *) iControl)->GetNaviPaneTextL( + leftNaviPaneScrollButtonVisibile, rightNaviPaneScrollButtonVisible); - SetNaviPaneTextL ( - naviText, - leftNaviPaneScrollButtonVisibile, - rightNaviPaneScrollButtonVisible ); -} + SetNaviPaneTextL(naviText, leftNaviPaneScrollButtonVisibile, + rightNaviPaneScrollButtonVisible); + } //============================================================================= -void CImageEditorUIView::InsertPluginItemsL (CEikMenuPane & aMenuPane) -{ - __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) ); +void CImageEditorUIView::InsertPluginItemsL(CEikMenuPane & aMenuPane) + { + __ASSERT_ALWAYS( iControl, User::Panic(KComponentName, EImageEditorPanicControlIsNull) ); - // Insert the plug-in commands - CMenuItemArray & menu_items = iArray[iIndex]->MenuItems(); - TBitField dimmed = ((CImageEditorControlBase *)iControl)->GetDimmedMenuItems(); - for (TInt i = 0; i < menu_items.Count(); ++i) - { - // Check the visibility for each menu item. - if ( ! dimmed.GetBit(i) ) - { - aMenuPane.InsertMenuItemL ( menu_items[i], i ); - } - } -} + // Insert the plug-in commands + CMenuItemArray & menu_items = iArray[iIndex]->MenuItems(); + TBitField dimmed = + ((CImageEditorControlBase *) iControl)->GetDimmedMenuItems(); + for (TInt i = 0; i < menu_items.Count(); ++i) + { + // Check the visibility for each menu item. + if (!dimmed.GetBit(i)) + { + aMenuPane.InsertMenuItemL(menu_items[i], i); + } + } + } //============================================================================= -TBool CImageEditorUIView::MenuItemPressedL (TInt aCommand) -{ - CMenuItemArray & menu_items = iArray[iIndex]->MenuItems(); - for (TInt i = 0; i < menu_items.Count(); ++i) - { - if ( menu_items[i].iCommandId == aCommand ) - { - return ETrue; - } - } - return EFalse; -} +TBool CImageEditorUIView::MenuItemPressedL(TInt aCommand) + { + CMenuItemArray & menu_items = iArray[iIndex]->MenuItems(); + for (TInt i = 0; i < menu_items.Count(); ++i) + { + if (menu_items[i].iCommandId == aCommand) + { + return ETrue; + } + } + return EFalse; + } //============================================================================= -EXPORT_C void CImageEditorUIView::DoActivateL ( - const TVwsViewId & /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8 & /*aCustomMessage*/ - ) -{ - LOG(KImageEditorLogFile, "CImageEditorUIView: Activating view"); - // Construct container - iContainer = new (ELeave) CImageEditorUIContainer; - iContainer->SetMopParent (this); - iContainer->ConstructL ( ClientRect() ); - iContainer->SetView (this); - HandleCommandL (EImageEditorCmdViewReady); - -} +EXPORT_C void CImageEditorUIView::DoActivateL( + const TVwsViewId & /*aPrevViewId*/, TUid /*aCustomMessageId*/, + const TDesC8 & /*aCustomMessage*/ +) + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Activating view"); + // Construct container + iContainer = new (ELeave) CImageEditorUIContainer; + iContainer->SetMopParent(this); + iContainer->ConstructL(ClientRect()); + iContainer->SetView(this); + HandleCommandL(EImageEditorCmdViewReady); + } //============================================================================= EXPORT_C void CImageEditorUIView::DoDeactivate() -{ - LOG(KImageEditorLogFile, "CImageEditorUIView: Deactivating view"); - - RemoveContainerFromStack(); - - if ( iContainer ) { + LOG(KImageEditorLogFile, "CImageEditorUIView: Deactivating view"); + + RemoveContainerFromStack(); + + if (iContainer) + { delete iContainer; iContainer = 0; - } -} + } + } //============================================================================= void CImageEditorUIView::AddContainerToStack() -{ + { if (!iContainerInStack && iContainer) - { + { TRAPD(err, AppUi()->AddToViewStackL (*this, iContainer); ); if (err == KErrNone) - { - iContainerInStack = ETrue; + { + iContainerInStack = ETrue; + } } - } -} - - + } //============================================================================= void CImageEditorUIView::RemoveContainerFromStack() -{ + { if (iContainerInStack) - { - AppUi()->RemoveFromViewStack (*this, iContainer); - iContainerInStack = EFalse; - } -} + { + AppUi()->RemoveFromViewStack(*this, iContainer); + iContainerInStack = EFalse; + } + } //============================================================================= EXPORT_C TBool CImageEditorUIView::InZoomingState() - { - if ( iZoomMode == EZoomIn1 || - iZoomMode == EZoomIn2 || - iZoomMode == EZoomIn3 ) - { - return ETrue; - } - else - { - return EFalse; - } - } + { + if (iZoomMode == EZoomIn1 || iZoomMode == EZoomIn2 || iZoomMode == EZoomIn3) + { + return ETrue; + } + else + { + return EFalse; + } + } //============================================================================= -EXPORT_C TInt CImageEditorUIView::LaunchSaveImageQueryL () const -{ - +EXPORT_C TInt CImageEditorUIView::LaunchSaveImageQueryL() const + { // Create dialog heading and options - HBufC * heading = CEikonEnv::Static()->AllocReadResourceLC (R_SIE_LIST_QUERY_HEADING_SAVE); - HBufC * option1 = CEikonEnv::Static()->AllocReadResourceLC (R_SIE_LIST_QUERY_SAVE_NEW); - HBufC * option2 = CEikonEnv::Static()->AllocReadResourceLC (R_SIE_LIST_QUERY_SAVE_REPLACE); - + HBufC * heading = CEikonEnv::Static()->AllocReadResourceLC( + R_SIE_LIST_QUERY_HEADING_SAVE); + HBufC * option1 = CEikonEnv::Static()->AllocReadResourceLC( + R_SIE_LIST_QUERY_SAVE_NEW); + HBufC * option2 = CEikonEnv::Static()->AllocReadResourceLC( + R_SIE_LIST_QUERY_SAVE_REPLACE); + // Query dialog texts - CDesCArray * options = new (ELeave) CDesCArraySeg (2); - CleanupStack::PushL (options); - options->AppendL( option1->Des() ); - options->AppendL( option2->Des() ); + CDesCArray * options = new (ELeave) CDesCArraySeg(2); + CleanupStack::PushL(options); + options->AppendL(option1->Des()); + options->AppendL(option2->Des()); // Execute query dialog - TInt ret = SDrawUtils::LaunchListQueryDialogL (options, *heading); + TInt ret = SDrawUtils::LaunchListQueryDialogL(options, *heading); options->Reset(); - + CleanupStack::PopAndDestroy(4); //options, option2, option1, heading - + return ret; -} + } //============================================================================= -EXPORT_C void CImageEditorUIView::GetTouchPanDirections( TInt& xMovement, - TInt& yMovement ) - { +EXPORT_C void CImageEditorUIView::GetTouchPanDirections(TInt& xMovement, + TInt& yMovement) + { - xMovement = 0; - yMovement = 0; - iContainer->GetDragDirections( xMovement, yMovement ); - } - + xMovement = 0; + yMovement = 0; + iContainer->GetDragDirections(xMovement, yMovement); + } + EXPORT_C TBool CImageEditorUIView::IsMemoryInCriticalLevel() { TEntry entry; - RFs & fs = iEikonEnv->FsSession(); - fs.Entry( iImageFileName, entry ); + RFs & fs = iEikonEnv->FsSession(); + fs.Entry(iImageFileName, entry); TFileName driveAndPath; - driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() ); - driveAndPath.Append( PathInfo::ImagesPath() ); - return !ImageEditorUtils::ImageFitsToDriveL( fs, iImageFileName, driveAndPath); + driveAndPath.Copy(PathInfo::PhoneMemoryRootPath()); + driveAndPath.Append(PathInfo::ImagesPath()); + return !ImageEditorUtils::ImageFitsToDriveL(fs, iImageFileName, + driveAndPath); } // End of File diff -r edfc90759b9f -r 18b321db4884 imageeditor/ImageEditorUI/src/PreviewControlBase.cpp --- a/imageeditor/ImageEditorUI/src/PreviewControlBase.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/ImageEditorUI/src/PreviewControlBase.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -19,6 +19,7 @@ #include "PreviewControlBase.h" +#include //============================================================================= EXPORT_C CPreviewControlBase * CPreviewControlBase::NewL ( @@ -45,6 +46,7 @@ // Set extent SetRect (aRect); + iStatuspaneHeight = aRect.iBr.iY; // Activate ActivateL(); } @@ -78,11 +80,15 @@ gc.SetPenColor (KRgbBlack); gc.SetBrushStyle (CGraphicsContext::ESolidBrush); gc.SetBrushColor (KRgbBlack); - +// TRect rect; +// AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow,rect ); +// TRect ImageRect(iSysPars->VisibleImageRectPrev()); +// +// TInt ImageStartPosition = (rect.Height() - aRect.Height())/2; // Draw preview image if found if ( iPreview && iPreview->Handle() ) { - gc.BitBlt (TPoint(0,0), iPreview); + gc.BitBlt (TPoint(0,iStatuspaneHeight), iPreview); } else { diff -r edfc90759b9f -r 18b321db4884 imageeditor/group/bld.inf --- a/imageeditor/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/group/bld.inf Thu Jun 03 18:57:10 2010 +0800 @@ -38,6 +38,7 @@ #include "../ImageEditorApp/group/bld.inf" /// Plugins +//#ifdef RD_IE_DRAW_PLUGIN #include "../plugins/BlackWhitePlugin/group/bld.inf" #include "../plugins/NegativePlugin/group/bld.inf" #include "../plugins/SepiaPlugin/group/bld.inf" @@ -54,9 +55,10 @@ #include "../plugins/RotateRPlugin/group/bld.inf" #include "../plugins/ResizePlugin/group/bld.inf" #include "../plugins/TextPlugin/group/bld.inf" -#ifdef RD_IE_DRAW_PLUGIN +//#endif // RD_IE_DRAW_PLUGIN +// #include "../plugins/DrawPlugin/group/bld.inf" -#endif // RD_IE_DRAW_PLUGIN +// // Editor AIW Provider #include "../EditorProvider/group/bld.inf" diff -r edfc90759b9f -r 18b321db4884 imageeditor/imageeditorApp/inc/ImageEditorAppUi.h --- a/imageeditor/imageeditorApp/inc/ImageEditorAppUi.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/imageeditorApp/inc/ImageEditorAppUi.h Thu Jun 03 18:57:10 2010 +0800 @@ -189,13 +189,15 @@ protected: -/** @name Methods:*/ -//@{ -//@} + /** InitialHorizontalDrawPlugin + * + * Called when screen mode changes. + * + * @param - + * @return - + */ + void InitialHorizontalDrawPlugin(); -/** @name Members:*/ -//@{ -//@} private: @@ -738,7 +740,11 @@ CImageEditorRemConObserver* iVolumeKeyObserver; TBool iSavingQuery; - + //The pluginName is draw plug-ins + TBuf<32> iPluginName; + //The phone is standby + TBool iStandby; + #ifdef S60_31_VOLUME_KEYS /// Remote connection API used to handle the volume keys /// (implementation borrowed from Media gallery) diff -r edfc90759b9f -r 18b321db4884 imageeditor/imageeditorApp/src/ImageEditorAppUi.cpp --- a/imageeditor/imageeditorApp/src/ImageEditorAppUi.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/imageeditorApp/src/ImageEditorAppUi.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -1,30 +1,27 @@ /* -* Copyright (c) 2010 Ixonos Plc. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* Ixonos Plc -* -* Description: -* Image Editor AppUI class. -* -*/ - - + * Copyright (c) 2010 Ixonos Plc. + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - Initial contribution + * + * Contributors: + * Ixonos Plc + * + * Description: + * Image Editor AppUI class. + * + */ // INCLUDE FILES #include #include #include #include #include - #include #include #include @@ -34,1110 +31,1097 @@ #include #include #include - #include #include #include #include #include - #ifdef VERBOSE #include #endif - #include #include - #include #include "ImageEditorUI.hrh" #include "ImageEditorPanics.h" - #include "imageeditoruids.hrh" #include "commondefs.h" -//#include "platform_security_literals.hrh" - #include "ImageEditorApp.h" #include "ImageEditorAppUi.h" #include "ImageEditorUIView.h" #include "ImageEditorUI.hrh" #include "ImageEditorError.h" #include "PluginInfo.h" - #include "ImageEditorPluginLocator.h" #include "ImageEditorPluginManager.h" #include "ImageEditorImageController.h" - +#include "ImageEditorUIContainer.h" #include "ImageEditorUtils.h" #include "ResolutionUtil.h" #include "Callback.h" - // CONSTANTS - // Panic category _LIT(KComponentName, "ImageEditorAppUi"); - -const TInt KObConstructCallBackID = 1; -const TInt KObInitPluginID = 1000; -const TInt KObReturnFromPluginID = 1001; -const TInt KObCancelCallbackID = 1002; -const TInt KObUndoDCallbackID = 1003; -const TInt KObSendCallbackID = 1004; -const TInt KObPrintCallbackID = 1005; -const TInt KObSaveCallbackID = 1006; +_LIT(KDrawPlugin,"draw.pgn"); +_LIT(KNull,""); + +const TInt KObConstructCallBackID = 1; +const TInt KObInitPluginID = 1000; +const TInt KObReturnFromPluginID = 1001; +const TInt KObCancelCallbackID = 1002; +const TInt KObUndoDCallbackID = 1003; +const TInt KObSendCallbackID = 1004; +const TInt KObPrintCallbackID = 1005; +const TInt KObSaveCallbackID = 1006; //============================================================================= CImageEditorAppUi::CImageEditorAppUi() : - // Initialize application flags and variables - iDocumentName(), - iSourceFileName(), - iImageSaved (EFalse), - iForeground (ETrue), - iExitFromApp (EFalse), - iSaveOnExit (ETrue), - iSysExit (EFalse), - iBusy (ETrue), - iOrientationChanged (EFalse), - iSaving (EFalse), - iSending (EFalse), - iPrinting (EFalse), - iCancelling (EFalse), - iFullScreen (EFalse), - iPluginsScanned (EFalse), - iImageLoaded (EFalse), - iEditorReady (EFalse), - iCancelTextInputActive (EFalse), - iProcessPriorityAltered (EFalse) -{ - -} + // Initialize application flags and variables + iDocumentName(), iSourceFileName(), iImageSaved(EFalse), + iForeground(ETrue), iExitFromApp(EFalse), iSaveOnExit(ETrue), + iSysExit(EFalse), iBusy(ETrue), iOrientationChanged(EFalse), + iSaving(EFalse), iSending(EFalse), iPrinting(EFalse), iCancelling( + EFalse), iFullScreen(EFalse), iPluginsScanned(EFalse), + iImageLoaded(EFalse), iEditorReady(EFalse), iCancelTextInputActive( + EFalse), iProcessPriorityAltered(EFalse) + { + + } //============================================================================= void CImageEditorAppUi::ConstructL() -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi::ConstructL"); + { + LOG(KImageEditorLogFile, "CImageEditorAppUi::ConstructL"); // Initialize UI with standard values, read application resource file, // read default document #ifdef LANDSCAPE_ONLY - BaseConstructL( EAppOrientationLandscape | EAknEnableSkin | EAknEnableMSK ); + BaseConstructL( EAppOrientationLandscape | EAknEnableSkin | EAknEnableMSK ); #else #ifdef LANDSCAPE_SUPPORT - BaseConstructL( EAppOrientationAutomatic|EAknEnableSkin | EAknEnableMSK ); + BaseConstructL(EAppOrientationAutomatic | EAknEnableSkin | EAknEnableMSK); #else - BaseConstructL( EAknEnableSkin | EAknEnableMSK ); + BaseConstructL( EAknEnableSkin | EAknEnableMSK ); #endif #endif // LANDSCAPE_SUPPORT - - // Set busy - SetBusy(); - - // Create main view - CImageEditorUIView * view = new (ELeave) CImageEditorUIView; - CleanupStack::PushL (view); - view->ConstructL(); - view->ConstructMenuAndCbaEarlyL(); + // Set busy + SetBusy(); + + // Create main view + CImageEditorUIView * view = new (ELeave) CImageEditorUIView; + CleanupStack::PushL(view); + view->ConstructL(); + view->ConstructMenuAndCbaEarlyL(); iEditorView = view; - AddViewL (view); // transfers ownership - CleanupStack::Pop(); // view - LOG (KImageEditorLogFile, "CImageEditorAppUi: Main view created"); - - // Activate view - ActivateLocalViewL ( iEditorView->Id() ); - LOG(KImageEditorLogFile, "CImageEditorAppUi: View activated"); - - // Set default navi pane text - ClearTitlePaneTextL(); - ClearNaviPaneTextL(); - - // Create CObCallback instance + AddViewL(view); // transfers ownership + CleanupStack::Pop(); // view + LOG (KImageEditorLogFile, "CImageEditorAppUi: Main view created"); + + // Activate view + ActivateLocalViewL(iEditorView->Id()); + LOG(KImageEditorLogFile, "CImageEditorAppUi: View activated"); + + // Set default navi pane text + ClearTitlePaneTextL(); + ClearNaviPaneTextL(); + + // Create CObCallback instance iConstructionState = EConstructionStateAlloc; - iCallback = CObCallback::NewL ( (MObCallbackMethod *)this ); - iCallback->DoCallback (KObConstructCallBackID); - - // Volume key observer instance - iVolumeKeyObserver = CImageEditorRemConObserver::NewL( *this ); - + iCallback = CObCallback::NewL((MObCallbackMethod *) this); + iCallback->DoCallback(KObConstructCallBackID); + + // Volume key observer instance + iVolumeKeyObserver = CImageEditorRemConObserver::NewL(*this); + + iStandby = EFalse; #ifdef S60_31_VOLUME_KEYS iMGXRemConTarget = CMGXRemConTarget::NewL( this ); #endif -} + } //============================================================================= CImageEditorAppUi::~CImageEditorAppUi() -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi::~CImageEditorAppUi() starting..."); + { + LOG(KImageEditorLogFile, "CImageEditorAppUi::~CImageEditorAppUi() starting..."); //KillWaitNote(); if (iWaitNote != NULL) { - delete iWaitNote; - iWaitNote = NULL; + delete iWaitNote; + iWaitNote = NULL; } - - delete iLocator; - delete iImageController; - delete iEditorManager; + + delete iLocator; + delete iImageController; + delete iEditorManager; delete iSendAppUi; delete iCallback; iSourceImageMgAlbumIdList.Close(); - iEditorView = NULL; - + iEditorView = NULL; + iFile.Close(); - + #ifdef S60_31_VOLUME_KEYS delete iMGXRemConTarget; #endif - + // deleted by CCoeEnv iResolutionUtil = NULL; delete iVolumeKeyObserver; - LOG(KImageEditorLogFile, "CImageEditorAppUi: AppUi deleted"); -} + LOG(KImageEditorLogFile, "CImageEditorAppUi: AppUi deleted"); + } //============================================================================= -void CImageEditorAppUi::OperationReadyL ( - TOperationCode aOpId, - TInt aError - ) -{ - LOGFMT2(KImageEditorLogFile, "CImageEditorAppUi:OperationReadyL (aOpId:%d, aError:%d)", (TInt)aOpId, aError); - - // Kill wait note - KillWaitNote(); - - // Handle error - if ( aError != KErrNone ) +void CImageEditorAppUi::OperationReadyL(TOperationCode aOpId, TInt aError) { - switch ( aOpId ) + LOGFMT2(KImageEditorLogFile, "CImageEditorAppUi:OperationReadyL (aOpId:%d, aError:%d)", (TInt)aOpId, aError); + + // Kill wait note + KillWaitNote(); + + // Handle error + if (aError != KErrNone) { + switch (aOpId) + { case EOperationCodeLoad: case EOperationCodeBlockLoad: case EOperationCodeSearch: - { - - if (KErrCancel == aError) - { - // Loading image was cancelled. - User::Leave (KSIEEErrorOkToExit); - } - else - { - User::Leave (KSIEEOpenFile); - } - break; - } - case EOperationCodeSave: - case EOperationCodeBlockSave: - { - LOG(KImageEditorLogFile, "CImageEditorAppUi: Save cancelled"); + { + + if (KErrCancel == aError) + { + // Loading image was cancelled. + User::Leave(KSIEEErrorOkToExit); + } + else + { + User::Leave(KSIEEOpenFile); + } + break; + } + case EOperationCodeSave: + case EOperationCodeBlockSave: + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: Save cancelled"); #ifdef VERBOSE - LOGFMT3(KImageEditorLogFile, "\tiSourceFileName: %S, iDocumentName: %S, iTempSaveFileName: %S", &iSourceFileName, &iDocumentName, &iTempSaveFileName); + LOGFMT3(KImageEditorLogFile, "\tiSourceFileName: %S, iDocumentName: %S, iTempSaveFileName: %S", &iSourceFileName, &iDocumentName, &iTempSaveFileName); #endif - iSaving = EFalse; - - // delete the temporary files - DeleteTempFiles(); - - // Reset bitmap sink and screen size - UpdateScreenRectL(); - iOrientationChanged = EFalse; - - - if (!iExitFromApp) - { - - if (iSending) - { - // Restore document name - iEditorManager->SetImageName (iDocumentName); - iSending = EFalse; - } - if (KErrCancel == aError) - { - // KErrCancel means user cancel, not an error. - ResetBusy(); - } - else - { - // Leave in case of error. - User::Leave (KSIEESaveFile); - } - } - else - { - TInt exit = 0; - if (iSaveOnExit) - { - exit = ((CImageEditorUIView *)iEditorView)->LaunchExitWithoutSavingQueryL(); - } - - if (exit == EImageEditorSoftkeyCmdYes || !iSaveOnExit) - { - // If the image has not been saved before, the reserved target - // file has zero size and can be deleted. - TEntry entry; - TInt err = iEikonEnv->FsSession().Entry( iDocumentName, entry ); - if ( err == KErrNone && entry.iSize == 0 ) - { - BaflUtils::DeleteFile (iEikonEnv->FsSession(), iDocumentName); - } - - // Exit the application - User::Leave (KSIEEErrorOkToExit); - } - else - { - iExitFromApp = EFalse; - ResetBusy(); - } - } - SetOrientationL(EAppUiOrientationUnspecified); - break; - } - default: - { - User::Leave (aError); - break; - } + iSaving = EFalse; + + // delete the temporary files + DeleteTempFiles(); + + // Reset bitmap sink and screen size + UpdateScreenRectL(); + iOrientationChanged = EFalse; + + if (!iExitFromApp) + { + + if (iSending) + { + // Restore document name + iEditorManager->SetImageName(iDocumentName); + iSending = EFalse; + } + if (KErrCancel == aError) + { + // KErrCancel means user cancel, not an error. + ResetBusy(); + } + else + { + // Leave in case of error. + User::Leave(KSIEESaveFile); + } + } + else + { + TInt exit = 0; + if (iSaveOnExit) + { + exit + = ((CImageEditorUIView *) iEditorView)->LaunchExitWithoutSavingQueryL(); + } + + if (exit == EImageEditorSoftkeyCmdYes || !iSaveOnExit) + { + // If the image has not been saved before, the reserved target + // file has zero size and can be deleted. + TEntry entry; + TInt err = iEikonEnv->FsSession().Entry(iDocumentName, + entry); + if (err == KErrNone && entry.iSize == 0) + { + BaflUtils::DeleteFile(iEikonEnv->FsSession(), + iDocumentName); + } + + // Exit the application + User::Leave(KSIEEErrorOkToExit); + } + else + { + iExitFromApp = EFalse; + ResetBusy(); + } + } + SetOrientationL(EAppUiOrientationUnspecified); + break; + } + default: + { + User::Leave(aError); + break; + } + } } - } else - { - switch ( aOpId ) { + switch (aOpId) + { case EOperationCodeLoad: case EOperationCodeBlockLoad: - { - LOG(KImageEditorLogFile, "CImageEditorAppUi: Image loaded"); - - // Find out whether the source file belongs to any albums - ImageEditorUtils::FindAlbumsForImageFileL ( - iSourceImageMgAlbumIdList, - iSourceFileName ); - - // Generate the name for the saved file - TInt err = ImageEditorUtils::GenerateNewDocumentNameL ( - iEikonEnv->FsSession(), - iSourceFileName, - iDocumentName, - &iSourceImageMgAlbumIdList ); + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: Image loaded"); + + // Find out whether the source file belongs to any albums + ImageEditorUtils::FindAlbumsForImageFileL( + iSourceImageMgAlbumIdList, iSourceFileName); + + // Generate the name for the saved file + TInt err = ImageEditorUtils::GenerateNewDocumentNameL( + iEikonEnv->FsSession(), iSourceFileName, iDocumentName, + &iSourceImageMgAlbumIdList); // Delete old temp files, which could exist if the exit was not clean DeleteTempFiles(); - - // If there is not enough disk space to save the edited image, show - // error note but continue anyway (user can free up memory before saving) - if (KSIEENotEnoughDiskSpace == err) - { - ShowErrorNoteL (err); - } - else if (KErrNone != err) - { - // Fatal error - User::Leave (err); - } - iEditorManager->SetImageName (iDocumentName); - iImageLoaded = ETrue; - InitializeUiItemsL(); - - if (!iOrientationChanged) - { - // Immediately display the loaded image - ((CImageEditorUIView *)iEditorView)-> - SetImageL ( iEditorManager->GetPreviewImage() ); - } - - ApplicationReadyL(); - + + // If there is not enough disk space to save the edited image, show + // error note but continue anyway (user can free up memory before saving) + if (KSIEENotEnoughDiskSpace == err) + { + ShowErrorNoteL(err); + } + else if (KErrNone != err) + { + // Fatal error + User::Leave(err); + } + iEditorManager->SetImageName(iDocumentName); + iImageLoaded = ETrue; + InitializeUiItemsL(); + + if (!iOrientationChanged) + { + // Immediately display the loaded image + ((CImageEditorUIView *) iEditorView)-> SetImageL( + iEditorManager->GetPreviewImage()); + } + + ApplicationReadyL(); + // Do not have to keep file open anymore. // Fixes problem with Online Printing iFile.Close(); - break; - } + break; + } case EOperationCodeSave: case EOperationCodeBlockSave: - { - LOG(KImageEditorLogFile, "CImageEditorAppUi: Image saved"); + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: Image saved"); #ifdef VERBOSE - LOGFMT3(KImageEditorLogFile, "\tiSourceFileName: %S, iDocumentName: %S, iTempSaveFileName: %S", &iSourceFileName, &iDocumentName, &iTempSaveFileName); + LOGFMT3(KImageEditorLogFile, "\tiSourceFileName: %S, iDocumentName: %S, iTempSaveFileName: %S", &iSourceFileName, &iDocumentName, &iTempSaveFileName); #endif - ResetBusy(); - iSaving = EFalse; - - RFs & fs = iEikonEnv->FsSession(); - if ( BaflUtils::FileExists (fs, iTempSaveFileName )) - { - // Image has been successfully saved - iImageSaved = ETrue; - - CFileMan* fileMan = CFileMan::NewL( fs ); - CleanupStack::PushL( fileMan ); - - // the temporary image file and the target file are located in the same drive - if ( iTempSaveFileName.Left(1) == iDocumentName.Left(1) ) - { - User::LeaveIfError( fileMan->Rename( iTempSaveFileName, iDocumentName )); - } - // the temporary image file and the target file are not in the same drive - else - { - User::LeaveIfError( fileMan->Move( iTempSaveFileName, iDocumentName )); - } - CleanupStack::PopAndDestroy(); //fileMan - - // Source file changes (at least if saved with a new name) - iSourceFileName = iDocumentName; - - // Update title - SetFileNameTitlePaneL(iDocumentName); - iEditorManager->SetImageName(iDocumentName); - - LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Temp file renamed to %S", &iDocumentName); - - // Purge undo stack if on the way to exit. - // Don't purge if printing or sending the image. - if( iExitFromApp ) - { - iEditorManager->PurgeUndoRedoHistory(); - } - - FinalizeSaveL(); - } - - if (iExitFromApp) - { - DeleteTempFiles(); - User::Leave (KSIEEErrorOkToExit); - } - else - { - if (iSending) - { - // Restore document name - SetBusy(); - iEditorManager->SetImageName (iDocumentName); - iCallback->DoCallback (KObSendCallbackID); - } - - if (iPrinting) - { - // Restore document name - SetBusy(); - iEditorManager->SetImageName (iDocumentName); - iCallback->DoCallback (KObPrintCallbackID); - } - - // Reset bitmap sink and screen size - UpdateScreenRectL(); - - // Set saved image name for printing - ((CImageEditorUIView *)iEditorView)->SetImageFileName(iDocumentName); - - } - - // Update menu - SetUndoFlag (); - SetOrientationL(EAppUiOrientationUnspecified); - LOG(KImageEditorLogFile, "CImageEditorAppUi: Saving procedure completed"); - break; - } - - default: - { - break; - } - } - } -} + ResetBusy(); + iSaving = EFalse; + + RFs & fs = iEikonEnv->FsSession(); + if (BaflUtils::FileExists(fs, iTempSaveFileName)) + { + // Image has been successfully saved + iImageSaved = ETrue; + + CFileMan* fileMan = CFileMan::NewL(fs); + CleanupStack::PushL(fileMan); + + // the temporary image file and the target file are located in the same drive + if (iTempSaveFileName.Left(1) == iDocumentName.Left(1)) + { + User::LeaveIfError(fileMan->Rename(iTempSaveFileName, + iDocumentName)); + } + // the temporary image file and the target file are not in the same drive + else + { + User::LeaveIfError(fileMan->Move(iTempSaveFileName, + iDocumentName)); + } + CleanupStack::PopAndDestroy(); //fileMan + + // Source file changes (at least if saved with a new name) + iSourceFileName = iDocumentName; + + // Update title + SetFileNameTitlePaneL(iDocumentName); + iEditorManager->SetImageName(iDocumentName); + + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Temp file renamed to %S", &iDocumentName); + + // Purge undo stack if on the way to exit. + // Don't purge if printing or sending the image. + if (iExitFromApp) + { + iEditorManager->PurgeUndoRedoHistory(); + } + + FinalizeSaveL(); + } + + if (iExitFromApp) + { + DeleteTempFiles(); + User::Leave(KSIEEErrorOkToExit); + } + else + { + if (iSending) + { + // Restore document name + SetBusy(); + iEditorManager->SetImageName(iDocumentName); + iCallback->DoCallback(KObSendCallbackID); + } + + if (iPrinting) + { + // Restore document name + SetBusy(); + iEditorManager->SetImageName(iDocumentName); + iCallback->DoCallback(KObPrintCallbackID); + } + + // Reset bitmap sink and screen size + UpdateScreenRectL(); + + // Set saved image name for printing + ((CImageEditorUIView *) iEditorView)->SetImageFileName( + iDocumentName); + + } + + // Update menu + SetUndoFlag(); + SetOrientationL(EAppUiOrientationUnspecified); + LOG(KImageEditorLogFile, "CImageEditorAppUi: Saving procedure completed"); + break; + } + + default: + { + break; + } + } + } + } //============================================================================= -void CImageEditorAppUi::RenderL () -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi: Rendering..."); +void CImageEditorAppUi::RenderL() + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: Rendering..."); SetBusy(); iEditorManager->ProcessImageL(); - ((CImageEditorUIView *)iEditorView)->GetContainer()->DrawNow(); + ((CImageEditorUIView *) iEditorView)->GetContainer()->DrawNow(); ResetBusy(); -} + } //============================================================================= -TKeyResponse CImageEditorAppUi::HandleKeyEventL ( - const TKeyEvent & aKeyEvent, - TEventCode aType - ) -{ - LOGFMT2(KImageEditorLogFile, "CImageEditorAppUi:HandleKeyEventL (aKeyEvent: %d, aType:\t %d)", aKeyEvent,aType); - - TKeyResponse response = EKeyWasNotConsumed; - - // if we are busy doing something +TKeyResponse CImageEditorAppUi::HandleKeyEventL(const TKeyEvent & aKeyEvent, + TEventCode aType) + { + LOGFMT2(KImageEditorLogFile, "CImageEditorAppUi:HandleKeyEventL (aKeyEvent: %d, aType:\t %d)", aKeyEvent,aType); + + TKeyResponse response = EKeyWasNotConsumed; + + // if we are busy doing something // then we consume the key - if ( iBusy || (iConstructionState != EConstructionStateReady) ) - { - response = EKeyWasConsumed; - } + if (iBusy || (iConstructionState != EConstructionStateReady)) + { + response = EKeyWasConsumed; + } // we are only interested in real key events // rather than ups or downs else if (aType != EEventKey) - { - // These are handled separately here because pressing shift key doesn't - // give EEventKey event at all - if ( aType == EEventKeyDown ) - { - switch (aKeyEvent.iScanCode) - { - case EStdKeyLeftShift: - { - iEditorView->HandleCommandL (EImageEditorPreGlobalZoomChange); - ZoomL( EZoomIn ); - iEditorView->HandleCommandL (EImageEditorGlobalZoomChanged); - response = EKeyWasConsumed; - break; - } - case EStdKeyRightShift: - { - iEditorView->HandleCommandL (EImageEditorPreGlobalZoomChange); - ZoomL( EZoomOut ); - iEditorView->HandleCommandL (EImageEditorGlobalZoomChanged); - response = EKeyWasConsumed; - break; - } - } - } - - response = EKeyWasNotConsumed; - } + { + // These are handled separately here because pressing shift key doesn't + // give EEventKey event at all + if (aType == EEventKeyDown) + { + switch (aKeyEvent.iScanCode) + { + case EStdKeyLeftShift: + { + iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); + ZoomL(EZoomIn); + iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); + response = EKeyWasConsumed; + break; + } + case EStdKeyRightShift: + { + iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); + ZoomL(EZoomOut); + iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); + response = EKeyWasConsumed; + break; + } + } + } + + response = EKeyWasNotConsumed; + } // scan codes for numbers are their ASCII codes - else - { - TBool rotated = LandscapeScreenOrientation(); - - switch (aKeyEvent.iScanCode) - { - - case 0x30: // 0 - { -#ifdef FULLSCREEN_AVAILABLE - if (iFullScreen) - { - ResetFullScreenL(); - } - else - { - SetFullScreenL(); - } - response = EKeyWasConsumed; -#endif // FULLSCREEN_AVAILABLE - break; - } -#ifndef LANDSCAPE_ROTATE_HOTKEYS - case 0x31: // 1 -#else - case 0x33: // 3 -#endif - { - RotateL (ERotationCounterClockwise); - response = EKeyWasConsumed; - break; - } - - case 0x32: // 2 + else + { + TBool rotated = LandscapeScreenOrientation(); + + switch (aKeyEvent.iScanCode) { - if (!rotated) - { - PanL (EDirectionUp); - response = EKeyWasConsumed; - } - else + + case 0x30: // 0 { - PanL (EDirectionLeft); - response = EKeyWasConsumed; +#ifdef FULLSCREEN_AVAILABLE + if (iFullScreen) + { + ResetFullScreenL(); + } + else + { + SetFullScreenL(); + } + response = EKeyWasConsumed; +#endif // FULLSCREEN_AVAILABLE + break; } - break; - } - #ifndef LANDSCAPE_ROTATE_HOTKEYS - case 0x33: // 3 -#else - case 0x39: // 9 -#endif - { - RotateL (ERotationClockwise); - response = EKeyWasConsumed; - break; - } - - case 0x34: // 4 - { - if (!rotated) + case 0x31: // 1 +#else + case 0x33: // 3 +#endif { - PanL (EDirectionLeft); - response = EKeyWasConsumed; - } - else - { - PanL (EDirectionDown); - response = EKeyWasConsumed; + RotateL(ERotationCounterClockwise); + response = EKeyWasConsumed; + break; } - break; - } - case 0x35: // 5 - { - // No function - break; - } - - case 0x36: // 6 - { - if (!rotated) + + case 0x32: // 2 + { + if (!rotated) { - PanL (EDirectionRight); - response = EKeyWasConsumed; + PanL(EDirectionUp); + response = EKeyWasConsumed; } else { - PanL (EDirectionUp); - response = EKeyWasConsumed; - } - break; - } - - case 0x38: // 8 - { - if (!rotated) + PanL(EDirectionLeft); + response = EKeyWasConsumed; + } + break; + } + +#ifndef LANDSCAPE_ROTATE_HOTKEYS + case 0x33: // 3 +#else + case 0x39: // 9 +#endif + { + RotateL(ERotationClockwise); + response = EKeyWasConsumed; + break; + } + + case 0x34: // 4 + { + if (!rotated) + { + PanL(EDirectionLeft); + response = EKeyWasConsumed; + } + else + { + PanL(EDirectionDown); + response = EKeyWasConsumed; + } + break; + } + case 0x35: // 5 + { + // No function + break; + } + + case 0x36: // 6 + { + if (!rotated) + { + PanL(EDirectionRight); + response = EKeyWasConsumed; + } + else { - PanL (EDirectionDown); - response = EKeyWasConsumed; + PanL(EDirectionUp); + response = EKeyWasConsumed; + } + break; + } + + case 0x38: // 8 + { + if (!rotated) + { + PanL(EDirectionDown); + response = EKeyWasConsumed; + } + else + { + PanL(EDirectionRight); + response = EKeyWasConsumed; + } + break; + } + + // following cases handle four directions and select key + case EStdKeyRightArrow: + { + PanL(EDirectionRight); + response = EKeyWasConsumed; + break; + } + case EStdKeyLeftArrow: + { + PanL(EDirectionLeft); + response = EKeyWasConsumed; + break; + } + case EStdKeyUpArrow: + { + PanL(EDirectionUp); + response = EKeyWasConsumed; + break; + } + case EStdKeyDownArrow: + { + PanL(EDirectionDown); + response = EKeyWasConsumed; + break; + } + case EStdKeyEnter: + { + TBool zoomedIn = + ((CImageEditorUIView *) iEditorView)->InZoomingState(); + if (zoomedIn) + { + iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); + ZoomL(EZoomIn); + iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); } else { - PanL (EDirectionRight); - response = EKeyWasConsumed; + // display the plugin selection grid if not in zoomed state + HandleCommandL(EImageEditorMenuCmdApplyEffect); + } + response = EKeyWasConsumed; + break; + } + case 0x2a: // * + case EStdKeyNkpAsterisk: // * + case EStdKeyIncVolume: + { + if (iEditorManager->IsPluginLoaded()) + { + if (iEditorManager->GetZoomMode() == EZoomIn3) + { + response = EKeyWasConsumed; + break; + } + } + iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); + ZoomL(EZoomIn); + iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); + response = EKeyWasConsumed; + break; + } + case 0x23: // # + case EStdKeyHash: // # + case EStdKeyDecVolume: + { + if (iEditorManager->IsPluginLoaded()) + { + if (iEditorManager->GetZoomMode() == EZoomNormal) + { + response = EKeyWasConsumed; + break; + } } - break; - } - - // following cases handle four directions and select key - case EStdKeyRightArrow: - { - PanL (EDirectionRight); - response = EKeyWasConsumed; - break; - } - case EStdKeyLeftArrow: - { - PanL (EDirectionLeft); - response = EKeyWasConsumed; - break; - } - case EStdKeyUpArrow: - { - PanL (EDirectionUp); - response = EKeyWasConsumed; - break; - } - case EStdKeyDownArrow: - { - PanL (EDirectionDown); - response = EKeyWasConsumed; - break; - } - case EStdKeyEnter: - { - TBool zoomedIn = ( ( CImageEditorUIView *)iEditorView )->InZoomingState(); - if ( zoomedIn ) - { - iEditorView->HandleCommandL (EImageEditorPreGlobalZoomChange); - ZoomL( EZoomIn ); - iEditorView->HandleCommandL (EImageEditorGlobalZoomChanged); - } - else - { - // display the plugin selection grid if not in zoomed state - HandleCommandL( EImageEditorMenuCmdApplyEffect ); - } - response = EKeyWasConsumed; - break; - } - case 0x2a: // * - case EStdKeyNkpAsterisk: // * - case EStdKeyIncVolume: - { - if ( iEditorManager->IsPluginLoaded() ) - { - if ( iEditorManager->GetZoomMode()== EZoomIn3 ) - { - response = EKeyWasConsumed; - break; - } - } - iEditorView->HandleCommandL (EImageEditorPreGlobalZoomChange); - ZoomL (EZoomIn); - iEditorView->HandleCommandL (EImageEditorGlobalZoomChanged); - response = EKeyWasConsumed; - break; - } - case 0x23: // # - case EStdKeyHash: // # - case EStdKeyDecVolume: - { - if ( iEditorManager->IsPluginLoaded() ) - { - if ( iEditorManager->GetZoomMode()== EZoomNormal ) - { - response = EKeyWasConsumed; - break; - } - } - iEditorView->HandleCommandL (EImageEditorPreGlobalZoomChange); - ZoomL (EZoomOut); - iEditorView->HandleCommandL (EImageEditorGlobalZoomChanged); + iEditorView->HandleCommandL(EImageEditorPreGlobalZoomChange); + ZoomL(EZoomOut); + iEditorView->HandleCommandL(EImageEditorGlobalZoomChanged); response = EKeyWasConsumed; - break; - } - case EStdKeyYes: // green answer call key - { - if (!iEditorManager->IsPluginLoaded()) - { - // when touch is enabled, dialer application is launched - // by the framework and application should not consume - // this key. Otherwise image is saved and send menu opened. - if ( !AknLayoutUtils::PenEnabled() ) - { - if ( !iSending ) - { - SaveChangesAndSendL(); - } - response = EKeyWasConsumed; - } - else - { - response = EKeyWasNotConsumed; - } - } - break; - } - case EStdKeyDevice3: // Select key (OK key) - { - // display the plugin selection grid - HandleCommandL(EImageEditorMenuCmdApplyEffect); - response = EKeyWasConsumed; - break; - } - case EStdKeyNo: // end key - { - iBusy = ETrue; - response = EKeyWasNotConsumed; - break; - } - - default: - { - response = EKeyWasNotConsumed; - break; - } - } - } + break; + } + case EStdKeyYes: // green answer call key + { + if (!iEditorManager->IsPluginLoaded()) + { + // when touch is enabled, dialer application is launched + // by the framework and application should not consume + // this key. Otherwise image is saved and send menu opened. + if (!AknLayoutUtils::PenEnabled()) + { + if (!iSending) + { + SaveChangesAndSendL(); + } + response = EKeyWasConsumed; + } + else + { + response = EKeyWasNotConsumed; + } + } + break; + } + case EStdKeyDevice3: // Select key (OK key) + { + // display the plugin selection grid + HandleCommandL(EImageEditorMenuCmdApplyEffect); + response = EKeyWasConsumed; + break; + } + case EStdKeyNo: // end key + { + iBusy = ETrue; + response = EKeyWasNotConsumed; + break; + } + + default: + { + response = EKeyWasNotConsumed; + break; + } + } + } return response; -} + } //============================================================================= -void CImageEditorAppUi::HandleCommandL (TInt aCommand) -{ - LOGFMT(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL (%d)", aCommand); - - switch ( aCommand ) - { - - /** - * - * MENU COMMANDS - * - */ - - // Launch plug-in selection grid - case EImageEditorMenuCmdApplyEffect: +void CImageEditorAppUi::HandleCommandL(TInt aCommand) + { + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL (%d)", aCommand); + + switch (aCommand) { + + /** + * + * MENU COMMANDS + * + */ + + // Launch plug-in selection grid + case EImageEditorMenuCmdApplyEffect: + { SetBusy(); - iCallback->DoCallback (KObInitPluginID); - break; - } - - // Undo effect + iCallback->DoCallback(KObInitPluginID); + break; + } + + // Undo effect case EImageEditorMenuCmdUndo: - { + { SetBusy(); - iCallback->DoCallback (KObUndoDCallbackID); - break; - } - - // Switch to full screen + iCallback->DoCallback(KObUndoDCallbackID); + break; + } + + // Switch to full screen case EImageEditorMenuCmdFullScreen: - { + { #ifdef FULLSCREEN_AVAILABLE - SetFullScreenL(); + SetFullScreenL(); #endif // FULLSCREEN_AVAILABLE - break; - } - - // Switch to normal screen + break; + } + + // Switch to normal screen case EImageEditorMenuCmdNormalScreen: - { + { #ifdef FULLSCREEN_AVAILABLE - ResetFullScreenL(); + ResetFullScreenL(); #endif // FULLSCREEN_AVAILABLE - break; - } - - // Increase Zoom - case EImageEditorMenuCmdZoomIn: - { - ZoomL (EZoomIn); - break; - } - - // Decrease Zoom - case EImageEditorMenuCmdZoomOut: - { - ZoomL (EZoomOut); - break; - } - - // Set zoom to minimum (=normal image) - case EImageEditorMenuCmdFitToScreen: - { - ZoomL( EZoomMin ); - break; - } - - // Launch CSHelp - case EAknCmdHelp: - case EImageEditorMenuCmdHelp: - { - CArrayFix* context = CCoeAppUi::AppHelpContextL(); - if (context) - { - HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), context); - } - break; - } - case EImageEditorMenuCmdSave: - { - if ( ! ((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel() ) - { - QueryAndSaveL(); - } - break; - } - - // Close editor - case EImageEditorMenuCmdExit: - { - TBool exitNow = ETrue; - if ( iEditorManager->IsImageChanged() ) - { - if ( ! ((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel() ) - { - // launch "Save changes?" query - TInt result = ((CImageEditorUIView *)iEditorView)->LaunchSaveChangesQueryL(); - if( result == EImageEditorSoftkeyCmdYes ) - { - if (QueryAndSaveL()) - { - SetBusy(); - iExitFromApp = ETrue; - exitNow = EFalse; - LOG(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL: Hide application from Fast-swap window."); - CAknAppUi::HideApplicationFromFSW(ETrue); - } - else - { - iExitFromApp = EFalse; - exitNow = EFalse; - } - - } - else if( result == EImageEditorSoftkeyCmdNo ) - { - // do nothing, exitNow == ETrue - } - else - { - // Automatic cancel may have occurred, don't exit - iExitFromApp = EFalse; - exitNow = EFalse; - } - } - } - - if (exitNow) - { - DeleteTempFiles(); - RunAppShutter(); - - - //Exit(); - } - break; - } - - /** - * - * SOFTKEY COMMANDS - * - */ - - // Back softkey pressed => Close editor + break; + } + + // Increase Zoom + case EImageEditorMenuCmdZoomIn: + { + ZoomL(EZoomIn); + break; + } + + // Decrease Zoom + case EImageEditorMenuCmdZoomOut: + { + ZoomL(EZoomOut); + break; + } + + // Set zoom to minimum (=normal image) + case EImageEditorMenuCmdFitToScreen: + { + ZoomL(EZoomMin); + break; + } + + // Launch CSHelp + case EAknCmdHelp: + case EImageEditorMenuCmdHelp: + { + CArrayFix* context = CCoeAppUi::AppHelpContextL(); + if (context) + { + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), + context); + } + break; + } + case EImageEditorMenuCmdSave: + { + if (!((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel()) + { + QueryAndSaveL(); + } + break; + } + + // Close editor + case EImageEditorMenuCmdExit: + { + TBool exitNow = ETrue; + if (iEditorManager->IsImageChanged()) + { + if (!((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel()) + { + // launch "Save changes?" query + TInt + result = + ((CImageEditorUIView *) iEditorView)->LaunchSaveChangesQueryL(); + if (result == EImageEditorSoftkeyCmdYes) + { + if (QueryAndSaveL()) + { + SetBusy(); + iExitFromApp = ETrue; + exitNow = EFalse; + LOG(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL: Hide application from Fast-swap window."); + CAknAppUi::HideApplicationFromFSW(ETrue); + } + else + { + iExitFromApp = EFalse; + exitNow = EFalse; + } + + } + else if (result == EImageEditorSoftkeyCmdNo) + { + // do nothing, exitNow == ETrue + } + else + { + // Automatic cancel may have occurred, don't exit + iExitFromApp = EFalse; + exitNow = EFalse; + } + } + } + + if (exitNow) + { + DeleteTempFiles(); + RunAppShutter(); + + //Exit(); + } + break; + } + + /** + * + * SOFTKEY COMMANDS + * + */ + + // Back softkey pressed => Close editor case EImageEditorSoftkeyCmdBack: - { - TBool exitNow = ETrue; - if (iSaving || iCancelling) - { - // ignore - } - if ( ! ((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel() ) - { - if ( iEditorManager->IsImageChanged() ) - { - // launch "Save changes?" query - TInt result = ((CImageEditorUIView *)iEditorView)->LaunchSaveChangesQueryL(); - if( result == EImageEditorSoftkeyCmdYes ) - { - if (QueryAndSaveL()) - { - SetBusy(); - iExitFromApp = ETrue; - exitNow = EFalse; - LOG(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL: Hide application from Fast-swap window."); - CAknAppUi::HideApplicationFromFSW(ETrue); - } - else - { - iExitFromApp = EFalse; - exitNow = EFalse; - } - - } - else if( result == EImageEditorSoftkeyCmdNo ) - { - // do nothing, exitNow == ETrue - } - else - { - // Automatic cancel may have occurred, don't exit - iExitFromApp = EFalse; - exitNow = EFalse; - } - } - } - - if (exitNow) - { - DeleteTempFiles(); - RunAppShutter(); - //ProcessCommandL(EAknCmdExit); - } - break; - } - - /** - * - * SYSTEM COMMANDS - * - */ - - case EEikCmdExit: - { - LOG(KImageEditorLogFile, "CImageEditorAppUi: EEikCmdExit caught"); + { + TBool exitNow = ETrue; + if (iSaving || iCancelling) + { + // ignore + } + if (!((CImageEditorUIView*) iEditorView)->IsMemoryInCriticalLevel()) + { + if (iEditorManager->IsImageChanged()) + { + // launch "Save changes?" query + TInt + result = + ((CImageEditorUIView *) iEditorView)->LaunchSaveChangesQueryL(); + if (result == EImageEditorSoftkeyCmdYes) + { + if (QueryAndSaveL()) + { + SetBusy(); + iExitFromApp = ETrue; + exitNow = EFalse; + LOG(KImageEditorLogFile, "CImageEditorAppUi:HandleCommandL: Hide application from Fast-swap window."); + CAknAppUi::HideApplicationFromFSW(ETrue); + } + else + { + iExitFromApp = EFalse; + exitNow = EFalse; + } + + } + else if (result == EImageEditorSoftkeyCmdNo) + { + // do nothing, exitNow == ETrue + } + else + { + // Automatic cancel may have occurred, don't exit + iExitFromApp = EFalse; + exitNow = EFalse; + } + } + } + + if (exitNow) + { + DeleteTempFiles(); + RunAppShutter(); + //ProcessCommandL(EAknCmdExit); + } + break; + } + + /** + * + * SYSTEM COMMANDS + * + */ + + case EEikCmdExit: + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: EEikCmdExit caught"); DeleteTempFiles(); - Exit(); - break; - } - - /** - * - * MISC COMMANDS - * - */ - - // Render image - case EImageEditorCmdRender: - { - RenderL(); - break; - } - - case EImageEditorCmdViewReady: - { - - LOG(KImageEditorLogFile, "CImageEditorAppUi: View ready"); + Exit(); + break; + } + + /** + * + * MISC COMMANDS + * + */ + + // Render image + case EImageEditorCmdRender: + { + RenderL(); + break; + } + case EImageEditorResetFullScreen: + { + ResetFullScreenL(); + } + case EImageEditorCmdViewReady: + { + + LOG(KImageEditorLogFile, "CImageEditorAppUi: View ready"); iEditorReady = ETrue; - // Initialize UI items - InitializeUiItemsL(); + // Initialize UI items + InitializeUiItemsL(); ApplicationReadyL(); - break; - } + break; + } case EImageEditorApplyPlugin: - { + { // Return from plug-in - SetBusy(); - iCallback->DoCallback (KObReturnFromPluginID); - break; - } - - case EImageEditorCancelPlugin: - { + SetBusy(); + iCallback->DoCallback(KObReturnFromPluginID); + break; + } + + case EImageEditorCancelPlugin: + { SetBusy(); iCancelling = ETrue; - iCallback->DoCallback (KObCancelCallbackID); - break; - } - - case EImageEditorAddFilterToEngine: - { - // Add the current plugin parameters to engine - // and continue with the same plugin +// ResetFullScreenL(); + iPluginName.Copy(KNull); + iCallback->DoCallback(KObCancelCallbackID); + break; + } + + case EImageEditorAddFilterToEngine: + { + // Add the current plugin parameters to engine + // and continue with the same plugin iEditorManager->AddFilterToEngineL(); - break; - } - - case EImageEditorStoreParameters: - { - break; - } - - case EImageEditorUndoFilter: - { - // Undo one filter (can be called if one plugin - // has put more than one filter to the engine) - SetBusy(); - iEditorManager->UndoL(); - SetUndoFlag(); - ((CImageEditorUIView *)iEditorView)->GetContainer()->DrawNow(); + break; + } + + case EImageEditorStoreParameters: + { + break; + } + + case EImageEditorUndoFilter: + { + // Undo one filter (can be called if one plugin + // has put more than one filter to the engine) + SetBusy(); + iEditorManager->UndoL(); + SetUndoFlag(); + ((CImageEditorUIView *) iEditorView)->GetContainer()->DrawNow(); ResetBusy(); - break; - } - - case EImageEditorSaveAndPrint: - { - if ( iEditorManager->IsImageChanged() ) - { - iPrinting = ETrue; - SaveImageL(); - } - else - { - SetBusy(); - iCallback->DoCallback (KObPrintCallbackID); - } - break; - } - case EImageEditorResetZoom: - { - // If this is called rendering must be done separately - iEditorManager->ZoomL( EZoomMin ); - ((CImageEditorUIView *)iEditorView)->SetZoomModeL( iEditorManager->GetZoomMode() ); - break; - } - case EImageEditorCmdTouchPan: - { - TouchPanL(); - break; - } - case EImageEditorOpenContextMenu: - { - CAknViewAppUi::ProcessCommandL(EAknSoftkeyContextOptions); - break; - } - default: - { - // CSendUi commands - if (aCommand >= EImageEditorMenuCmdSend && - aCommand < EImageEditorMenuCmdSendLast) - { - SetBusy(); - SaveChangesAndSendL(); - break; - } - - /** - * - * BEVERLY HILLS - * - */ - else - { - // Do not handle unknown commands - ResetBusy(); - break; - } - } + break; + } + + case EImageEditorSaveAndPrint: + { + if (iEditorManager->IsImageChanged()) + { + iPrinting = ETrue; + SaveImageL(); + } + else + { + SetBusy(); + iCallback->DoCallback(KObPrintCallbackID); + } + break; + } + case EImageEditorResetZoom: + { + // If this is called rendering must be done separately + iEditorManager->ZoomL(EZoomMin); + ((CImageEditorUIView *) iEditorView)->SetZoomModeL( + iEditorManager->GetZoomMode()); + break; + } + case EImageEditorCmdTouchPan: + { + TouchPanL(); + break; + } + case EImageEditorOpenContextMenu: + { + CAknViewAppUi::ProcessCommandL(EAknSoftkeyContextOptions); + break; + } + default: + { + // CSendUi commands + if (aCommand >= EImageEditorMenuCmdSend && aCommand + < EImageEditorMenuCmdSendLast) + { + SetBusy(); + SaveChangesAndSendL(); + break; + } + + /** + * + * BEVERLY HILLS + * + */ + else + { + // Do not handle unknown commands + ResetBusy(); + break; + } + } + } } -} //============================================================================= -void CImageEditorAppUi::HandleWsEventL ( - const TWsEvent & aEvent, - CCoeControl * aDestination - ) -{ +void CImageEditorAppUi::HandleWsEventL(const TWsEvent & aEvent, + CCoeControl * aDestination) + { #ifdef VERBOSE - LOGFMT3 (KImageEditorLogFile, "CImageEditorAppUi::HandleWsEventL: aEvent.Type() == %d, aEvent.Key().iCode == %d, aEvent.Key().iScanCode == %d", aEvent.Type(), (TInt)aEvent.Key()->iCode, (TInt)aEvent.Key()->iScanCode); + LOGFMT3 (KImageEditorLogFile, "CImageEditorAppUi::HandleWsEventL: aEvent.Type() == %d, aEvent.Key().iCode == %d, aEvent.Key().iScanCode == %d", aEvent.Type(), (TInt)aEvent.Key()->iCode, (TInt)aEvent.Key()->iScanCode); #endif - switch ( aEvent.Type() ) - { - - case EEventFocusLost: - { + switch (aEvent.Type()) + { + + case EEventFocusLost: + { iForeground = EFalse; break; - } - - case EEventFocusGained: - { - - // Update the screen rect when we gain focus. - // This isn't really needed every time, it should only do this if something has changed - if (iImageController) - { - UpdateScreenRectL(); - } - - if (iFullScreen) - { - StatusPane()->MakeVisible ( EFalse ); - } + } + + case EEventFocusGained: + { + + // Update the screen rect when we gain focus. + // This isn't really needed every time, it should only do this if something has changed + if (iImageController) + { + UpdateScreenRectL(); + } + + if (iFullScreen) + { + StatusPane()->MakeVisible(EFalse); + } iForeground = ETrue; break; - } + } default: - { + { break; - } - - } - - if ( ( aEvent.Type() == KAknUidValueEndKeyCloseEvent) && iEditorManager->IsImageChanged() ) + } + + } + + if ((aEvent.Type() == KAknUidValueEndKeyCloseEvent) + && iEditorManager->IsImageChanged()) { if (iCancelling) { return; } - iExitFromApp = ETrue; + iExitFromApp = ETrue; if (iSaving) { iImageController->CancelOperation(ETrue); @@ -1146,215 +1130,215 @@ return; } - TInt err = ImageEditorUtils::GenerateNewDocumentNameL ( - iEikonEnv->FsSession(), - iSourceFileName, - iDocumentName, - &iSourceImageMgAlbumIdList - ); - SaveImageOverWriteL( EFalse ); + TInt err = ImageEditorUtils::GenerateNewDocumentNameL( + iEikonEnv->FsSession(), iSourceFileName, iDocumentName, + &iSourceImageMgAlbumIdList); + SaveImageOverWriteL(EFalse); } else { - TInt err( 0 ); - TRAP( err, CAknViewAppUi::HandleWsEventL( aEvent, aDestination ) ); + TInt err(0); + TRAP( err, CAknViewAppUi::HandleWsEventL( aEvent, aDestination ) ); } -} - + } //============================================================================= void CImageEditorAppUi::HandleScreenDeviceChangedL() - { - - LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleScreenDeviceChangedL()"); - - // Work-a-round to avoid softkeys to drawn incorrectly - // when a dialog is open when changing to view mode - if (iConstructionState == EConstructionStateReady && - iSaving == EFalse && - iSending == EFalse ) - { - StopDisplayingMenuBar(); - } - - CAknViewAppUi::HandleScreenDeviceChangedL(); - - TBool visibleFlag = EFalse; - if (((CImageEditorUIView *)iEditorView)->GetContainer()) - { - visibleFlag = ((CImageEditorUIView *)iEditorView)->GetContainer()->IsVisible(); - } - - // If orientation changes during loading - screen bitmap need to be recreated - // In the start-up there can be event from system without screen device change - if (!iImageLoaded && iConstructionState != EConstructionStateAlloc ) - { - iOrientationChanged = ETrue; - // Set landscape parameter - if (LandscapeScreenOrientation()) - { - iResolutionUtil->SetLandscape(ETrue); - } - else - { - iResolutionUtil->SetLandscape(EFalse); - } - - iResolutionUtil->UpdateScreenMode(); - TRect rect; - iResolutionUtil->GetClientRect(rect); - CCoeControl * control = ((CImageEditorUIView *)iEditorView)->GetContainer(); + { + + LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleScreenDeviceChangedL()"); + // Work-a-round to avoid softkeys to drawn incorrectly + // when a dialog is open when changing to view mode + if (iConstructionState == EConstructionStateReady && iSaving == EFalse + && iSending == EFalse) + { + StopDisplayingMenuBar(); + } + + CAknViewAppUi::HandleScreenDeviceChangedL(); + + //called while screen mode change + if (!iStandby) + { + if (iPluginName == KDrawPlugin) + { + InitialHorizontalDrawPlugin(); + } + } + iStandby = EFalse; + + TBool visibleFlag = EFalse; + if (((CImageEditorUIView *) iEditorView)->GetContainer()) + { + visibleFlag + = ((CImageEditorUIView *) iEditorView)->GetContainer()->IsVisible(); + } + + // If orientation changes during loading - screen bitmap need to be recreated + // In the start-up there can be event from system without screen device change + if (!iImageLoaded && iConstructionState != EConstructionStateAlloc) + { + iOrientationChanged = ETrue; + // Set landscape parameter + if (LandscapeScreenOrientation()) + { + iResolutionUtil->SetLandscape(ETrue); + } + else + { + iResolutionUtil->SetLandscape(EFalse); + } + + iResolutionUtil->UpdateScreenMode(); + TRect rect; + iResolutionUtil->GetClientRect(rect); + CCoeControl * control = + ((CImageEditorUIView *) iEditorView)->GetContainer(); control->SetRect(rect); - } - - // Update screen rects if we are currently in the foreground. - else if ((iForeground && iImageController) || visibleFlag) - { - UpdateScreenRectL(); - } - -} + } + + // Update screen rects if we are currently in the foreground. + else if ((iForeground && iImageController) || visibleFlag) + { + UpdateScreenRectL(); + } + + } //============================================================================= TBool CImageEditorAppUi::LandscapeScreenOrientation() -{ - - LOG(KImageEditorLogFile, "CImageEditorAppUi::LandscapeScreenOrientation()"); - - TBool orientation = EFalse; + { + + LOG(KImageEditorLogFile, "CImageEditorAppUi::LandscapeScreenOrientation()"); + + TBool orientation = EFalse; #ifdef LANDSCAPE_SUPPORT - TRect rect; - - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect); - - if ( rect.iBr.iX > rect.iBr.iY ) - { - orientation = ETrue; - } + TRect rect; + + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect); + + if (rect.iBr.iX > rect.iBr.iY) + { + orientation = ETrue; + } else - { - orientation = EFalse; - } + { + orientation = EFalse; + } #endif - LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Orientation (%d)", (TInt)orientation); - - return orientation; -} + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Orientation (%d)", (TInt)orientation); + + return orientation; + } //============================================================================= -void CImageEditorAppUi::HandleForegroundEventL (TBool aForeground) -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleForegroundEventL()"); +void CImageEditorAppUi::HandleForegroundEventL(TBool aForeground) + { + LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleForegroundEventL()"); if (aForeground) - { - if ( !BaflUtils::FileExists( iEikonEnv->Static()->FsSession() , iSourceFileName ) ) + { + if (!BaflUtils::FileExists(iEikonEnv->Static()->FsSession(), + iSourceFileName)) { DeleteTempFiles(); RunAppShutter(); } - if ( iProcessPriorityAltered ) - { - // Return to normal priority. - RProcess myProcess; - TProcessPriority priority = myProcess.Priority(); - if ( priority < iOriginalProcessPriority ) + if (iProcessPriorityAltered) { - myProcess.SetPriority( iOriginalProcessPriority ); + // Return to normal priority. + RProcess myProcess; + TProcessPriority priority = myProcess.Priority(); + if (priority < iOriginalProcessPriority) + { + myProcess.SetPriority(iOriginalProcessPriority); + } + iProcessPriorityAltered = EFalse; + iStandby = ETrue; } - iProcessPriorityAltered = EFalse; + + // Check that application is in sync with the system + if (!iImageLoaded && iConstructionState != EConstructionStateAlloc) + { + iOrientationChanged = ETrue; + } + else if (iResolutionUtil && LandscapeScreenOrientation() + != iResolutionUtil->GetLandscape()) + { + UpdateScreenRectL(); + } + + iEditorView->HandleCommandL(EImageEditorFocusGained); } - - // Check that application is in sync with the system - if (!iImageLoaded && iConstructionState != EConstructionStateAlloc ) - { - iOrientationChanged = ETrue; - } - else if (iResolutionUtil && LandscapeScreenOrientation() != iResolutionUtil->GetLandscape()) - { - UpdateScreenRectL(); - } - - iEditorView->HandleCommandL (EImageEditorFocusGained); - } else - { - iEditorView->HandleCommandL (EImageEditorFocusLost); + { + iEditorView->HandleCommandL(EImageEditorFocusLost); // Set the priority to low. This is needed to handle the situations // where the engine is performing heavy processing while the application // is in background. RProcess myProcess; iOriginalProcessPriority = myProcess.Priority(); - myProcess.SetPriority( EPriorityLow ); + myProcess.SetPriority(EPriorityLow); iProcessPriorityAltered = ETrue; - - + iStandby = ETrue; + + } + CAknViewAppUi::HandleForegroundEventL(aForeground); } - CAknViewAppUi::HandleForegroundEventL (aForeground); -} - //============================================================================= -TBool CImageEditorAppUi::ProcessCommandParametersL ( - TApaCommand aCommand, - TFileName & aDocumentName, - const TDesC8 & aTail - ) -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi::ProcessCommandParametersL"); - - /* ------------- : test only ---------- - if ( this->ContainerAppUi() == NULL ) // launched as standalone +TBool CImageEditorAppUi::ProcessCommandParametersL(TApaCommand aCommand, + TFileName & aDocumentName, const TDesC8 & aTail) { - aDocumentName = _L("C:\\Data\\Images\\test.jpg"); - }; - // ---------------- test only ------------- */ - + LOG(KImageEditorLogFile, "CImageEditorAppUi::ProcessCommandParametersL"); + // Store command parameter document name - iDocumentName.Copy (aDocumentName); - - // Save original document name - iSourceFileName.Copy(aDocumentName); - - // Set document name for printing - ((CImageEditorUIView *)iEditorView)->SetImageFileName(iDocumentName); - - // Return default action - return CAknViewAppUi::ProcessCommandParametersL (aCommand, aDocumentName, aTail); + iDocumentName.Copy(aDocumentName); + + // Save original document name + iSourceFileName.Copy(aDocumentName); + + // Set document name for printing + ((CImageEditorUIView *) iEditorView)->SetImageFileName(iDocumentName); + + // Return default action + return CAknViewAppUi::ProcessCommandParametersL(aCommand, aDocumentName, + aTail); } //============================================================================= void CImageEditorAppUi::OpenFileL(RFile &aFile) - { - LOG(KImageEditorLogFile, "CImageEditorAppUi::OpenFileL"); + { + LOG(KImageEditorLogFile, "CImageEditorAppUi::OpenFileL"); // This function should be called only when editor is started // as an embedded application. - // Store command parameter document name - aFile.FullName(iDocumentName); + // Store command parameter document name + aFile.FullName(iDocumentName); // Open file for editor // File must be opened until editor is closed, otherwise // shared session is lost -> Error code -14. - RFs& fs = iEikonEnv->FsSession(); - fs.ShareProtected(); + RFs& fs = iEikonEnv->FsSession(); + fs.ShareProtected(); TInt err = iFile.Open(fs, iDocumentName, EFileRead | EFileShareReadersOnly); if (KErrNone != err) { - User::LeaveIfError(iFile.Open(fs, iDocumentName, EFileRead | EFileShareAny)); + User::LeaveIfError(iFile.Open(fs, iDocumentName, EFileRead + | EFileShareAny)); } - // Save original document name - aFile.FullName(iSourceFileName); - - // Set document name for printing - ((CImageEditorUIView *)iEditorView)->SetImageFileName(iDocumentName); + // Save original document name + aFile.FullName(iSourceFileName); + + // Set document name for printing + ((CImageEditorUIView *) iEditorView)->SetImageFileName(iDocumentName); // If OpenFileL was not called when the startup sequence reached // the point where it needs the document name, the construction was @@ -1363,763 +1347,746 @@ { // Resume construction iConstructionState = EConstructionStateLoadImage; - iCallback->DoCallback (KObConstructCallBackID); + iCallback->DoCallback(KObConstructCallBackID); } - } + } //============================================================================= CArrayFix* CImageEditorAppUi::HelpContextL() const -{ - CArrayFixFlat* array = - new(ELeave)CArrayFixFlat(1); - CleanupStack::PushL(array); - - TBool zoomedIn = ( ( CImageEditorUIView *)iEditorView )->InZoomingState(); - if ( zoomedIn ) - { - array->AppendL(TCoeHelpContext(TUid::Uid(UID_IMAGE_EDITOR), KSIE_HLP_ZOOMING)); - } - else - { - array->AppendL(TCoeHelpContext(TUid::Uid(UID_IMAGE_EDITOR), KSIE_HLP_MAIN)); - } - - CleanupStack::Pop(array); - return array; -} + { + CArrayFixFlat* array = new (ELeave) CArrayFixFlat< + TCoeHelpContext> (1); + CleanupStack::PushL(array); + + TBool zoomedIn = ((CImageEditorUIView *) iEditorView)->InZoomingState(); + if (zoomedIn) + { + array->AppendL(TCoeHelpContext(TUid::Uid(UID_IMAGE_EDITOR), + KSIE_HLP_ZOOMING)); + } + else + { + array->AppendL(TCoeHelpContext(TUid::Uid(UID_IMAGE_EDITOR), + KSIE_HLP_MAIN)); + } + + CleanupStack::Pop(array); + return array; + } //============================================================================= -void CImageEditorAppUi::InitializePluginL () -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi: Initialising plugin"); - - // Get pointer to the view - CImageEditorUIView * view = (CImageEditorUIView *)iEditorView; - +void CImageEditorAppUi::InitializePluginL() + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: Initialising plugin"); + + // Get pointer to the view + CImageEditorUIView * view = (CImageEditorUIView *) iEditorView; + // Close the previous plug-in iEditorManager->ClosePlugin(); + + // Open a new plug-in + CPluginInfo * pgn_info = view->GetSelectedPluginInfoL(); + + if (pgn_info) + { + iEditorManager->OpenPluginL(pgn_info->PluginDll()->Des()); + iPluginName.Copy(pgn_info->PluginDll()->Des()); - // Open a new plug-in - CPluginInfo * pgn_info = view->GetSelectedPluginInfoL(); - - if (pgn_info) - { - iEditorManager->OpenPluginL ( pgn_info->PluginDll()->Des() ); - - LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin opened"); - - // current rect - TRect rect; - iResolutionUtil->GetClientRect(rect); - - // Create a plug-in control - // Ownership is moved to the plug-in - CCoeControl * control = NULL; - TInt err = iEditorManager->CreatePluginControlL ( - rect, - view->GetContainer(), - control - ); - - LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin control created"); - - // The plug-in activation was cancelled - if (err != KErrNone) - { - // Cancel plug-in - iCancelling = ETrue; - iCallback->DoCallback (KObCancelCallbackID); - } - - // Activate plug-in - else - { - - // Register control to UI - view->ActivatePluginL (control); - - LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin activated"); - - - // If the filter did not have a control, close plug-in - if ( !control ) - { - iEditorManager->ClosePlugin(); - - } - - // Set the last opened image to editor view - ((CImageEditorUIView *)iEditorView)->SetImageL ( - iEditorManager->GetPreviewImage() - ); - - ResetBusy(); - } - } + //judge if it is draw plug-in + if (iPluginName != KNull && iPluginName == KDrawPlugin) + { + ((CImageEditorUIContainer *) ((CImageEditorUIView *) iEditorView)->GetContainer())->IsDrawPlugin(ETrue); + SetFullScreenL(); + } + else + { + ((CImageEditorUIContainer *) ((CImageEditorUIView *) iEditorView)->GetContainer())->IsDrawPlugin(EFalse); + } + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin opened"); + + // current rect + TRect rect; + iResolutionUtil->GetClientRect(rect); + + // Create a plug-in control + // Ownership is moved to the plug-in + CCoeControl * control = NULL; + TInt err = iEditorManager->CreatePluginControlL(rect,view->GetContainer(), control); + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin control created"); + + // The plug-in activation was cancelled + if (err != KErrNone) + { + // Cancel plug-in + iCancelling = ETrue; + iCallback->DoCallback(KObCancelCallbackID); + } + // Activate plug-in + else + { + // Register control to UI + view->ActivatePluginL(control); + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin activated"); + + // If the filter did not have a control, close plug-in + if (!control) + { + iEditorManager->ClosePlugin(); + } + + // Set the last opened image to editor view + ((CImageEditorUIView *) iEditorView)->SetImageL(iEditorManager->GetPreviewImage()); + + ResetBusy(); + } + } + else - { + { ResetBusy(); + } } -} //============================================================================= -void CImageEditorAppUi::CreatePluginLocatorL () -{ - iLocator = CPluginLocator::NewL(); -} - -//============================================================================= -void CImageEditorAppUi::CreateEditorManagerL () -{ - iEditorManager = CImageEditorPluginManager::NewL(); -} +void CImageEditorAppUi::CreatePluginLocatorL() + { + iLocator = CPluginLocator::NewL(); + } //============================================================================= -void CImageEditorAppUi::CreateImageControllerL () -{ - iImageController = CImageController::NewL (this, iEditorManager); -} +void CImageEditorAppUi::CreateEditorManagerL() + { + iEditorManager = CImageEditorPluginManager::NewL(); + } //============================================================================= -void CImageEditorAppUi::LoadPluginsL () -{ - // Scan plug-ins - iLocator->ScanPluginsL (); -} +void CImageEditorAppUi::CreateImageControllerL() + { + iImageController = CImageController::NewL(this, iEditorManager); + } //============================================================================= -void CImageEditorAppUi::InitializeUiItemsL () -{ - - LOG (KImageEditorLogFile, "CImageEditorAppUi: InitializeUiItemsL"); - - // Set UI items - if (iEditorReady && iPluginsScanned && iImageLoaded) - { - for (TInt i = 0, c = iLocator->CountPlugins(); i < c; ++i) - { - ((CImageEditorUIView *)iEditorView)->AddPluginUiItemL (iLocator->GetPluginInfo(i)); - } - - // Set the last opened image to editor view - ((CImageEditorUIView *)iEditorView)->SetImageL ( - iEditorManager->GetPreviewImage() - ); - - SetFileNameTitlePaneL(iSourceFileName); - - ((CImageEditorUIView *)iEditorView)->SetZoomModeL( iEditorManager->GetZoomMode() ); +void CImageEditorAppUi::LoadPluginsL() + { + // Scan plug-ins + iLocator->ScanPluginsL(); + } + +//============================================================================= +void CImageEditorAppUi::InitializeUiItemsL() + { + + LOG (KImageEditorLogFile, "CImageEditorAppUi: InitializeUiItemsL"); + + // Set UI items + if (iEditorReady && iPluginsScanned && iImageLoaded) + { + for (TInt i = 0, c = iLocator->CountPlugins(); i < c; ++i) + { + ((CImageEditorUIView *) iEditorView)->AddPluginUiItemL(iLocator->GetPluginInfo(i)); + } + + SetFileNameTitlePaneL(iSourceFileName); + + ((CImageEditorUIView *) iEditorView)->SetZoomModeL(iEditorManager->GetZoomMode()); LOG (KImageEditorLogFile, "CImageEditorAppUi: Plugins initialized"); - - } -} + } + } //============================================================================= void CImageEditorAppUi::ApplicationReadyL() -{ - LOG (KImageEditorLogFile, "CImageEditorAppUi: ApplicationReadyLL"); - - // Set UI items - if (iEditorReady && iPluginsScanned && iImageLoaded) - { - if ( iOrientationChanged ) - { - LOG(KImageEditorLogFile, - "CImageEditorAppUi: Orientation changed, updating screen rect"); - // Check that application is in sync with the system - // This should fix the problem with screen update after image is loading when - // screen is folded during loading - UpdateScreenRectL(); - iOrientationChanged = EFalse; - } - else if ( ( LandscapeScreenOrientation() && - ( StatusPane()->CurrentLayoutResId() != - R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) ) ) - { - LOG(KImageEditorLogFile, - "CImageEditorAppUi: Status pane needs to be changed->updating screen rect"); - // Updating screen rect updates also status pane to correct "flat version" - UpdateScreenRectL(); - } - + { + LOG (KImageEditorLogFile, "CImageEditorAppUi: ApplicationReadyLL"); + + // Set UI items + if (iEditorReady && iPluginsScanned && iImageLoaded) + { + if (iOrientationChanged) + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: Orientation changed, updating screen rect"); + // Check that application is in sync with the system + // This should fix the problem with screen update after image is loading when + // screen is folded during loading + UpdateScreenRectL(); + iOrientationChanged = EFalse; + } + else if ((LandscapeScreenOrientation() + && (StatusPane()->CurrentLayoutResId() + != R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT))) + { + LOG(KImageEditorLogFile,"CImageEditorAppUi: Status pane needs to be changed->updating screen rect"); + // Updating screen rect updates also status pane to correct "flat version" + UpdateScreenRectL(); + } + TRect screenRect; CResolutionUtil::Self()->GetClientRect(screenRect); iOldScreenRect = screenRect; ResetBusy(); - + // Open Plugin selection grid right away when application start is finished //HandleCommandL(EImageEditorMenuCmdApplyEffect); - + + } } -} - //============================================================================= -void CImageEditorAppUi::LoadImageL () -{ - LOGFMT (KImageEditorLogFile, "CImageEditorAppUi: Loading image (%S)", &iSourceFileName); +void CImageEditorAppUi::LoadImageL() + { + + LOGFMT (KImageEditorLogFile, "CImageEditorAppUi: Loading image (%S)", &iSourceFileName); // Load the image to be edited - iImageController->LoadImageL (iSourceFileName); -} + iImageController->LoadImageL(iSourceFileName); + } //============================================================================= -void CImageEditorAppUi::SaveImageL () -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi: Saving image"); - - // Check if source image still exists - if (!BaflUtils::FileExists(iEikonEnv->FsSession(), iSourceFileName)) - { - if (iExitFromApp) - { - TInt exit = - ((CImageEditorUIView *)iEditorView)->LaunchExitWithoutSavingQueryL(); - if (exit) - { - // Exit - User::Leave (KSIEEErrorOkToExit); - } - else - { - iExitFromApp = EFalse; - User::Leave(KSIEEInternal); - } - } - else - { - User::Leave(KSIEEInternal); - } - } - - // Check document name if not saved yet or memory card removed - if ( !iImageSaved || - !BaflUtils::PathExists(iEikonEnv->FsSession(), iTempSaveFileName.Left(3))) - { - // If not saved yet, check that document name is valid - SetImageNameL(); - } +void CImageEditorAppUi::SaveImageL() + { + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Saving image"); + + // Check if source image still exists + if (!BaflUtils::FileExists(iEikonEnv->FsSession(), iSourceFileName)) + { + if (iExitFromApp) + { + TInt exit = ((CImageEditorUIView *) iEditorView)->LaunchExitWithoutSavingQueryL(); + if (exit) + { + // Exit + User::Leave(KSIEEErrorOkToExit); + } + else + { + iExitFromApp = EFalse; + User::Leave(KSIEEInternal); + } + } + else + { + User::Leave(KSIEEInternal); + } + } + + // Check document name if not saved yet or memory card removed + if (!iImageSaved || !BaflUtils::PathExists(iEikonEnv->FsSession(), + iTempSaveFileName.Left(3))) + { + // If not saved yet, check that document name is valid + SetImageNameL(); + } // Set temp save image name to engine - iEditorManager->SetImageName (iTempSaveFileName); - - SetLayoutAwareApp(EFalse); - // Launch save wait note - LaunchSaveWaitNoteL (); - - iCallback->DoCallback (KObSaveCallbackID); - -} + iEditorManager->SetImageName(iTempSaveFileName); + + SetLayoutAwareApp(EFalse); + // Launch save wait note + LaunchSaveWaitNoteL(); + + iCallback->DoCallback(KObSaveCallbackID); + + } //============================================================================= void CImageEditorAppUi::SetImageNameL() - { - - // Create new document name - // (note that this also selects the drive where the image is saved) - TInt err = ImageEditorUtils::GenerateNewDocumentNameL ( - iEikonEnv->FsSession(), - iSourceFileName, - iDocumentName, - &iSourceImageMgAlbumIdList - ); - User::LeaveIfError (err); // cannot save the image - iEditorManager->SetImageName (iDocumentName); - - // Change title pane text - SetFileNameTitlePaneL(iSourceFileName); + { + + // Create new document name + // (note that this also selects the drive where the image is saved) + TInt err = ImageEditorUtils::GenerateNewDocumentNameL( + iEikonEnv->FsSession(), iSourceFileName, iDocumentName, + &iSourceImageMgAlbumIdList); + User::LeaveIfError(err); // cannot save the image + iEditorManager->SetImageName(iDocumentName); + + // Change title pane text + SetFileNameTitlePaneL(iSourceFileName); // Check that everything is in order with the file - CheckFileL (iDocumentName); - - // Generate temporary save file name - TParse tempFileParser; - tempFileParser.Set (KTempSaveFile, &KTempPath, &iDocumentName); - iTempSaveFileName.Copy (tempFileParser.FullName()); - BaflUtils::EnsurePathExistsL (iEikonEnv->FsSession(), iTempSaveFileName); - - } - + CheckFileL(iDocumentName); + + // Generate temporary save file name + TParse tempFileParser; + tempFileParser.Set(KTempSaveFile, &KTempPath, &iDocumentName); + iTempSaveFileName.Copy(tempFileParser.FullName()); + BaflUtils::EnsurePathExistsL(iEikonEnv->FsSession(), iTempSaveFileName); + + } //============================================================================= void CImageEditorAppUi::SaveChangesAndSendL() -{ - - LOG(KImageEditorLogFile, "CImageEditorAppUi::SaveChangesAndSendL()"); - - iSending = ETrue; - - // Delete old temp files if exists - DeleteTempFiles(); - - if (iEditorManager->IsImageChanged()) - { - // Save image - SaveImageL(); - - } - // Otherwise send last saved image - else - { - SendImageL (); - } - -} + { + + LOG(KImageEditorLogFile, "CImageEditorAppUi::SaveChangesAndSendL()"); + + iSending = ETrue; + + // Delete old temp files if exists + DeleteTempFiles(); + + if (iEditorManager->IsImageChanged()) + { + // Save image + SaveImageL(); + } + // Otherwise send last saved image + else + { + SendImageL(); + } + + } //============================================================================= -void CImageEditorAppUi::SendImageL () -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi::SendImageL()"); - - ResetBusy(); - - RFs& fs = iEikonEnv->FsSession(); - TFileName fileToSend; - - // Check if image has been modified and saved - if (BaflUtils::FileExists(fs, iDocumentName)) - { - fileToSend.Append(iDocumentName); - } - // Use source file if no changes done - else - { - fileToSend.Append(iSourceFileName); - } - - LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Sending image: %S", &fileToSend); - - iEikonEnv->SetBusy(ETrue); - +void CImageEditorAppUi::SendImageL() + { + LOG(KImageEditorLogFile, "CImageEditorAppUi::SendImageL()"); + + ResetBusy(); + + RFs& fs = iEikonEnv->FsSession(); + TFileName fileToSend; + + // Check if image has been modified and saved + if (BaflUtils::FileExists(fs, iDocumentName)) + { + fileToSend.Append(iDocumentName); + } + // Use source file if no changes done + else + { + fileToSend.Append(iSourceFileName); + } + + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Sending image: %S", &fileToSend); + + iEikonEnv->SetBusy(ETrue); + // Launch send query dialog - TSendingCapabilities cap( 0, 0, TSendingCapabilities::ESupportsAttachments ); - ((CImageEditorUIView *)iEditorView)->LaunchSendQueryL(cap, fileToSend); - - iSending = EFalse; - iEikonEnv->SetBusy(EFalse); -} + TSendingCapabilities cap(0, 0, TSendingCapabilities::ESupportsAttachments); + ((CImageEditorUIView *) iEditorView)->LaunchSendQueryL(cap, fileToSend); + + iSending = EFalse; + iEikonEnv->SetBusy(EFalse); + } //============================================================================= -void CImageEditorAppUi::CheckFileL (const TDesC & aFileName) const -{ +void CImageEditorAppUi::CheckFileL(const TDesC & aFileName) const + { RFs & fs = iEikonEnv->FsSession(); // Is file name valid - if ( !fs.IsValidName (aFileName) ) - { - User::Leave ( KSIEESaveFile ); + if (!fs.IsValidName(aFileName)) + { + User::Leave(KSIEESaveFile); + } } -} - //============================================================================= -TBool CImageEditorAppUi::CallbackMethodL (TInt aParam) -{ +TBool CImageEditorAppUi::CallbackMethodL(TInt aParam) + { LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::CallbackMethodL (%d)", aParam); - TBool ret = EFalse; - - switch (aParam) - { - - case KObConstructCallBackID: + TBool ret = EFalse; + + switch (aParam) { - - switch (iConstructionState) - { - - case EConstructionStateAlloc: - { - // Launch wait note - LaunchLoadWaitNoteL(); - - // Initialize resolution utility. CResolutionUtil::InitializeL() - // Returns the singleton instance of the class, creating it if - // it does not yet exist. - iResolutionUtil = CResolutionUtil::InitializeL(); + case KObConstructCallBackID: + { + switch (iConstructionState) + { + case EConstructionStateAlloc: + { + // Launch wait note + LaunchLoadWaitNoteL(); + + // Initialize resolution utility. CResolutionUtil::InitializeL() + // Returns the singleton instance of the class, creating it if + // it does not yet exist. + iResolutionUtil = CResolutionUtil::InitializeL(); iResolutionUtil->SetFullScreen(EFalse); #ifdef LANDSCAPE_SUPPORT - // Set landscape parameter - if (LandscapeScreenOrientation()) - { - iResolutionUtil->SetLandscape(ETrue); - } - else - { - iResolutionUtil->SetLandscape(EFalse); - } + // Set landscape parameter + if (LandscapeScreenOrientation()) + { + iResolutionUtil->SetLandscape(ETrue); + } + else + { + iResolutionUtil->SetLandscape(EFalse); + } #else #ifdef LANDSCAPE_ONLY iResolutionUtil->SetLandscape(ETrue); #else - iResolutionUtil->SetLandscape(EFalse); + iResolutionUtil->SetLandscape(EFalse); #endif #endif // LANDSCAPE_SUPPORT - - iResolutionUtil->UpdateScreenMode(); - LOG(KImageEditorLogFile, "CImageEditorAppUi: Resolution set"); - - // Create the Send UI instance - iSendAppUi = CSendUi::NewL(); - ((CImageEditorUIView *)iEditorView)->SetSendAppUi(iSendAppUi); - - // Create plug-in locator - CreatePluginLocatorL(); + iResolutionUtil->UpdateScreenMode(); + LOG(KImageEditorLogFile, "CImageEditorAppUi: Resolution set"); + + // Create the Send UI instance + iSendAppUi = CSendUi::NewL(); + ((CImageEditorUIView *) iEditorView)->SetSendAppUi(iSendAppUi); + + // Create plug-in locator + CreatePluginLocatorL(); LOG(KImageEditorLogFile, "Locator created"); - // Create plug-in manager - CreateEditorManagerL(); + + // Create plug-in manager + CreateEditorManagerL(); LOG(KImageEditorLogFile, "Manager created"); - // Create image controller - CreateImageControllerL(); + + // Create image controller + CreateImageControllerL(); LOG(KImageEditorLogFile, "Image Controller created"); - iConstructionState = EConstructionStateLoadImage; - ret = ETrue; - break; - } - - case EConstructionStateLoadImage: - { + iConstructionState = EConstructionStateLoadImage; + ret = ETrue; + break; + } + + case EConstructionStateLoadImage: + { LOG(KImageEditorLogFile, "Loading image"); // iSourceFileName is available (in embedded mode) only after // CImageEditorDocument::OpenFileL has been called by the system. // If that has not been done if (!iSourceFileName.Length()) - { + { iConstructionState = EConstructionStateWaitForStartupParameters; ret = EFalse; - } + } else - { - // Kill wait note before loading image. - // Some corrupted images loading stacks if wait note is displayd - //KillWaitNote(); - - // Relaunch wait note - //LaunchLoadWaitNoteL(); - - // Load image - LoadImageL(); - - SetFileNameTitlePaneL(iSourceFileName); - iConstructionState = EConstructionStateScanPlugins; - ret = ETrue; + { + // Kill wait note before loading image. + // Some corrupted images loading stacks if wait note is displayd + //KillWaitNote(); + + // Relaunch wait note + //LaunchLoadWaitNoteL(); + + // Load image + LoadImageL(); + + SetFileNameTitlePaneL(iSourceFileName); + iConstructionState = EConstructionStateScanPlugins; + ret = ETrue; + } + break; } - break; - } - - case EConstructionStateScanPlugins: - { + + case EConstructionStateScanPlugins: + { LOG(KImageEditorLogFile, "Scanning plugins"); - LoadPluginsL(); - iConstructionState = EConstructionStateInitUi; - ret = ETrue; - break; - } - - case EConstructionStateInitUi: - { + LoadPluginsL(); + iConstructionState = EConstructionStateInitUi; + ret = ETrue; + break; + } + + case EConstructionStateInitUi: + { LOG(KImageEditorLogFile, "Init UI"); - // Initialize UI items - iPluginsScanned = ETrue; - InitializeUiItemsL(); - iConstructionState = EConstructionStateReady; - ret = ETrue; - break; - } - - default: - { + // Initialize UI items + iPluginsScanned = ETrue; + InitializeUiItemsL(); + iConstructionState = EConstructionStateReady; + ret = ETrue; + break; + } + + default: + { LOG(KImageEditorLogFile, "Ready"); KillWaitNote(); - ApplicationReadyL(); - break; - } - } - break; - } + ApplicationReadyL(); + break; + } + } + break; + } case KObReturnFromPluginID: - { - SetUndoFlag(); + { + SetUndoFlag(); iEditorManager->ShowPluginPopup(); iEditorManager->ClosePlugin(); - - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - ((CImageEditorUIView *)iEditorView)->ActivateMainViewL(); - - ((CImageEditorUIView *)iEditorView)->SetImageL ( - iEditorManager->GetPreviewImage()); - + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + ((CImageEditorUIView *) iEditorView)->ActivateMainViewL(); + + //Only for draw plug-in + if (iPluginName != KNull && iPluginName == KDrawPlugin) + { + iPluginName.Copy(KNull); + ResetFullScreenL(); + } + ResetBusy(); break; - } + } case KObInitPluginID: - { - InitializePluginL (); - SetUndoFlag(); + { + InitializePluginL(); + SetUndoFlag(); break; - } + } case KObCancelCallbackID: - { + { + TRect rect; + CResolutionUtil::Self()->GetClientRect(rect); + CCoeControl* control = ((CImageEditorUIView *) iEditorView)->GetContainer(); + control->SetRect(rect); + iEditorManager->ClosePlugin(); - iEditorManager->UndoL(); - - - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - ((CImageEditorUIView *)iEditorView)->ActivateMainViewL(); - - ((CImageEditorUIView *)iEditorView)->SetImageL ( - iEditorManager->GetPreviewImage()); - - SetUndoFlag(); + iEditorManager->UndoL(); + + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + ((CImageEditorUIView *) iEditorView)->ActivateMainViewL(); + + ((CImageEditorUIView *) iEditorView)->SetImageL(iEditorManager->GetPreviewImage()); + + SetUndoFlag(); ResetBusy(); iCancelling = EFalse; break; - } + } case KObUndoDCallbackID: - { - iEditorManager->UndoL(); - SetUndoFlag(); - ((CImageEditorUIView *)iEditorView)->GetContainer()->DrawNow(); + { + iEditorManager->UndoL(); + SetUndoFlag(); + ((CImageEditorUIView *) iEditorView)->GetContainer()->DrawNow(); ResetBusy(); break; - } + } case KObSendCallbackID: - { - SendImageL (); - ResetBusy(); + { + SendImageL(); + ResetBusy(); + break; + } + + case KObPrintCallbackID: + { + // Reset first otherwise canceling print application + // leaves busy state active + iPrinting = EFalse; + ResetBusy(); + ((CImageEditorUIView *) iEditorView)-> HandleCommandL(EImageEditorDoPrint); break; + } + + case KObSaveCallbackID: + { + // Start saving + iImageController->SaveImageL(iTempSaveFileName); + iSaving = ETrue; + break; + } + + default: + { + break; + } } - case KObPrintCallbackID: - { - // Reset first otherwise canceling print application - // leaves busy state active - iPrinting = EFalse; - ResetBusy(); - ((CImageEditorUIView *)iEditorView)-> - HandleCommandL(EImageEditorDoPrint); - break; - } - - case KObSaveCallbackID: - { - // Start saving - iImageController->SaveImageL (iTempSaveFileName); - - iSaving = ETrue; - break; - } - - default: + return ret; + } + +//============================================================================= +void CImageEditorAppUi::SetBusy() + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: SetBusy()"); + if (iEditorView) { - break; + ((CImageEditorUIView *) iEditorView)->SetBusy(); + } + iBusy = ETrue; + } + +//============================================================================= +void CImageEditorAppUi::ResetBusy() + { + + LOG(KImageEditorLogFile, "CImageEditorAppUi: ResetBusy()"); + // Keep busy until application is fully constructed + if (iConstructionState == EConstructionStateReady) + { + if (iEditorView) + { + ((CImageEditorUIView *) iEditorView)->ResetBusy(); + } + iBusy = EFalse; } } - return ret; -} - -//============================================================================= -void CImageEditorAppUi::SetBusy () -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi: SetBusy()"); - if (iEditorView) - { - ((CImageEditorUIView *)iEditorView)->SetBusy(); - } - iBusy = ETrue; -} - -//============================================================================= -void CImageEditorAppUi::ResetBusy () -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi: ResetBusy()"); - // Keep busy until application is fully constructed - if (iConstructionState == EConstructionStateReady) - { - if (iEditorView) - { - ((CImageEditorUIView *)iEditorView)->ResetBusy(); - } - iBusy = EFalse; - } -} - //============================================================================= -void CImageEditorAppUi::SetFullScreenL () -{ - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - - LOG(KImageEditorLogFile, "CImageEditorAppUi: Setting full screen"); - - iFullScreen = ETrue; - - // Set to full screen mode - ((CImageEditorUIView *)iEditorView)->SetFullScreen(); - - // In the startup image controller might not be created yet - if (iImageController) - { - // Update new screen resolution - UpdateScreenRectL(); - } - - -} +void CImageEditorAppUi::SetFullScreenL() + { + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Setting full screen"); + + iFullScreen = ETrue; + + // Set to full screen mode + ((CImageEditorUIView *) iEditorView)->SetFullScreen(); + + // In the startup image controller might not be created yet + if (iImageController) + { + // Update new screen resolution + UpdateScreenRectL(); + } + + } //============================================================================= -void CImageEditorAppUi::ResetFullScreenL () -{ - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - - LOG(KImageEditorLogFile, "CImageEditorAppUi: Resetting full screen"); - - iFullScreen = EFalse; - - // Set to full screen mode - ((CImageEditorUIView *)iEditorView)->ResetFullScreen(); - - // In the startup image controller might not be created yet - if (iImageController) - { - UpdateScreenRectL(); - } - -} +void CImageEditorAppUi::ResetFullScreenL() + { + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Resetting full screen"); + + iFullScreen = EFalse; + + // Set to full screen mode + ((CImageEditorUIView *) iEditorView)->ResetFullScreen(); + + // In the startup image controller might not be created yet + if (iImageController) + { + UpdateScreenRectL(); + } + + } //============================================================================= -void CImageEditorAppUi::SetUndoFlag () -{ - if (iEditorView) - { - ((CImageEditorUIView *)iEditorView)->SetUndoFlag( iEditorManager->CanUndo() ); - ((CImageEditorUIView *)iEditorView)->SetSaveFlag( iEditorManager->IsImageChanged() ); - } -} +void CImageEditorAppUi::SetUndoFlag() + { + if (iEditorView) + { + ((CImageEditorUIView *) iEditorView)->SetUndoFlag(iEditorManager->CanUndo()); + ((CImageEditorUIView *) iEditorView)->SetSaveFlag(iEditorManager->IsImageChanged()); + } + } //============================================================================= -void CImageEditorAppUi::SetTitlePaneTextL (const TDesC & aText) -{ - const TInt KMaximumTitleTextLength = 13; - - if (iEditorView) - { - HBufC * title_text = HBufC::NewLC ( aText.Length() ); - TPtr title_text_ptr = title_text->Des(); - - // No truncation - if ( aText.Length() - 4 < KMaximumTitleTextLength ) - { - // Copy whole file name - title_text_ptr.Copy (aText); - } - - // With truncation - else - { - - // Copy maximum amount of the file - title_text_ptr.Copy ( aText.Left (KMaximumTitleTextLength) ); - - // Append horizontal ellipsis - title_text_ptr.Append ( KBaflCharTruncation ); - - // Append sequence number - _LIT(KSearchWildcard, "*-???"); - TInt offset = aText.Match (KSearchWildcard); - if ( offset != KErrNotFound ) - { - title_text_ptr.Append ( aText.Mid (offset, 4) ); - } - - } - - // Set title pane text - ((CImageEditorUIView *)iEditorView)->SetTitlePaneTextL (title_text_ptr); - - CleanupStack::PopAndDestroy(); // title_text - } -} +void CImageEditorAppUi::SetTitlePaneTextL(const TDesC & aText) + { + const TInt KMaximumTitleTextLength = 13; + + if (iEditorView) + { + HBufC * title_text = HBufC::NewLC(aText.Length()); + TPtr title_text_ptr = title_text->Des(); + + // No truncation + if (aText.Length() - 4 < KMaximumTitleTextLength) + { + // Copy whole file name + title_text_ptr.Copy(aText); + } + // With truncation + else + { + // Copy maximum amount of the file + title_text_ptr.Copy(aText.Left(KMaximumTitleTextLength)); + + // Append horizontal ellipsis + title_text_ptr.Append(KBaflCharTruncation); + // Append sequence number + _LIT(KSearchWildcard, "*-???"); + TInt offset = aText.Match(KSearchWildcard); + if (offset != KErrNotFound) + { + title_text_ptr.Append(aText.Mid(offset, 4)); + } + } + // Set title pane text + ((CImageEditorUIView *) iEditorView)->SetTitlePaneTextL(title_text_ptr); + + CleanupStack::PopAndDestroy(); // title_text + } + } //============================================================================= -void CImageEditorAppUi::ClearTitlePaneTextL () -{ - if (iEditorView) - { - ((CImageEditorUIView *)iEditorView)->ClearTitlePaneTextL (); - } -} - +void CImageEditorAppUi::ClearTitlePaneTextL() + { + if (iEditorView) + { + ((CImageEditorUIView *) iEditorView)->ClearTitlePaneTextL(); + } + } //============================================================================= -void CImageEditorAppUi::SetFileNameTitlePaneL (const TDesC& aFullFileName) -{ - TParsePtrC parser (aFullFileName); - SetTitlePaneTextL ( parser.Name() ); -} +void CImageEditorAppUi::SetFileNameTitlePaneL(const TDesC& aFullFileName) + { + TParsePtrC parser(aFullFileName); + SetTitlePaneTextL(parser.Name()); + } //============================================================================= void CImageEditorAppUi::ClearNaviPaneTextL() -{ - if (iEditorView) - { - ((CImageEditorUIView *)iEditorView)->ClearNaviPaneTextL(); - } -} - + { + if (iEditorView) + { + ((CImageEditorUIView *) iEditorView)->ClearNaviPaneTextL(); + } + } //============================================================================= void CImageEditorAppUi::UpdateScreenRectL() - { - LOG(KImageEditorLogFile, "CImageEditorAppUi::UpdateScreenRectL()"); - - if (iEditorView == NULL || - iEditorManager == NULL || - iImageController == NULL) + { + LOG(KImageEditorLogFile, "CImageEditorAppUi::UpdateScreenRectL()"); + + if (iEditorView == NULL || iEditorManager == NULL || iImageController == NULL) { return; } - - iEditorView->HandleCommandL (EImageEditorPreScreenModeChange); - - // Set Full screen parameter - iResolutionUtil->SetFullScreen(iFullScreen); + + iEditorView->HandleCommandL(EImageEditorPreScreenModeChange); + + // Set Full screen parameter + iResolutionUtil->SetFullScreen(iFullScreen); #ifdef LANDSCAPE_SUPPORT - // Set landscape parameter - if (LandscapeScreenOrientation()) - { - iResolutionUtil->SetLandscape(ETrue); - } - else - { - iResolutionUtil->SetLandscape(EFalse); - } + // Set landscape parameter + if (LandscapeScreenOrientation()) + { + iResolutionUtil->SetLandscape(ETrue); + } + else + { + iResolutionUtil->SetLandscape(EFalse); + } #else #ifdef LANDSCAPE_ONLY iResolutionUtil->SetLandscape(ETrue); #else - iResolutionUtil->SetLandscape(EFalse); + iResolutionUtil->SetLandscape(EFalse); #endif #endif - // Update view layout - ((CImageEditorUIView *)iEditorView)->UpdateLayoutL( - iEikonEnv->ScreenDevice()->CurrentScreenMode()); + // Update view layout + ((CImageEditorUIView *) iEditorView)->UpdateLayoutL(iEikonEnv->ScreenDevice()->CurrentScreenMode()); LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: CurrentScreenMode() = %d", iEikonEnv->ScreenDevice()->CurrentScreenMode() ); - // Set current screen size to resolution util - iResolutionUtil->UpdateScreenMode(); + // Set current screen size to resolution util + iResolutionUtil->UpdateScreenMode(); // Check if screen size has changed TRect newScreenRect; @@ -2129,37 +2096,38 @@ LOG(KImageEditorLogFile, "CImageEditorAppUi: Not setting new preview image"); return; } - iOldScreenRect = newScreenRect; - - LOG(KImageEditorLogFile, "CImageEditorAppUi: Setting new preview image"); - - // Create screen bitmap for new screen size - iImageController->CreatePreviewBitmapL(); - if ((iConstructionState == EConstructionStateReady || - iConstructionState == EConstructionStateInitUi) && - !iSaving && iImageLoaded ) - { - iEditorManager->SetScreenSizeL(); - } - + + iOldScreenRect = newScreenRect; + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Setting new preview image"); + + // Create screen bitmap for new screen size + iImageController->CreatePreviewBitmapL(); + if ((iConstructionState == EConstructionStateReady || iConstructionState + == EConstructionStateInitUi) && !iSaving && iImageLoaded) + { + iEditorManager->SetScreenSizeL(); + } + // Set the new image pointer to editor view if (!iSaving) { - ((CImageEditorUIView *)iEditorView)->SetImageL ( - iEditorManager->GetPreviewImage() - ); + ((CImageEditorUIView *) iEditorView)->SetImageL( + iEditorManager->GetPreviewImage()); } else // if saving cannot update new image until saving is completed. { - iOrientationChanged = ETrue; - ((CImageEditorUIView *)iEditorView)->SetImageL ( NULL ); + iOrientationChanged = ETrue; + ((CImageEditorUIView *) iEditorView)->SetImageL(NULL); } // Set container extent to whole screen - CCoeControl * control = ((CImageEditorUIView *)iEditorView)->GetContainer(); + CCoeControl * control = + ((CImageEditorUIView *) iEditorView)->GetContainer(); if (control) { - if (iFullScreen) + //if it is draw plug-in + if (iFullScreen || iPluginName == KDrawPlugin) { control->SetExtentToWholeScreen(); } @@ -2170,748 +2138,777 @@ control->SetRect(rect); } - if (control->IsFocused()) - { - control->DrawNow(); - } - } - - iEditorView->HandleCommandL (EImageEditorPostScreenModeChange); - - } - + if (control->IsFocused()) + { + control->DrawNow(); + } + } + + iEditorView->HandleCommandL(EImageEditorPostScreenModeChange); + + } //============================================================================= -void CImageEditorAppUi::ZoomL (const TZoom aZoom) - { - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - __ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); - SetBusy(); - - // Zoom - iEditorManager->ZoomL (aZoom); - - RenderL(); +void CImageEditorAppUi::ZoomL(const TZoom aZoom) + { + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + __ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); + SetBusy(); + + // Zoom + iEditorManager->ZoomL(aZoom); + + RenderL(); iEditorManager->GetSystemParameters(); - // Inform the view about current zoom mode - ((CImageEditorUIView *)iEditorView)-> - SetZoomModeL( iEditorManager->GetZoomMode() ); - } + // Inform the view about current zoom mode + ((CImageEditorUIView *) iEditorView)-> SetZoomModeL(iEditorManager->GetZoomMode()); + } //============================================================================= -void CImageEditorAppUi::PanL (TDirection aDirection) -{ - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - __ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); - - iEditorView->HandleCommandL (EImageEditorPreGlobalPanChange); - - SetBusy(); +void CImageEditorAppUi::PanL(TDirection aDirection) + { + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + __ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); + + iEditorView->HandleCommandL(EImageEditorPreGlobalPanChange); + + SetBusy(); // Pan - iEditorManager->PanL (aDirection); - - RenderL(); - iEditorManager->GetSystemParameters(); - - ResetBusy(); - - iEditorView->HandleCommandL (EImageEditorGlobalPanChanged); -} + iEditorManager->PanL(aDirection); + + RenderL(); + iEditorManager->GetSystemParameters(); + + ResetBusy(); + + iEditorView->HandleCommandL(EImageEditorGlobalPanChanged); + } //============================================================================= -void CImageEditorAppUi::TouchPanL () -{ - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - __ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); - - iEditorView->HandleCommandL (EImageEditorPreGlobalPanChange); - - SetBusy(); - - // Fetch directions - TInt xMovement(0); - TInt yMovement(0); - - ((CImageEditorUIView *)iEditorView)->GetTouchPanDirections( xMovement, yMovement ); - +void CImageEditorAppUi::TouchPanL() + { + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + __ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); + + iEditorView->HandleCommandL(EImageEditorPreGlobalPanChange); + + SetBusy(); + + // Fetch directions + TInt xMovement(0); + TInt yMovement(0); + + ((CImageEditorUIView *) iEditorView)->GetTouchPanDirections(xMovement,yMovement); + // Pan - iEditorManager->PanL( xMovement, yMovement ); - - RenderL(); - iEditorManager->GetSystemParameters(); - - ResetBusy(); - - iEditorView->HandleCommandL (EImageEditorGlobalPanChanged); -} + iEditorManager->PanL(xMovement, yMovement); + + RenderL(); + iEditorManager->GetSystemParameters(); + + ResetBusy(); + + iEditorView->HandleCommandL(EImageEditorGlobalPanChanged); + } //============================================================================= -void CImageEditorAppUi::RotateL (const TRotation aRot) -{ +void CImageEditorAppUi::RotateL(const TRotation aRot) + { __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); __ASSERT_ALWAYS( iEditorManager, User::Panic(KComponentName, EImageEditorPanicNoEditorManager) ); if (!iEditorManager->IsPluginLoaded()) - { - iEditorManager->RotateL (aRot); + { + iEditorManager->RotateL(aRot); RenderL(); SetUndoFlag(); - iEditorView->HandleCommandL (EImageEditorGlobalRotationChanged); + iEditorView->HandleCommandL(EImageEditorGlobalRotationChanged); + } } -} //============================================================================= -void CImageEditorAppUi::LaunchLoadWaitNoteL () -{ - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - - SetBusy(); - ((CImageEditorUIView *)iEditorView)->LaunchWaitDialog( ); - -// if (!iWaitNote) -// { -// ((CImageEditorUIView *)iEditorView)->LaunchLoadWaitDialogL( &iWaitNote, this ); -// } -} +void CImageEditorAppUi::LaunchLoadWaitNoteL() + { + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + + SetBusy(); + ((CImageEditorUIView *) iEditorView)->LaunchWaitDialog(); + + // if (!iWaitNote) + // { + // ((CImageEditorUIView *)iEditorView)->LaunchLoadWaitDialogL( &iWaitNote, this ); + // } + } //============================================================================= -void CImageEditorAppUi::LaunchSaveWaitNoteL () -{ - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - TAppUiOrientation orientation(EAppUiOrientationPortrait); - if(LandscapeScreenOrientation()) - { - orientation = EAppUiOrientationLandscape; - } - - SetOrientationL(orientation); - if (!iProgressNote) - { - ((CImageEditorUIView *)iEditorView)->LaunchSaveWaitDialogL( &iProgressNote, 100, this ); +void CImageEditorAppUi::LaunchSaveWaitNoteL() + { + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + TAppUiOrientation orientation(EAppUiOrientationPortrait); + if (LandscapeScreenOrientation()) + { + orientation = EAppUiOrientationLandscape; + } + + SetOrientationL(orientation); + if (!iProgressNote) + { + ((CImageEditorUIView *) iEditorView)->LaunchSaveWaitDialogL(&iProgressNote, 100, this); iSaving = ETrue; - } -} + } + } //============================================================================= -void CImageEditorAppUi::KillWaitNote () -{ - - -/* if (iWaitNote) - { - // If the application is exiting, iWaitNote->ProcessFinishedL() - // apparently does not finish in time and does something after the - // application has been deleted, causing USER 0 panic on debug builds. - delete iWaitNote; - iWaitNote = NULL; - } */ - - if (iProgressNote) - { - delete iProgressNote; - iProgressNote = NULL; - } - else - { - // This can be hidden in all cases. If dialog is not active, nothing - // special happens - ((CImageEditorUIView *)iEditorView)->HideWaitDialog( ); - // Commented due to multiple ResetBusy() call during initialization: - //ResetBusy(); - } -} - +void CImageEditorAppUi::KillWaitNote() + { + + /* if (iWaitNote) + { + // If the application is exiting, iWaitNote->ProcessFinishedL() + // apparently does not finish in time and does something after the + // application has been deleted, causing USER 0 panic on debug builds. + delete iWaitNote; + iWaitNote = NULL; + } */ + + if (iProgressNote) + { + delete iProgressNote; + iProgressNote = NULL; + } + else + { + // This can be hidden in all cases. If dialog is not active, nothing + // special happens + ((CImageEditorUIView *) iEditorView)->HideWaitDialog(); + // Commented due to multiple ResetBusy() call during initialization: + //ResetBusy(); + } + } //============================================================================= void CImageEditorAppUi::IncrementProgressBarL(const TInt aIncrement) -{ - __ASSERT_ALWAYS( iProgressNote, User::Panic(KComponentName, EImageEditorPanicNoProgressDialog) ); - - CEikProgressInfo * progi = iProgressNote->GetProgressInfoL(); - if (progi) - { - progi->IncrementAndDraw (aIncrement); - } -} + { + __ASSERT_ALWAYS( iProgressNote, User::Panic(KComponentName, EImageEditorPanicNoProgressDialog) ); + + CEikProgressInfo * progi = iProgressNote->GetProgressInfoL(); + if (progi) + { + progi->IncrementAndDraw(aIncrement); + } + } //============================================================================= -void CImageEditorAppUi::DialogDismissedL( TInt aButtonId ) -{ - LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::DialogDismissedL( %d )", aButtonId); - - if( aButtonId == EAknSoftkeyCancel ) - { - - if ( !iSaving ) - { +void CImageEditorAppUi::DialogDismissedL(TInt aButtonId) + { + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::DialogDismissedL( %d )", aButtonId); + + if (aButtonId == EAknSoftkeyCancel) + { + if (!iSaving) + { iCallback->Cancel(); - iImageController->CancelOperation(ETrue); - } - else - { - iImageController->CancelOperation(); - } + iImageController->CancelOperation(ETrue); + } + else + { + iImageController->CancelOperation(); + } iWaitNote = NULL; - + ResetBusy(); - } -} + } + } //============================================================================= -TErrorHandlerResponse CImageEditorAppUi::HandleError ( - TInt aError, - const SExtendedError & aExtErr, - TDes & aErrorText, - TDes & aContextText - ) -{ - LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::HandleError: %d", aError); +TErrorHandlerResponse CImageEditorAppUi::HandleError(TInt aError,const SExtendedError & aExtErr, TDes & aErrorText, TDes & aContextText) + { + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::HandleError: %d", aError); // Reset busy flag - KillWaitNote (); + KillWaitNote(); ResetBusy(); iCancelling = EFalse; iSaving = EFalse; - TErrorHandlerResponse ret = ENoDisplay; - - // Handle Image Editor errors - if ( (aError < KSIEEErrorBase) && (aError > KSIEEErrorMax) ) - { - TRAPD ( err, HandleErrorL (aError) ); - if ( err == KErrNoMemory ) + TErrorHandlerResponse ret = ENoDisplay; + + // Handle Image Editor errors + if ((aError < KSIEEErrorBase) && (aError > KSIEEErrorMax)) { - Exit(); + TRAPD ( err, HandleErrorL (aError) ); + if (err == KErrNoMemory) + { + Exit(); + } } - } - - // Let the framework handle system errors - else if ( aError == KErrNoMemory ) - { + + // Let the framework handle system errors + else if (aError == KErrNoMemory) + { iImageController->Cancel(); - ret = CAknViewAppUi::HandleError (aError, aExtErr, aErrorText, aContextText); - Exit (); - } - // KErrCancel is returned when Bluetooth send is cancelled - // No need to show error dialog - else if ( aError == KErrCancel ) - { - // Nothing to do - } - else if ((aError == KErrArgument) || (aError == KErrInUse)) - { - // Show error note - HandleErrorL (aError); - } - //end - else if ( (aError <= KErrExtended) && (aError >= KLeaveExit) ) - { - ret = CAknViewAppUi::HandleError (aError, aExtErr, aErrorText, aContextText); - // Close plugin if error occurs, otherwise plugin may crash - iEditorManager->ClosePlugin(); - - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->ActivateMainViewL() ); - - TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->SetImageL ( - iEditorManager->GetPreviewImage()) ); - } - else - { - ret = CAknViewAppUi::HandleError (aError, aExtErr, aErrorText, aContextText); - // Close plugin if error occurs, otherwise plugin may crash - iEditorManager->ClosePlugin(); - - __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); - - TRAPD( err, ((CImageEditorUIView *)iEditorView)->ActivateMainViewL() ); - - TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->SetImageL ( - iEditorManager->GetPreviewImage()) ); - - if ( err == KErrNoMemory ) + ret = CAknViewAppUi::HandleError(aError, aExtErr, aErrorText,aContextText); + Exit(); + } + // KErrCancel is returned when Bluetooth send is cancelled + // No need to show error dialog + else if (aError == KErrCancel) + { + // Nothing to do + } + else if ((aError == KErrArgument) || (aError == KErrInUse)) + { + // Show error note + HandleErrorL(aError); + } + //end + else if ((aError <= KErrExtended) && (aError >= KLeaveExit)) { - Exit(); + ret = CAknViewAppUi::HandleError(aError, aExtErr, aErrorText,aContextText); + // Close plugin if error occurs, otherwise plugin may crash + iEditorManager->ClosePlugin(); + + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->ActivateMainViewL() ); + + TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->SetImageL (iEditorManager->GetPreviewImage()) ); } - } - return ret; -} + else + { + ret = CAknViewAppUi::HandleError(aError, aExtErr, aErrorText, + aContextText); + // Close plugin if error occurs, otherwise plugin may crash + iEditorManager->ClosePlugin(); + + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + TRAPD( err, ((CImageEditorUIView *)iEditorView)->ActivateMainViewL() ); + + TRAP_IGNORE( ((CImageEditorUIView *)iEditorView)->SetImageL ( + iEditorManager->GetPreviewImage()) ); + if (err == KErrNoMemory) + { + Exit(); + } + } + return ret; + } //============================================================================= -void CImageEditorAppUi::HandleErrorL (const TInt aError) -{ +void CImageEditorAppUi::HandleErrorL(const TInt aError) + { // Show error note - ShowErrorNoteL (aError); + ShowErrorNoteL(aError); // Handle error - switch ( aError ) - { - - case KSIEEErrorOkToExit: - case KSIEEOpenFile: - case KSIEEExifRead: - case KSIEEInternalNonRecoverable: - case KSIEEIncompatibleImage: + switch (aError) { + case KSIEEErrorOkToExit: + case KSIEEOpenFile: + case KSIEEExifRead: + case KSIEEInternalNonRecoverable: + case KSIEEIncompatibleImage: + { // For some weird reason, in some cases when trying to // exit from CImageEditorAppUi::OperationReadyL, calling // Exit() here won't exit the application. RunAppShutter(); break; - } + } default: - { - // Close plugin if error occurs, otherwise plugin may crash - if (iEditorManager) - { - iEditorManager->ClosePlugin(); - - } - if (iEditorView) - { - ((CImageEditorUIView *)iEditorView)->ActivateMainViewL(); - ((CImageEditorUIView *)iEditorView)->SetImageL ( - iEditorManager->GetPreviewImage()); - } + { + // Close plugin if error occurs, otherwise plugin may crash + if (iEditorManager) + { + iEditorManager->ClosePlugin(); + + } + if (iEditorView) + { + ((CImageEditorUIView *) iEditorView)->ActivateMainViewL(); + ((CImageEditorUIView *) iEditorView)->SetImageL(iEditorManager->GetPreviewImage()); + } break; + } } } -} //============================================================================= -void CImageEditorAppUi::ShowErrorNoteL (const TInt aError) const -{ +void CImageEditorAppUi::ShowErrorNoteL(const TInt aError) const + { TInt res_id = -1; switch (aError) - { - case KErrNotFound: + { + case KErrNotFound: case KSIEEOpenFile: - case KSIEEExifRead: - case KSIEEIncompatibleImage: - { + case KSIEEExifRead: + case KSIEEIncompatibleImage: + { res_id = R_ERROR_LOADING; break; - } + } case KSIEESaveFile: - case KSIEEExifUpdate: + case KSIEEExifUpdate: case KErrArgument: case KErrInUse: - - { + + { res_id = R_ERROR_SAVING; break; - } + } case KSIEENotEnoughDiskSpace: - { + { res_id = R_ERROR_NOT_ENOUGH_DISK_SPACE; break; - } + } case KSIEEProcessFile: - { + { res_id = R_ERROR_PROCESSING; break; - } + } case KSIEEEngine: - { + { res_id = R_ERROR_ENGINE; break; - } + } case KSIEEInternal: - { + { res_id = R_ERROR_INTERNAL; break; - } + } case KSIEEInternalNonRecoverable: - { + { res_id = R_ERROR_INTERNAL_NON_RECOVERABLE; break; + } + case KSIEEProtectedFile: + { + res_id = R_ERROR_PROTECTED_FILE; + break; + } + default: + break; } - case KSIEEProtectedFile: - { - res_id = R_ERROR_PROTECTED_FILE; - break; - } - default: - break; + + if (res_id != -1) + { + HBufC * textdata = iEikonEnv->AllocReadResourceLC(res_id); + TPtrC ptr = textdata->Des(); + + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::ShowErrorNoteL: \"%S\"", &ptr); + + CAknGlobalNote* globalNote = CAknGlobalNote::NewLC(); + TInt noteId = globalNote->ShowNoteL(EAknGlobalErrorNote, ptr); + + User::After(1500042); // waiting for 1 second + + // discard note + globalNote->CancelNoteL(noteId); + + CleanupStack::PopAndDestroy(); //textdata + CleanupStack::PopAndDestroy(); // GlobalNote + } } - if (res_id != - 1) - { - HBufC * textdata = iEikonEnv->AllocReadResourceLC (res_id); - TPtrC ptr = textdata->Des(); - - LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::ShowErrorNoteL: \"%S\"", &ptr); - - - CAknGlobalNote* globalNote = CAknGlobalNote::NewLC(); - TInt noteId = globalNote->ShowNoteL( EAknGlobalErrorNote, ptr ); - - User::After(1500042); // waiting for 1 second - - // discard note - globalNote->CancelNoteL( noteId ); - - - CleanupStack::PopAndDestroy(); //textdata - CleanupStack::PopAndDestroy(); // GlobalNote - } -} - //============================================================================= void CImageEditorAppUi::DeleteTempFiles() const -{ - // Get the used temp directory path. - // Take drive letter from iDocumentName - TParse parse; - parse.Set (KTempPath, &iDocumentName, NULL); - TPtrC tempDir = parse.DriveAndPath(); - - LOGFMT (KImageEditorLogFile, "CImageEditorAppUi::DeleteTempFiles(): %S", &tempDir); - - // Delete all files in the temp directory - _LIT(KAllFiles, "*.*"); - TFindFile file_finder (iEikonEnv->FsSession()); - CDir* file_list; - TInt err = file_finder.FindWildByDir (KAllFiles, tempDir, file_list); - while (err==KErrNone) - { - TInt i; - for (i=0; iCount(); i++) - { - const TDesC& name = (*file_list)[i].iName; - const TDesC& related = file_finder.File(); - TParse fullentry; - fullentry.Set (name, &related, NULL); - BaflUtils::DeleteFile (iEikonEnv->FsSession(), fullentry.FullName()); - } - delete file_list; - err=file_finder.FindWild (file_list); - } - -} + { + // Get the used temp directory path. + // Take drive letter from iDocumentName + TParse parse; + parse.Set(KTempPath, &iDocumentName, NULL); + TPtrC tempDir = parse.DriveAndPath(); + + LOGFMT (KImageEditorLogFile, "CImageEditorAppUi::DeleteTempFiles(): %S", &tempDir); + // Delete all files in the temp directory + _LIT(KAllFiles, "*.*"); + TFindFile file_finder(iEikonEnv->FsSession()); + CDir* file_list; + TInt err = file_finder.FindWildByDir(KAllFiles, tempDir, file_list); + while (err == KErrNone) + { + TInt i; + for (i = 0; i < file_list->Count(); i++) + { + const TDesC& name = (*file_list)[i].iName; + const TDesC& related = file_finder.File(); + TParse fullentry; + fullentry.Set(name, &related, NULL); + BaflUtils::DeleteFile(iEikonEnv->FsSession(), fullentry.FullName()); + } + delete file_list; + err = file_finder.FindWild(file_list); + } + + } //============================================================================= void CImageEditorAppUi::FinalizeSaveL() -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi::FinalizeSaveL"); + { + LOG(KImageEditorLogFile, "CImageEditorAppUi::FinalizeSaveL"); #ifdef FILE_TIME_STAMP_UPDATE - // Set the timestamp of the saved file to original file's timestamp + 2 seconds. - // The idea is to make the original and edited images appear next to each other. - TEntry original; - TInt err = iEikonEnv->FsSession().Entry( iSourceFileName, original ); - if (KErrNone == err) - { - TTime newTime = original.iModified + TTimeIntervalSeconds (2); - - CFileMan* fileMan = CFileMan::NewL( iEikonEnv->FsSession() ); - CleanupStack::PushL (fileMan); - fileMan->Attribs(iDocumentName, 0, 0, newTime); // do not set or clear anything, mofify time - CleanupStack::PopAndDestroy (fileMan); - } + // Set the timestamp of the saved file to original file's timestamp + 2 seconds. + // The idea is to make the original and edited images appear next to each other. + TEntry original; + TInt err = iEikonEnv->FsSession().Entry( iSourceFileName, original ); + if (KErrNone == err) + { + TTime newTime = original.iModified + TTimeIntervalSeconds (2); + + CFileMan* fileMan = CFileMan::NewL( iEikonEnv->FsSession() ); + CleanupStack::PushL (fileMan); + fileMan->Attribs(iDocumentName, 0, 0, newTime); // do not set or clear anything, mofify time + CleanupStack::PopAndDestroy (fileMan); + } #endif - LOG(KImageEditorLogFile, "CImageEditorAppUi: Check if source image belongs to an album"); - - iSourceImageMgAlbumIdList.Reset(); - - LOG(KImageEditorLogFile, "CImageEditorAppUi: publish the filename for provider"); - - // Publish & Subscribe API used for delivering document name to AIW provider - TInt err2 = RProperty::Define(KImageEditorProperties, EPropertyFilename, RProperty::EText); - - if (err2 != KErrAlreadyExists) - { - User::LeaveIfError(err2); - } - - User::LeaveIfError(RProperty::Set(KImageEditorProperties, EPropertyFilename, iDocumentName)); - - LOG(KImageEditorLogFile, "CImageEditorAppUi::FinalizeSaveL out"); -} + LOG(KImageEditorLogFile, "CImageEditorAppUi: Check if source image belongs to an album"); + + iSourceImageMgAlbumIdList.Reset(); + + LOG(KImageEditorLogFile, "CImageEditorAppUi: publish the filename for provider"); + + // Publish & Subscribe API used for delivering document name to AIW provider + TInt err2 = RProperty::Define(KImageEditorProperties, EPropertyFilename, + RProperty::EText); + + if (err2 != KErrAlreadyExists) + { + User::LeaveIfError(err2); + } + + User::LeaveIfError(RProperty::Set(KImageEditorProperties, + EPropertyFilename, iDocumentName)); + + LOG(KImageEditorLogFile, "CImageEditorAppUi::FinalizeSaveL out"); + } //============================================================================= void CImageEditorAppUi::HandleVolumeUpL() -{ + { LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeUpL: in"); TKeyEvent key; key.iScanCode = EStdKeyIncVolume; key.iCode = EKeyIncVolume; - if( LandscapeScreenOrientation() ) - { + if (LandscapeScreenOrientation()) + { key.iScanCode = EStdKeyDecVolume; key.iCode = EKeyDecVolume; - } + } key.iRepeats = 0; - iEikonEnv->SimulateKeyEventL( key, EEventKey ); + iEikonEnv->SimulateKeyEventL(key, EEventKey); LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeUpL: out"); -} + } //============================================================================= void CImageEditorAppUi::HandleVolumeDownL() -{ + { LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeDownL: in"); TKeyEvent key; key.iScanCode = EStdKeyDecVolume; key.iCode = EKeyDecVolume; - if( LandscapeScreenOrientation() ) - { + if (LandscapeScreenOrientation()) + { key.iScanCode = EStdKeyIncVolume; key.iCode = EKeyIncVolume; - } + } key.iRepeats = 0; - iEikonEnv->SimulateKeyEventL( key, EEventKey ); + iEikonEnv->SimulateKeyEventL(key, EEventKey); LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeDownL: out"); -} + } //============================================================================= void CImageEditorAppUi::SaveImageOverWriteL(TBool aOverWrite) -{ - LOG(KImageEditorLogFile, "CImageEditorAppUi: SaveImageOverWriteL: in"); - - // Generate temporary save file name + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: SaveImageOverWriteL: in"); + + // Generate temporary save file name TParse tempFileParser; - tempFileParser.Set (KTempSaveFile, &KTempPath, &iDocumentName); - iTempSaveFileName.Copy (tempFileParser.FullName()); - BaflUtils::EnsurePathExistsL (iEikonEnv->FsSession(), iTempSaveFileName); - - if (iExitFromApp) - { - TInt exit = - ((CImageEditorUIView *)iEditorView)->LaunchExitWithoutSavingQueryL(); - if (exit) - { - // Exit - User::Leave (KSIEEErrorOkToExit); - } - else - { - iExitFromApp = EFalse; - User::Leave(KSIEEInternal); - } - } + tempFileParser.Set(KTempSaveFile, &KTempPath, &iDocumentName); + iTempSaveFileName.Copy(tempFileParser.FullName()); + BaflUtils::EnsurePathExistsL(iEikonEnv->FsSession(), iTempSaveFileName); + + if (iExitFromApp) + { + TInt + exit = ((CImageEditorUIView *) iEditorView)->LaunchExitWithoutSavingQueryL(); + if (exit) + { + // Exit + User::Leave(KSIEEErrorOkToExit); + } + else + { + iExitFromApp = EFalse; + User::Leave(KSIEEInternal); + } + } // overwrite the existing file if (aOverWrite) - { - iDocumentName = iSourceFileName; - } - + { + iDocumentName = iSourceFileName; + } + // save with a new file name else - { - // Check document name if not saved yet or memory card removed - if ( !iImageSaved || - !BaflUtils::PathExists(iEikonEnv->FsSession(), iTempSaveFileName.Left(3))) - { - // If not saved yet, check that document name is valid - CheckFileL (iDocumentName); - } + { + // Check document name if not saved yet or memory card removed + if (!iImageSaved || !BaflUtils::PathExists(iEikonEnv->FsSession(), + iTempSaveFileName.Left(3))) + { + // If not saved yet, check that document name is valid + CheckFileL(iDocumentName); + } + } + + // Set temp save image name to engine + iEditorManager->SetImageName(iTempSaveFileName); + + // Launch save wait note + LaunchSaveWaitNoteL(); + + iCallback->DoCallback(KObSaveCallbackID); + LOG(KImageEditorLogFile, "CImageEditorAppUi: SaveImageOverWriteL: out"); } - - // Set temp save image name to engine - iEditorManager->SetImageName (iTempSaveFileName); - - // Launch save wait note - LaunchSaveWaitNoteL (); - - iCallback->DoCallback (KObSaveCallbackID); - LOG(KImageEditorLogFile, "CImageEditorAppUi: SaveImageOverWriteL: out"); -} //============================================================================= TInt CImageEditorAppUi::QueryAndSaveL() - { - - TInt isSaved = 0; - TInt userSelection = 0; - TBool isFileOpen = EFalse; - RFs& fs = iEikonEnv->FsSession(); - TInt err = fs.IsFileOpen( iSourceFileName, isFileOpen ); - - // Check if .jpg or .jpeg file - TBool isJpgExtension = EFalse; - TParsePtrC fileParse ( iSourceFileName ); + { + + TInt isSaved = 0; + TInt userSelection = 0; + TBool isFileOpen = EFalse; + RFs& fs = iEikonEnv->FsSession(); + TInt err = fs.IsFileOpen(iSourceFileName, isFileOpen); + + // Check if .jpg or .jpeg file + TBool isJpgExtension = EFalse; + TParsePtrC fileParse(iSourceFileName); _LIT( KJpgExtension, ".jpg" ); _LIT( KJpegExtension, ".jpeg" ); - TPtrC extension( fileParse.Ext() ); - if ( ( extension.MatchF( KJpgExtension ) == KErrNone ) || - ( extension.MatchF( KJpegExtension ) == KErrNone ) ) - { - isJpgExtension = ETrue; - } - - // If source file is open (e.g. in ImageViewer application) don't give - // user an option to replace original but launch directly "Save with a - // new name query. Don't give other that jpg originals. - if ( !isFileOpen && isJpgExtension ) - { - // the user selects to save with a new file name - // launch query with choices "Replace original" and - // "Save with a new file name" - userSelection = ( ( CImageEditorUIView *)iEditorView )->LaunchSaveImageQueryL(); - } - SetOrientationL(Orientation()); - SetLayoutAwareApp(EFalse); - // If user has selected "Save with a new file name" - if( userSelection == 0 ) - { - - // Multiple drive support enabled + TPtrC extension(fileParse.Ext()); + if ((extension.MatchF(KJpgExtension) == KErrNone) || (extension.MatchF( + KJpegExtension) == KErrNone)) + { + isJpgExtension = ETrue; + } + + // If source file is open (e.g. in ImageViewer application) don't give + // user an option to replace original but launch directly "Save with a + // new name query. Don't give other that jpg originals. + if (!isFileOpen && isJpgExtension) + { + // the user selects to save with a new file name + // launch query with choices "Replace original" and + // "Save with a new file name" + userSelection = ((CImageEditorUIView *) iEditorView)->LaunchSaveImageQueryL(); + } + SetOrientationL(Orientation()); + SetLayoutAwareApp(EFalse); + // If user has selected "Save with a new file name" + if (userSelection == 0) + { + + // Multiple drive support enabled #ifdef RD_MULTIPLE_DRIVE - - TDriveNumber driveNumber; - TFileName driveAndPath; - // new multi drive dialog - CAknMemorySelectionDialogMultiDrive* multiDriveDlg = - CAknMemorySelectionDialogMultiDrive::NewL( ECFDDialogTypeSave, - EFalse ); - CleanupStack::PushL( multiDriveDlg ); - - // launch "Select memory" query (mds) - if ( multiDriveDlg->ExecuteL( driveNumber, &driveAndPath, NULL ) ) - { - // Generate a default name for the new file - TInt err = ImageEditorUtils::GenerateNewFileNameL( - iEikonEnv->FsSession(), - iSourceFileName, - iDocumentName, - driveAndPath, - NULL ); - - driveAndPath.Append( PathInfo::ImagesPath() ); - - // launch file name prompt dialog - // the generated name is shown as a default name in dialog - TBuf<160> tmp( iDocumentName.Left(160) ); - iSavingQuery = ETrue; - if ( CAknFileNamePromptDialog::RunDlgLD( tmp, /* iDocumentName, */ - driveAndPath, - KNullDesC ) ) - { - iDocumentName.Copy( tmp ); - iSavingQuery = EFalse; - // add just queried filename to the path - driveAndPath.Append( iDocumentName ); - - iDocumentName = driveAndPath; - - SaveImageOverWriteL( EFalse ); - isSaved = 1; - } - iSavingQuery = EFalse; - } - CleanupStack::PopAndDestroy( multiDriveDlg ); - + + TDriveNumber driveNumber; + TFileName driveAndPath; + // new multi drive dialog + CAknMemorySelectionDialogMultiDrive* multiDriveDlg = CAknMemorySelectionDialogMultiDrive::NewL(ECFDDialogTypeSave, + EFalse); + CleanupStack::PushL(multiDriveDlg); + + // launch "Select memory" query (mds) + if (multiDriveDlg->ExecuteL(driveNumber, &driveAndPath, NULL )) + { + // Generate a default name for the new file + TInt err = ImageEditorUtils::GenerateNewFileNameL( + iEikonEnv->FsSession(), iSourceFileName, iDocumentName, + driveAndPath, NULL ); + + driveAndPath.Append(PathInfo::ImagesPath()); + + //Save as the original file format. + iDocumentName.Delete(iDocumentName.Length() - 5, 4); + iDocumentName.Append(fileParse.Ext()); + + // launch file name prompt dialog + // the generated name is shown as a default name in dialog + + TBuf<160> tmp(iDocumentName.Left(160)); + iSavingQuery = ETrue; + if (CAknFileNamePromptDialog::RunDlgLD(tmp, /* iDocumentName, */ + driveAndPath, KNullDesC)) + { + iDocumentName.Copy(tmp); + iSavingQuery = EFalse; + // add just queried filename to the path + driveAndPath.Append(iDocumentName); + + iDocumentName = driveAndPath; + + SaveImageOverWriteL(EFalse); + isSaved = 1; + } + iSavingQuery = EFalse; + } + CleanupStack::PopAndDestroy(multiDriveDlg); + #else // No multiple drive support - CAknMemorySelectionDialog::TMemory selectedMemory( - CAknMemorySelectionDialog::EPhoneMemory ); - - // launch "Select memory" query - if ( CAknMemorySelectionDialog::RunDlgLD( selectedMemory ) ) - { - // create path for the image - TFileName driveAndPath; - ImageEditorUtils::TMemorySelection memorySelection = - ImageEditorUtils::ESelectPhone; - if( selectedMemory == CAknMemorySelectionDialog::EPhoneMemory ) - { - memorySelection = ImageEditorUtils::ESelectPhone; - driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() ); - driveAndPath.Append( PathInfo::ImagesPath() ); - } - else if ( selectedMemory == - CAknMemorySelectionDialog::EMemoryCard ) - { - memorySelection = ImageEditorUtils::ESelectMmc; - driveAndPath.Copy( PathInfo::MemoryCardRootPath() ); - driveAndPath.Append( PathInfo::ImagesPath() ); - } - - TInt err = ImageEditorUtils::GenerateNewDocumentNameL( - iEikonEnv->FsSession(), - iSourceFileName, - iDocumentName, - &iSourceImageMgAlbumIdList, - NULL, - memorySelection ); - - - // launch file name prompt dialog - // the generated name is shown as a default name - iSavingQuery = ETrue; - if ( CAknFileNamePromptDialog::RunDlgLD( iDocumentName, - driveAndPath, - KNullDesC ) ) - { - iSavingQuery = EFalse; - TInt err = ImageEditorUtils::GenerateFilePathL( - iEikonEnv->FsSession(), - iSourceFileName, - iDocumentName, - memorySelection - ); - - SaveImageOverWriteL( EFalse ); - isSaved = 1; - } - iSavingQuery = EFalse; - } + CAknMemorySelectionDialog::TMemory selectedMemory( + CAknMemorySelectionDialog::EPhoneMemory ); + + // launch "Select memory" query + if ( CAknMemorySelectionDialog::RunDlgLD( selectedMemory ) ) + { + // create path for the image + TFileName driveAndPath; + ImageEditorUtils::TMemorySelection memorySelection = + ImageEditorUtils::ESelectPhone; + if( selectedMemory == CAknMemorySelectionDialog::EPhoneMemory ) + { + memorySelection = ImageEditorUtils::ESelectPhone; + driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() ); + driveAndPath.Append( PathInfo::ImagesPath() ); + } + else if ( selectedMemory == + CAknMemorySelectionDialog::EMemoryCard ) + { + memorySelection = ImageEditorUtils::ESelectMmc; + driveAndPath.Copy( PathInfo::MemoryCardRootPath() ); + driveAndPath.Append( PathInfo::ImagesPath() ); + } + + TInt err = ImageEditorUtils::GenerateNewDocumentNameL( + iEikonEnv->FsSession(), + iSourceFileName, + iDocumentName, + &iSourceImageMgAlbumIdList, + NULL, + memorySelection ); + + // launch file name prompt dialog + // the generated name is shown as a default name + iSavingQuery = ETrue; + if ( CAknFileNamePromptDialog::RunDlgLD( iDocumentName, + driveAndPath, + KNullDesC ) ) + { + iSavingQuery = EFalse; + TInt err = ImageEditorUtils::GenerateFilePathL( + iEikonEnv->FsSession(), + iSourceFileName, + iDocumentName, + memorySelection + ); + + SaveImageOverWriteL( EFalse ); + isSaved = 1; + } + iSavingQuery = EFalse; + } #endif - } - // the user selects to overwrite the original image - else if ( userSelection == 1 ) - { - SaveImageOverWriteL( ETrue ); - isSaved = 1; - } - return isSaved; - } + } + // the user selects to overwrite the original image + else if (userSelection == 1) + { + SaveImageOverWriteL(ETrue); + isSaved = 1; + } + return isSaved; + } // ---------------------------------------------------------------------------- // CImageEditorAppUi::HandleVolumeKeyEvent // ---------------------------------------------------------------------------- // -void CImageEditorAppUi::HandleVolumeKeyEvent( TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction /* aButtonAct */ ) - { - if (((CImageEditorUIView *)iEditorView)->GetContainer()) - { - if(! ((CImageEditorUIView *)iEditorView)->GetContainer()->IsFocused() ) - { - return; - } - } - - if( iForeground ) - { - TKeyEvent keyEvent; - if( aOperationId == ERemConCoreApiVolumeUp ) - { - keyEvent.iScanCode = EStdKeyIncVolume; - TRAP_IGNORE( HandleKeyEventL( keyEvent, EEventKey ) ); - } - else if( aOperationId == ERemConCoreApiVolumeDown ) - { - keyEvent.iScanCode = EStdKeyDecVolume; - TRAP_IGNORE( HandleKeyEventL( keyEvent, EEventKey ) ); - } - } - } - +void CImageEditorAppUi::HandleVolumeKeyEvent( + TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction /* aButtonAct */) + { + if (((CImageEditorUIView *) iEditorView)->GetContainer()) + { + if (!((CImageEditorUIView *) iEditorView)->GetContainer()->IsFocused()) + { + return; + } + } + + if (iForeground) + { + TKeyEvent keyEvent; + if (aOperationId == ERemConCoreApiVolumeUp) + { + keyEvent.iScanCode = EStdKeyIncVolume; + TRAP_IGNORE( HandleKeyEventL( keyEvent, EEventKey ) ); + } + else if (aOperationId == ERemConCoreApiVolumeDown) + { + keyEvent.iScanCode = EStdKeyDecVolume; + TRAP_IGNORE( HandleKeyEventL( keyEvent, EEventKey ) ); + } + } + } + +void CImageEditorAppUi::InitialHorizontalDrawPlugin() + { + // // Get pointer to the view + CImageEditorUIView * view = (CImageEditorUIView *) iEditorView; + + TRect rect; + iResolutionUtil->GetClientRect(rect); + SetFullScreenL(); + // Create a plug-in control + // Ownership is moved to the plug-in + CCoeControl * control = NULL; + TInt err = iEditorManager->CreatePluginControlL(rect, view->GetContainer(), + control); + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin control created"); + + // The plug-in activation was cancelled + if (err != KErrNone) + { + // Cancel plug-in + iCancelling = ETrue; + iCallback->DoCallback(KObCancelCallbackID); + } + + // Activate plug-in + else + { + // Register control to UI + view->ActivatePluginL(control); + + LOG(KImageEditorLogFile, "CImageEditorAppUi: Plugin activated"); + + // If the filter did not have a control, close plug-in + if (!control) + { + iEditorManager->ClosePlugin(); + + } + + // Set the last opened image to editor view + ((CImageEditorUIView *) iEditorView)->SetImageL(iEditorManager->GetPreviewImage()); + + ResetBusy(); + } + } // End of File diff -r edfc90759b9f -r 18b321db4884 imageeditor/inc/ImageEditorControlBase.h --- a/imageeditor/inc/ImageEditorControlBase.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/inc/ImageEditorControlBase.h Thu Jun 03 18:57:10 2010 +0800 @@ -116,6 +116,7 @@ * @return - */ IMPORT_C virtual void PrepareL (); + /* OfferKeyEventL * @@ -232,6 +233,7 @@ */ IMPORT_C virtual TBitField GetDimmedMenuItems (); + //@} protected: diff -r edfc90759b9f -r 18b321db4884 imageeditor/inc/ImageEditorUI.hrh --- a/imageeditor/inc/ImageEditorUI.hrh Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/inc/ImageEditorUI.hrh Thu Jun 03 18:57:10 2010 +0800 @@ -55,6 +55,7 @@ // MISC COMMANDS EImageEditorCmdSelectPlugin = 15000, EImageEditorCmdRender, + EImageEditorResetFullScreen, EImageEditorCmdViewReady, EImageEditorApplyPlugin, EImageEditorApplyPluginNoStorage, diff -r edfc90759b9f -r 18b321db4884 imageeditor/inc/ImageEditorUIView.h --- a/imageeditor/inc/ImageEditorUIView.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/inc/ImageEditorUIView.h Thu Jun 03 18:57:10 2010 +0800 @@ -522,6 +522,9 @@ */ IMPORT_C TBool InZoomingState(); IMPORT_C TBool IsMemoryInCriticalLevel(); + + + //@} protected: @@ -546,7 +549,6 @@ /** @name Methods:*/ //@{ - /* DoActivateL * * Called when view is activated. @@ -718,6 +720,8 @@ // Popup controller CAknInfoPopupNoteController* iPopupController; + + #ifdef AIW_SUPPORT /// AIW Service Handler CAiwServiceHandler* iServiceHandler; diff -r edfc90759b9f -r 18b321db4884 imageeditor/inc/PreviewControlBase.h --- a/imageeditor/inc/PreviewControlBase.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/inc/PreviewControlBase.h Thu Jun 03 18:57:10 2010 +0800 @@ -115,6 +115,7 @@ //@{ /// Preview image const CFbsBitmap * iPreview; + TInt iStatuspaneHeight; //@} private: diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/data/PenSize.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/data/PenSize.svg Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/data/menu.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/data/menu.svg Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/data/palette.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/data/palette.svg Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/data/save.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/data/save.svg Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/data/undo.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/data/undo.svg Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/15A.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/15A.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/Left.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/Left.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/Leftmask.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/Leftmask.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/Right.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/Right.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/bottom.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/bottom.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/bottommask.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/bottommask.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/menumask.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/menumask.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/rightmask.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/rightmask.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/top.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/top.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/gfx/topmask.bmp Binary file imageeditor/plugins/DrawPlugin/gfx/topmask.bmp has changed diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/group/bld.inf --- a/imageeditor/plugins/DrawPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/group/bld.inf Thu Jun 03 18:57:10 2010 +0800 @@ -32,6 +32,7 @@ // mmp files PRJ_MMPFILES drawplugin.mmp +gnumakefile icons_doodle.mk PRJ_EXTENSIONS START EXTENSION s60/mifconv diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/group/drawplugin.mmp --- a/imageeditor/plugins/DrawPlugin/group/drawplugin.mmp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/group/drawplugin.mmp Thu Jun 03 18:57:10 2010 +0800 @@ -60,9 +60,8 @@ SOURCEPATH ../src SOURCE imageeditordrawplugin.cpp -SOURCE imageeditordrawcontrol.cpp SOURCE drawpath.cpp -SOURCE selectionpopup.cpp +SOURCE selectionpopup.cpp imageeditordrawcontrol.cpp AnimationAO.cpp CImageLabel.cpp TimeAO.cpp CustomerComponet.cpp RollAO.cpp USERINCLUDE . @@ -101,10 +100,24 @@ LIBRARY pb.lib LIBRARY systemparameters.lib LIBRARY CommonEngine.lib +LIBRARY hlplch.lib eikcoctl.lib eikctl.lib bafl.lib fbscli.lib aknicon.lib egul.lib +LIBRARY imageconversion.lib bitgdi.lib CommonDialogs.lib +//LIBRARY ImageEditorUI.LIB //#if defined (__EXPORT_UNFROZEN_PLUGINS__) -//EXPORTUNFROZEN +EXPORTUNFROZEN //#endif NOSTRICTDEF // End of File +START BITMAP imageditorfilterdraw.mbm + TARGETPATH resource/apps + HEADER + SOURCEPATH ../gfx + SOURCE c24 top.bmp bottom.bmp + SOURCE c4 menumask.bmp + SOURCE c24 Right.bmp 15A.bmp + SOURCE 1 Leftmask.bmp rightmask.bmp + SOURCE c24 Left.bmp + SOURCE 1 topmask.bmp bottommask.bmp +END diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/group/icons_doodle.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/group/icons_doodle.mk Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,39 @@ +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\RESOURCE\APPS +HEADERDIR=$(EPOCROOT)epoc32\include +ICONTARGETFILENAME=$(TARGETDIR)\Icons_doodle.mif +HEADERFILENAME=$(HEADERDIR)\Icons_doodle.mbg + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIN : do_nothing + +RESOURCE : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c32,8 ..\data\pensize.svg\ + /c32,8 ..\data\palette.svg\ + /c32,8 ..\data\undo.svg\ + /c32,8 ..\data\save.svg\ + /c32,8 ..\data\menu.svg +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME) && \ + @echo $(ICONTARGETFILENAME) +FINAL : do_nothing \ No newline at end of file diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/AnimationAO.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/AnimationAO.h Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,74 @@ +/* + ============================================================================ + Name : AnimationAO.h + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CAnimationAO declaration + ============================================================================ + */ + +#ifndef ANIMATIONAO_H +#define ANIMATIONAO_H + +#include // For CActive, link against: euser.lib +#include // For RTimer, link against: euser.lib + +class MAnimationObserver + { +public: + virtual void Notify() = 0; + ~MAnimationObserver() {} +protected: + MAnimationObserver() {} + }; + + + + + +class CAnimationAO : public CActive + { +public: + // Cancel and destroy + ~CAnimationAO(); + + // Two-phased constructor. + static CAnimationAO* NewL(); + + // Two-phased constructor. + static CAnimationAO* NewLC(); + +public: + // New functions + // Function for making the initial request + void StartL(TTimeIntervalMicroSeconds32 aDelay); + void SetObserver(MAnimationObserver *aObserver); + +private: + // C++ constructor + CAnimationAO(); + + // Second-phase constructor + void ConstructL(); + + + +private: + // From CActive + // Handle completion + void RunL(); + + // How to cancel me + void DoCancel(); + + // Override to handle leaves from RunL(). Default implementation causes + // the active scheduler to panic. + TInt RunError(TInt aError); + +private: + RTimer iTimer; // Provides async timing service + MAnimationObserver *iObserver; + }; + +#endif // ANIMATIONAO_H diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/CImageLabel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/CImageLabel.h Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,140 @@ +/* + ============================================================================ + Name : CImageLabel.h + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CImageLabel declaration + ============================================================================ + */ + +#ifndef IMAGELABEL_H +#define IMAGELABEL_H + +// INCLUDES +#include +#include +#include +#include "MCountTime.h" + +class CFbsBitmap; +class CTimeAO; + + +class MHandlePointerObserver + { +public: + virtual void HandlePointerNotify(CCoeControl* aComponent) = 0; + virtual ~MHandlePointerObserver() {} +protected: + MHandlePointerObserver(){} + }; + + + +// CLASS DECLARATION + +/** + * CCImageLabel + * + */ +class CImageLabel : public CCoeControl, MCountTime + { +public: + enum LABEL_STATE + { + ENone, ESelected, ESelectedWithTooltip,EMoving + }; + enum TOOLTIP_LAYOUT + { + ELabelHorizontal, ELabelVertical + }; +public: + // Constructors and destructor + + /** + * Destructor. + */ + ~CImageLabel(); + + /** + * Two-phased constructor. + */ + static CImageLabel* NewL(CCoeControl *aParent, const TRect& aRect, TOOLTIP_LAYOUT aLabelLayout); + + /** + * Two-phased constructor. + */ + static CImageLabel* NewLC(CCoeControl *aParent, const TRect& aRect, TOOLTIP_LAYOUT aLabelLayout); + +public: + /** + * From CCoeControl + */ + virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + /** + * From CCoeControl + */ + virtual void SizeChanged(); + + /** + * From CCoeControl + */ + virtual void Draw(const TRect& aRect) const; + + virtual void Notify(); + + /** + * Self-define + */ + void SetImage(const TDesC& aMbmPackage, TInt aIndex); + + /** + * Self-define + */ + void SetTooltip(const TDesC& aTooltip); + + void ResetControl(); + + void LabelIsMoving(); + + void SetHandlePointerObserver(MHandlePointerObserver* aHandlePointerObserver); + +private: + /** + * Constructor for performing 1st stage construction + */ + CImageLabel(); + + /** + * EPOC default constructor for performing 2nd stage construction + */ + void ConstructL(CCoeControl *aParent, const TRect& aRect, TOOLTIP_LAYOUT aLabelLayout); + + void CalculateImagePoint(); + void CalculateBoundingRectStartPoint(); + void CalculateTooltipPoint(); + void CalculateZones(); + +private: + LABEL_STATE iState; + TOOLTIP_LAYOUT iLabelLayout; + + TBuf<20> iTooltip; + TPoint iTooltipStartPoint; + TPoint iImageStartPoint; + TPoint iBoundingRectStartPoint; + + TSize iImageSize; + TSize iBoundingSize; + + CFbsBitmap* iBitmap; + CFbsBitmap* iBitmapMask; + + CTimeAO* iTimeAO; + MHandlePointerObserver* iHandlePointerObserver; + TBool iIsHandlePointerNotifyProcessing; + }; + +#endif // CIMAGELABEL_H diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/CustomerComponet.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/CustomerComponet.h Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,101 @@ +/* + ============================================================================ + Name : CustomerComponet.h + Author : henry + Version : 1.0 + Copyright : Your copyright notice + Description : CCustomerComponet declaration + ============================================================================ + */ + +#ifndef CUSTOMERCOMPONET_H +#define CUSTOMERCOMPONET_H + +// INCLUDES +#include +#include +#include +#include "CImageLabel.h" +#include +// CLASS DECLARATION + +/** + * CCustomerComponet + * + */ + +class CCustomerComponet : public CCoeControl + { +public: + // Constructors and destructor + + /** + * Destructor. + */ + ~CCustomerComponet(); + + /** + * Two-phased constructor. + */ + static CCustomerComponet* NewL(TRect & aRect, CCoeControl* aParent); + + /** + * Two-phased constructor. + */ + static CCustomerComponet* NewLC(TRect & aRect, CCoeControl* aParent); + + /** + * Draw() + */ + void Draw(const TRect& aRect) const; + + /** + * Handling pointer Event. + */ + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + /** + * Set Rect for the componet. + */ + void SetRect(TRect& aRect); + +protected: + + void SizeChanged(); + +private: + + /** + * Constructor for performing 1st stage construction + */ + CCustomerComponet(); + + /** + * EPOC default constructor for performing 2nd stage construction + */ + void ConstructL(TRect & aRect, CCoeControl* aParent); +public: + /** + * SetHandlePointerObserver + */ + void SetHandlePointerObserver( + MHandlePointerObserver* aHandlePointerObserver); + + TBool GetButtonType(); +private: + TInt iDrawDirection; + CFbsBitmap* iMenu; + CFbsBitmap* iMenuMask; + CFbsBitmap* iRight; + CFbsBitmap* iRightMask; + CFbsBitmap* iLeft; + CFbsBitmap* iTop; + CFbsBitmap* iBottom; + CFbsBitmap* iLeftMask; + CFbsBitmap* iTopMask; + CFbsBitmap* iBottomMask; + MHandlePointerObserver* iPointerObserver; + TBool iButtonFlag; + }; + +#endif // CUSTOMERCOMPONET_H diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/MCountTime.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/MCountTime.h Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,13 @@ +#ifndef MCOUNTTIME_H_ +#define MCOUNTTIME_H_ + +class MCountTime + { +public: + virtual void Notify() = 0; + virtual ~MCountTime() {} +protected: + MCountTime() {} + }; + +#endif diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/RollAO.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/RollAO.h Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,74 @@ +/* + ============================================================================ + Name : AnimationAO.h + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CAnimationAO declaration + ============================================================================ + */ + +#ifndef ROLLAO_H +#define ROLLAO_H + +#include // For CActive, link against: euser.lib +#include // For RTimer, link against: euser.lib + +class MRollObserver + { +public: + virtual void Roll() = 0; + ~MRollObserver() {} +protected: + MRollObserver() {} + }; + + + + + +class CRollAO : public CActive + { +public: + // Cancel and destroy + ~CRollAO(); + + // Two-phased constructor. + static CRollAO* NewL(); + + // Two-phased constructor. + static CRollAO* NewLC(); + +public: + // New functions + // Function for making the initial request + void StartL(TTimeIntervalMicroSeconds32 aDelay); + void SetObserver(MRollObserver *aObserver); + +private: + // C++ constructor + CRollAO(); + + // Second-phase constructor + void ConstructL(); + + + +protected: + // From CActive + // Handle completion + void RunL(); + + // How to cancel me + void DoCancel(); + + // Override to handle leaves from RunL(). Default implementation causes + // the active scheduler to panic. + TInt RunError(TInt aError); + +private: + RTimer iTimer; // Provides async timing service + MRollObserver *iObserver; + }; + +#endif // ANIMATIONAO_H diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/TimeAO.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/TimeAO.h Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,64 @@ +/* + ============================================================================ + Name : TimeAO.h + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CTimeAO declaration + ============================================================================ + */ + +#ifndef TIMEAO_H +#define TIMEAO_H + +#include // For CActive, link against: euser.lib +#include // For RTimer, link against: euser.lib + +class MCountTime; + +class CTimeAO : public CActive + { +public: + // Cancel and destroy + ~CTimeAO(); + + // Two-phased constructor. + static CTimeAO* NewL(); + + // Two-phased constructor. + static CTimeAO* NewLC(); + +public: + // New functions + // Function for making the initial request + void StartL(); + + void SetObserver(MCountTime* aObserver); + +private: + // C++ constructor + CTimeAO(); + + // Second-phase constructor + void ConstructL(); + +private: + // From CActive + // Handle completion + void RunL(); + + // How to cancel me + void DoCancel(); + + // Override to handle leaves from RunL(). Default implementation causes + // the active scheduler to panic. + TInt RunError(TInt aError); + +private: + +private: + RTimer iTimer; // Provides async timing service + MCountTime* iObserver; + }; + +#endif // TIMEAO_H diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/draw.hrh --- a/imageeditor/plugins/DrawPlugin/inc/draw.hrh Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/inc/draw.hrh Thu Jun 03 18:57:10 2010 +0800 @@ -24,7 +24,7 @@ enum TDrawPgnCommandId { - EDrawPgnMenuCmdMin = EPgnMenuCmdIdBase, + EDrawPgnMenuCmdMin = EPgnMenuCmdIdBase, //200000 EDrawPgnMenuCmdDone, EDrawPgnMenuCmdResize, EDrawPgnMenuCmdColor, diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/imageeditordrawcontrol.h --- a/imageeditor/plugins/DrawPlugin/inc/imageeditordrawcontrol.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/inc/imageeditordrawcontrol.h Thu Jun 03 18:57:10 2010 +0800 @@ -1,21 +1,21 @@ /* -* Copyright (c) 2010 Ixonos Plc. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* Ixonos Plc -* -* Description: -* Draw plugin control class header. -* -*/ + * Copyright (c) 2010 Ixonos Plc. + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - Initial contribution + * + * Contributors: + * Ixonos Plc + * + * Description: + * Draw plugin control class header. + * + */ #ifndef IMAGEEDITORDRAWCONTROL_H #define IMAGEEDITORDRAWCONTROL_H @@ -26,6 +26,10 @@ #include #include +#include "AnimationAO.h" +#include "CImageLabel.h" +#include "CustomerComponet.h" +#include "RollAO.h" // FORWARD DECLARATIONS class CAknView; @@ -33,268 +37,401 @@ class CPluginInfo; class CSystemParameters; class CJPTimer; -class CAknInfoPopupNoteController; +class CAknInfoPopupNoteController; class CDrawPath; +class CImageLabel; +class CAnimationAO; /* CLASS: CImageEditorDrawControl -* -* CImageEditorDrawControl is a control for text insertion plug-in. -* -*/ -class CImageEditorDrawControl : public CPreviewControlBase, - public MTimerCallBack -{ + * + * CImageEditorDrawControl is a control for text insertion plug-in. + * + */ +class CImageEditorDrawControl : public CPreviewControlBase, + public MTimerCallBack, + public MAnimationObserver, + public MHandlePointerObserver, + public MRollObserver + { + static const int DRAG_LENGTH = 5; + enum TMainMenuLayout + { + EMainMenuHorizontal, EMainMenuVertical + }; public: -/** @name Methods:*/ -//@{ + /** @name Methods:*/ + //@{ /** NewL factory method - * - * @param aRect - control rectangle - * @param aParent - pointer to window owning control - * @return pointer to created CImageEditorDrawControl object - */ - static CImageEditorDrawControl* NewL( - const TRect& aRect, - CCoeControl* aParent - ); + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return pointer to created CImageEditorDrawControl object + */ + static CImageEditorDrawControl* NewL(const TRect& aRect, + CCoeControl* aParent, RPointerArray& aPaths,TRgb& aRgb, TSize& aSize,TBool &aDisplayTool); /** Destructor */ ~CImageEditorDrawControl(); -protected: // From CImageEditorControlBase +protected: + // From CImageEditorControlBase /** Second phase constructor - * - * @see CImageEditorControlBase - */ - void ConstructL( - const TRect& aRect, - CCoeControl* aParent - ); + * + * @see CImageEditorControlBase + */ + void ConstructL(const TRect& aRect, CCoeControl* aParent); /* Setter for view reference - * - * @see CImageEditorControlBase - */ - void SetView(CAknView* aView); + * + * @see CImageEditorControlBase + */ + void SetView(CAknView* aView); - /* SetSelectedUiItemL - * - * @see CImageEditorControlBase - */ - void SetSelectedUiItemL(CPluginInfo* aItem); + /* SetSelectedUiItemL + * + * @see CImageEditorControlBase + */ + void SetSelectedUiItemL(CPluginInfo* aItem); /** PrepareL - * - * @see CImageEditorControlBase - */ + * + * @see CImageEditorControlBase + */ void PrepareL(); - /* OfferKeyEventL - * - * @see CImageEditorControlBase - */ - TKeyResponse OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType - ); - - /* HandlePointerEventL - * - * @see CImageEditorControlBase - */ - void HandlePointerEventL( const TPointerEvent &aPointerEvent ); - + /* OfferKeyEventL + * + * @see CImageEditorControlBase + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /* HandlePointerEventL + * + * @see CImageEditorControlBase + */ + void HandlePointerEventL(const TPointerEvent &aPointerEvent); + /* HandlePluginCommandL - * - * @see CImageEditorControlBase - */ - void HandlePluginCommandL(const TInt aCommand); + * + * @see CImageEditorControlBase + */ + void HandlePluginCommandL(const TInt aCommand); /* GetSoftkeyIndexL - * - * @see CImageEditorControlBase - */ - TInt GetSoftkeyIndexL(); + * + * @see CImageEditorControlBase + */ + TInt GetSoftkeyIndexL(); - /* GetContextMenuResourceId - * - * @see CImageEditorControlBase - */ - TInt GetContextMenuResourceId(); - + /* GetContextMenuResourceId + * + * @see CImageEditorControlBase + */ + TInt GetContextMenuResourceId(); + /* GetDimmedMenuItems - * - * @see CImageEditorControlBase - */ + * + * @see CImageEditorControlBase + */ TBitField GetDimmedMenuItems(); /* GetNaviPaneTextL - * - * @see CImageEditorControlBase - */ - TPtrC GetNaviPaneTextL( - TBool& aLeftNaviPaneScrollButtonVisibile, - TBool& aRightNaviPaneScrollButtonVisible); -public: + * + * @see CImageEditorControlBase + */ + TPtrC GetNaviPaneTextL(TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + +public: /* GetParam - * - * Gets pointer to the parameter struct. - * @return - pointer to MIA parameter struct - */ - TDesC& GetParam(); + * + * Gets pointer to the parameter struct. + * @return - pointer to MIA parameter struct + */ + TDesC& GetParam(); /* SetSysteParameters - * - * Sets reference to system parameters to plug-in. - * @param aSysPars - System parameters instance - */ - void SetSystemParameters(const CSystemParameters* aSysPars); - - /* IsReadyToRender - * - * @return - ETrue when control is ready render - */ - TBool IsReadyToRender() const; + * + * Sets reference to system parameters to plug-in. + * @param aSysPars - System parameters instance + */ + void SetSystemParameters(const CSystemParameters* aSysPars); + + /* IsReadyToRender + * + * @return - ETrue when control is ready render + */ + TBool IsReadyToRender() const; protected: - /* GetHelpContext - * - * @see CCoeControl - */ + /* GetHelpContext + * + * @see CCoeControl + */ virtual void GetHelpContext(TCoeHelpContext& aContext) const; - /* TimerCallBack - * - * @see MTimerCallBack - */ + /* TimerCallBack + * + * @see MTimerCallBack + */ void TimerCallBack(); -//@} - + /*MakeVisibleLable + * + * make the controller visible + * @param aFlag - ETrue,make the tool bar visible,otherwise. + */ + void MakeVisibleLable(TBool aFlag); + + /**StartTheAnimation + * + * start the auto-moving active object for tool bar. + */ + void StartTheAnimation(); protected: -/** @name Methods:*/ -//@{ + /** @name Methods:*/ + //@{ /* SizeChanged - * - * @see CImageEditorControlBase - */ + * + * @see CImageEditorControlBase + */ void SizeChanged(); -//@} + //@} -/** @name Members:*/ -//@{ + /** @name Members:*/ + //@{ -//@} + //@} private: - - CImageEditorDrawControl (); + /** Default constructor */ + CImageEditorDrawControl(RPointerArray& aPaths,TRgb& aRgb, TSize& aSize,TBool &aDisplayTool); /** Draw - * - * @see CImageEditorControlBase - * - */ - virtual void Draw (const TRect & aRect) const; + * + * @see CImageEditorControlBase + * + */ + virtual void Draw(const TRect & aRect) const; -private: // Implementation - void NaviDown(); - void NaviUp(); - void NaviRight(); - void NaviLeft(); - void SelectSizeL(); - void StoreTempParams(); - void RestoreTempParams(); - void RenderTextImageL(); - void LoadIndicatorL ( TInt aBitmapInd, TInt aMaskInd ); - TPoint ComputeIndicatorPosition() const; +protected: + /**CountComponentControls + * + * @see CImageEditorControlBase + */ + TInt CountComponentControls() const; + + /**ComponentControl + * + * + * @see CImageEditorControlBase + */ + CCoeControl* ComponentControl(TInt aIndex) const; + +private: + // Implementation + void NaviDown(); + void NaviUp(); + void NaviRight(); + void NaviLeft(); + void SelectSizeL(); + void StoreTempParams(); + void RestoreTempParams(); + void RenderTextImageL(); + void LoadIndicatorL(TInt aBitmapInd, TInt aMaskInd); + TPoint ComputeIndicatorPosition() const; void StoreParameters(TBool aLastItem, TBool aDone); void StorePosAndScaleRelScreen(); void RestorePosAndScaleRelScreen(); void StorePosAndScaleRelImage(); void RestorePosAndScaleRelImage(); void ClipPosition(); - void SetPositionOnImage( TPoint aPointedPosition ); - TPoint GetPositionOnView(); - void ShowTooltip(); - TSize ScaledLineSize( TSize aOriginalSize ) const; + void SetPositionOnImage(TPoint aPointedPosition); + TPoint GetPositionOnView(); + void ShowTooltip(); + TSize ScaledLineSize(TSize aOriginalSize) const; + +public: + /**Notify + * + * handle the event by Active object + */ + virtual void Notify(); + + /**HandlePointerNotify + * + * handle the press icon event + * @param aComponent - the icon control of tool bar + */ + virtual void HandlePointerNotify(CCoeControl* aComponent); + + /**Roll + * + * the fuction for AO to move the tool bar + */ + virtual void Roll(); -//@} - -/** @name Members:*/ -//@{ - - /// Ref: to Editor view - CAknView* iEditorView; +private: + /**InitializeMainMenu + * + * initialize the tool bar + * @param aMainMenuLayout - horizon or veritical layout of the tool bar + */ + void InitializeMainMenu(TMainMenuLayout aMainMenuLayout); + + /**CalculateEffectiveOffset + * + * calculate vaild offset for tool bar + */ + void CalculateEffectiveOffset(); - /// Source image size - const CSystemParameters* iSysPars; - - /// Ref: to Plug-in info - CPluginInfo* iItem; - - /// Own: Navigation pane text - HBufC* iNaviPaneText; + /**HandleMainMenuButtonUp + * + * handle the up event on tool bar + * @param aPoint - the position on screen + */ + void HandleMainMenuButtonUp(TPoint aPoint); + + /**HandleMainMenuButtonDrag + * + * handle the drag event on tool bar + * @param aPoint - the position on screen + */ + void HandleMainMenuButtonDrag(TPoint aPoint); + +private: + /**UndoDrawPath + * + * undo the drawed lines on screen + */ + void UndoDrawPath(); + + /**RedoDrawPath + * + * redo the undo lines on screen + */ + void RedoDrawPath(); + +private: + + //@} - /// X position - TInt iX; - /// Y position - TInt iY; - /// Color - TRgb iRgb; + /** @name Members:*/ + //@{ + + /// Ref: to Editor view + CAknView* iEditorView; + + /// Source image size + const CSystemParameters* iSysPars; - /// Timer for fast key events + /// Ref: to Plug-in info + CPluginInfo* iItem; + + /// Own: Navigation pane text + HBufC* iNaviPaneText; + + /// X position + TInt iX; + /// Y position + TInt iY; + + /// Timer for fast key events CJPTimer* iTimer; TUint32 iKeyCode; /// Pressed key event code TInt iPressedKeyScanCode; - /// Number of ticks since timer start - TInt iTickCount; + /// Number of ticks since timer start + TInt iTickCount; - /// Multiplier to control the navigation movement speed - TInt iNaviStepMultiplier; + /// Multiplier to control the navigation movement speed + TInt iNaviStepMultiplier; - /// Showing Ok options menu, where some items are dimmed - TBool iDisplayingOkOptionsMenu; + /// Showing Ok options menu, where some items are dimmed + TBool iDisplayingOkOptionsMenu; - /// Own: State indicator glyph - CFbsBitmap* iIndicator; - CFbsBitmap* iIndicatorMask; + /// Own: State indicator glyph + CFbsBitmap* iIndicator; + CFbsBitmap* iIndicatorMask; - /// Ready to render - TBool iReadyToRender; - - /// Parameter - TBuf<256> iParam; + /// Ready to render + TBool iReadyToRender; + + /// Parameter + TBuf<256> iParam; // Popup controller CAknInfoPopupNoteController* iPopupController; // Tooltip texts HBufC* iTooltipResize; - + // Previous pen position. Make touch rotating and resizing possible TPoint iPointerPosition; // Multiplier to control the rotating speed by touch TInt iTouchAngleMultiplier; - - /// Resource reader + + /// Resource reader RConeResourceLoader iResLoader; /// Line size - TSize iSize; + TSize& iSize; + /// Color + TRgb& iRgb; /// Own: drawn paths - RPointerArray iPaths; - -//@} + RPointerArray &iPaths; + //bitmap device + CFbsBitmapDevice* iBitmapDev; + CGraphicsContext* iGc; + //@} + +private: + + void SetToolBarStatus(); + RPointerArray iLabels; + + TRect iLoopMenuRect; + TPoint iButtonDownPoint; + TPoint iDragStartPoint; + TPoint iDragPrePoint; + TPoint iDragUpPoint; + + TInt iTotalComponent; + TInt iDragOffset; + TInt iStartSpeed; + + CAnimationAO* iAnimationAO; + CRollAO* iRollAo; -}; + TBool iPointStartInLoopRect; + TBool iDragIsStart; + TBool iEnableAnimationEffect; + TMainMenuLayout iMainMenuLayout; + ///implement undo and redo functions. +private: + + RPointerArray iUndoPaths; + TBool iUndo; + TBool iRedo; + TBool iCanRedo; + //ETrue: roll in + //EFalse:roll out + TBool iRollDirection; +private: + + CCustomerComponet *iCustomComponet; + TBool iCustomComponetClick; + TBool iLastPointEventType; + TBool iRollflag; + TBool &iDisplayTool; + TBool iSizeChangeFlag; + }; #endif diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/imageeditordrawplugin.h --- a/imageeditor/plugins/DrawPlugin/inc/imageeditordrawplugin.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/inc/imageeditordrawplugin.h Thu Jun 03 18:57:10 2010 +0800 @@ -28,7 +28,7 @@ class CEditorImage; class CCoeControl; class CSystemParameters; - +class CDrawPath; /* CLASS: CImageEditorDrawPlugin * @@ -90,7 +90,12 @@ * @see CImageEditorPluginBase */ virtual void ReleasePlugin (); - + + /**CalculatePositionOnView + * + * calculate the point on view when changing the screen mode + */ + void CalculatePositionOnView(); //@} private: // Data @@ -98,12 +103,24 @@ //@{ /// Plug-in UI control CCoeControl* iControl; - /// System parameters + TBool iDiplayToolPluginParam; + /// System parameters const CSystemParameters* iSysPars; /// Is landscape enabled, Must be EFalse until text is set TBool iLandscapeEnabled; //@} +private: // Data + //for drawcontrol + //drawed lines in drawcontrol + RPointerArray iPaths; + //selected pencolor + TRgb iRgb; + //selected pensize + TSize iSize; + //first image rect on preview + TRect iVisibleImageRectPrevFirst; + }; #endif // IMAGEEDITORDRAWPLUGIN_H diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/selectionpopup.h --- a/imageeditor/plugins/DrawPlugin/inc/selectionpopup.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/inc/selectionpopup.h Thu Jun 03 18:57:10 2010 +0800 @@ -1,22 +1,21 @@ /* -* Copyright (c) 2010 Ixonos Plc. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* Ixonos Plc -* -* Description: -* Selection popup dialog header file. -* -*/ - + * Copyright (c) 2010 Ixonos Plc. + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - Initial contribution + * + * Contributors: + * Ixonos Plc + * + * Description: + * Selection popup dialog header file. + * + */ #ifndef _SELECTIONPOPUP_H #define _SELECTIONPOPUP_H @@ -30,263 +29,263 @@ class CFbsBitmap; //class TAknLayoutText; - -NONSHARABLE_CLASS( CSelectionPopup ):public CPreviewControlBase -{ + +NONSHARABLE_CLASS( CSelectionPopup ) : public CPreviewControlBase + { public: - /** Default constructor, cannot leave. - * - * @since S60 5.0 - * @param - - * @return - - */ - CSelectionPopup(); + /** Default constructor, cannot leave. + * + * @since S60 5.0 + * @param - + * @return - + */ + CSelectionPopup(TRgb& aCurrentColor, const TRect& aImageRect); - /** Destructor - * - * @since S60 5.0 - * @param - - * @return - - */ - ~CSelectionPopup (); + /** Destructor + * + * @since S60 5.0 + * @param - + * @return - + */ + ~CSelectionPopup(); - /** Second phase constructor - * - * @since S60 5.0 - * @param aParent - Parent control - * @return - - */ - void ConstructL ( CCoeControl* aParent ); - + /** Second phase constructor + * + * @since S60 5.0 + * @param aParent - Parent control + * @return - + */ + void ConstructL(CCoeControl* aParent); + /** OfferKeyEventL - * - * @see CCoeControl - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** HandlePointerEventL - * - * @see CCoeControl - */ - void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + * + * @see CCoeControl + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /** HandlePointerEventL + * + * @see CCoeControl + */ + void HandlePointerEventL(const TPointerEvent &aPointerEvent); + +public: + //new methods -public: //new methods - - /** GridRect - * - * Returns popup component's rectangle area - * - * @since S60 5.0 - * @param - - * @return TRect The area of the popup - */ - TRect GridRect() const; - - /** HighlightedItemPressed - * - * This function can be used to check whether user has pressed (by stylus) - * currently highlighted color item. - * - * @since S60 5.0 - * @param aPosition position value to be checked. - * @return ETrue if aPosition is in the rect area of currently highlighted - * plugin item, EFalse otherwise. - */ - TBool HighlightedItemPressed( TPoint aPosition ) const; - - /** SetSelectedValue - * - * Set currently highlighted item - * - * @param aSelected selected item index. - * @since S60 5.0 - */ - void SetSelectedValue( TInt aSelected ); - - /** GetSelectedValue - * - * Returns current highlighted item value - * - * @since S60 5.0 - * @return TInt Currently selected value - */ - TInt GetSelectedValue() const; - -private: - - /** CreateColorBitmapsL - * - * Creates a bitmap array - * - * @since S60 5.0 - * @param aSize Size that color bitmaps should be created to - * @return - - */ - void CreateColorBitmapsL( TSize aSize ); - + /** GridRect + * + * Returns popup component's rectangle area + * + * @since S60 5.0 + * @param - + * @return TRect The area of the popup + */ + TRect GridRect() const; + + /** HighlightedItemPressed + * + * This function can be used to check whether user has pressed (by stylus) + * currently highlighted color item. + * + * @since S60 5.0 + * @param aPosition position value to be checked. + * @return ETrue if aPosition is in the rect area of currently highlighted + * plugin item, EFalse otherwise. + */ + TBool HighlightedItemPressed(TPoint aPosition) const; + + /** SetSelectedValue + * + * Set currently highlighted item + * + * @param aSelected selected item index. + * @since S60 5.0 + */ + void SetSelectedValue(TInt aSelected); + + /** GetSelectedValue + * + * Returns current highlighted item value + * + * @since S60 5.0 + * @return TInt Currently selected value + */ + TInt GetSelectedValue() const; + +private: + + /** CreateColorBitmapsL + * + * Creates a bitmap array + * + * @since S60 5.0 + * @param aSize Size that color bitmaps should be created to + * @return - + */ + void CreateColorBitmapsL(TSize aSize); + protected: - /** SizeChanged - * - * @see CCoeControl - */ - virtual void SizeChanged(); + /** SizeChanged + * + * @see CCoeControl + */ + virtual void SizeChanged(); /** Draw - * - * @see CCoeControl - */ - virtual void Draw( const TRect& aRect ) const; - + * + * @see CCoeControl + */ + virtual void Draw(const TRect& aRect) const; private: - - // Popup graphic bitmaps - CFbsBitmap* iPopupCenter; - CFbsBitmap* iPopupCenterMask; - CFbsBitmap* iPopupCornerTL; - CFbsBitmap* iPopupCornerTLMask; - CFbsBitmap* iPopupCornerTR; - CFbsBitmap* iPopupCornerTRMask; - CFbsBitmap* iPopupCornerBL; - CFbsBitmap* iPopupCornerBLMask; - CFbsBitmap* iPopupCornerBR; - CFbsBitmap* iPopupCornerBRMask; - CFbsBitmap* iPopupSideL; - CFbsBitmap* iPopupSideLMask; - CFbsBitmap* iPopupSideR; - CFbsBitmap* iPopupSideRMask; - CFbsBitmap* iPopupSideT; - CFbsBitmap* iPopupSideTMask; - CFbsBitmap* iPopupSideB; - CFbsBitmap* iPopupSideBMask; - - // Popup rects - TRect iPopupCenterRect; - TRect iPopupCornerTLRect; - TRect iPopupCornerTRRect; - TRect iPopupCornerBLRect; - TRect iPopupCornerBRRect; - TRect iPopupSideLRect; - TRect iPopupSideRRect; - TRect iPopupSideTRect; - TRect iPopupSideBRect; - TRect iHeadingRect; - - // Format and layout information of the heading text - TAknLayoutText iLayoutTextHeading; - - // Contains rectangles of all grid highlight items - RArray< TRect > iHighlightRectsArray; - - // Contains rectangles of all grid color items - RArray< TRect > iGridRectsArray; - - // Color bitmaps - RPointerArray < CFbsBitmap > iColorBitmapsArray; - - // Used values - RArray< TInt > iItemArray; - - TInt iCurrentItem; + + // Popup graphic bitmaps + CFbsBitmap* iPopupCenter; + CFbsBitmap* iPopupCenterMask; + CFbsBitmap* iPopupCornerTL; + CFbsBitmap* iPopupCornerTLMask; + CFbsBitmap* iPopupCornerTR; + CFbsBitmap* iPopupCornerTRMask; + CFbsBitmap* iPopupCornerBL; + CFbsBitmap* iPopupCornerBLMask; + CFbsBitmap* iPopupCornerBR; + CFbsBitmap* iPopupCornerBRMask; + CFbsBitmap* iPopupSideL; + CFbsBitmap* iPopupSideLMask; + CFbsBitmap* iPopupSideR; + CFbsBitmap* iPopupSideRMask; + CFbsBitmap* iPopupSideT; + CFbsBitmap* iPopupSideTMask; + CFbsBitmap* iPopupSideB; + CFbsBitmap* iPopupSideBMask; - -}; + // Popup rects + TRect iPopupCenterRect; + TRect iPopupCornerTLRect; + TRect iPopupCornerTRRect; + TRect iPopupCornerBLRect; + TRect iPopupCornerBRRect; + TRect iPopupSideLRect; + TRect iPopupSideRRect; + TRect iPopupSideTRect; + TRect iPopupSideBRect; + TRect iHeadingRect; + + // Format and layout information of the heading text + TAknLayoutText iLayoutTextHeading; + + // Contains rectangles of all grid highlight items + RArray iHighlightRectsArray; + // Contains rectangles of all grid color items + RArray iGridRectsArray; -NONSHARABLE_CLASS( CSelectionDialog ): public CAknDialog - { + // Color bitmaps + RPointerArray iColorBitmapsArray; + + // Used values + RArray iItemArray; + + TInt iCurrentItem; + + TRgb iCurrentColor; + + TRect iImageRect; + }; + +NONSHARABLE_CLASS( CSelectionDialog ) : public CAknDialog + { public: - - /** RunDlgLD - * - * @param aBitmap - background bitmap - * @param aRect - Rect for the dialog - * @param aSelection - Selected value to be returned - * @return - ExecuteLD() return value - */ - static TInt RunDlgLD( const CFbsBitmap* aBitmap, - const TRect& aRect, - TInt& aSelection ); + /** RunDlgLD + * + * @param aBitmap - background bitmap + * @param aRect - Rect for the dialog + * @param aSelection - Selected value to be returned + * @return - ExecuteLD() return value + */ + static TInt RunDlgLD(const CFbsBitmap* aBitmap, const TRect& aRect, + TInt& aSelection, TRgb& aCurrentColor, const TRect& aImageRect); - virtual ~CSelectionDialog(); + virtual ~CSelectionDialog(); - /** OkToExitL - * - * From CAknDialog update member variables . - * @param aButtonId The ID of the button that was activated. - * @return Should return ETrue if the dialog should exit, - * and EFalse if it should not - */ - TBool OkToExitL( TInt aButtonId ); + /** OkToExitL + * + * From CAknDialog update member variables . + * @param aButtonId The ID of the button that was activated. + * @return Should return ETrue if the dialog should exit, + * and EFalse if it should not + */ + TBool OkToExitL(TInt aButtonId); - /** Draw - * - * - * @see CAknDialog - * - */ - void Draw(const TRect& aRect) const; + /** Draw + * + * + * @see CAknDialog + * + */ + void Draw(const TRect& aRect) const; - /** SizeChanged - * - * - * @see CCoeControl - * - */ - virtual void SizeChanged(); + /** SizeChanged + * + * + * @see CCoeControl + * + */ + virtual void SizeChanged(); + + /** OfferKeyEventL + * + * @see CCoeControl + * + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType); - /** OfferKeyEventL - * - * @see CCoeControl - * - */ - virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); - - /** HandlePointerEventL - * - * @see CCoeControl - */ - virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); - - /** PreLayoutDynInitL - * - * @see CEikDialog - * - */ - virtual void PreLayoutDynInitL(); + /** HandlePointerEventL + * + * @see CCoeControl + */ + virtual void HandlePointerEventL(const TPointerEvent &aPointerEvent); + + /** PreLayoutDynInitL + * + * @see CEikDialog + * + */ + virtual void PreLayoutDynInitL(); - /** CountComponentControls - * - * @see CCoeControl - * - */ - TInt CountComponentControls() const; + /** CountComponentControls + * + * @see CCoeControl + * + */ + TInt CountComponentControls() const; - /** ComponentControl - * - * @see CCoeControl - * - */ - virtual CCoeControl* ComponentControl(TInt aIndex) const; - -private: // implementation - - CSelectionDialog( TInt& aSelectino ); - void ConstructL( const CFbsBitmap* aBitmap, const TRect& aRect); + /** ComponentControl + * + * @see CCoeControl + * + */ + virtual CCoeControl* ComponentControl(TInt aIndex) const; private: - - // Own: popup component - CSelectionPopup* iPopup; - - // Ref: Selected color - TInt& iCurrentValue; - - }; + // implementation + + CSelectionDialog(TInt& aSelectino); + void ConstructL(const CFbsBitmap* aBitmap, const TRect& aRect, + TRgb& aCurrentColor, const TRect& aImageRect); + +private: + + // Own: popup component + CSelectionPopup* iPopup; + + // Ref: Selected color + TInt& iCurrentValue; + }; #endif // _SELECTIONPOPUP_H diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/AnimationAO.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/AnimationAO.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,102 @@ +/* + ============================================================================ + Name : AnimationAO.cpp + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CAnimationAO implementation + ============================================================================ + */ + +#include "AnimationAO.h" +// --------------------------------------------------------------------------- +// CAnimationAO() +// --------------------------------------------------------------------------- +// +CAnimationAO::CAnimationAO() : + CActive(EPriorityStandard) // Standard priority + { + } +// --------------------------------------------------------------------------- +// NewLC() +// --------------------------------------------------------------------------- +// +CAnimationAO* CAnimationAO::NewLC() + { + CAnimationAO* self = new (ELeave) CAnimationAO(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CAnimationAO* CAnimationAO::NewL() + { + CAnimationAO* self = CAnimationAO::NewLC(); + CleanupStack::Pop(); // self; + return self; + } +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CAnimationAO::ConstructL() + { + User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer + CActiveScheduler::Add(this); // Add to scheduler + } +// --------------------------------------------------------------------------- +// CAnimationAO() +// --------------------------------------------------------------------------- +// +CAnimationAO::~CAnimationAO() + { + Cancel(); // Cancel any request, if outstanding + iTimer.Close(); // Destroy the RTimer object + } +// --------------------------------------------------------------------------- +// DoCancel() +// --------------------------------------------------------------------------- +// +void CAnimationAO::DoCancel() + { + iTimer.Cancel(); + } +// --------------------------------------------------------------------------- +// StartL() +// --------------------------------------------------------------------------- +// +void CAnimationAO::StartL(TTimeIntervalMicroSeconds32 aDelay) + { + Cancel(); // Cancel any request, just to be sure + iTimer.After(iStatus, aDelay); // Set for later + SetActive(); // Tell scheduler a request is active + } +// --------------------------------------------------------------------------- +// RunL() +// --------------------------------------------------------------------------- +// +void CAnimationAO::RunL() + { + iTimer.After(iStatus, 33333); // Set for 1 sec later + SetActive(); + iObserver->Notify(); + } +// --------------------------------------------------------------------------- +// RunError() +// --------------------------------------------------------------------------- +// +TInt CAnimationAO::RunError(TInt aError) + { + return aError; + } +// --------------------------------------------------------------------------- +// SetObserver() +// --------------------------------------------------------------------------- +// +void CAnimationAO::SetObserver(MAnimationObserver *aObserver) + { + iObserver = aObserver; + } diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/CImageLabel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/CImageLabel.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,395 @@ +/* + ============================================================================ + Name : CImageLabel.cpp + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CCImageLabel implementation + ============================================================================ + */ +#include "TimeAO.h" +#include "CImageLabel.h" +#include +#include +#include //For iEikonEnv +#include +// --------------------------------------------------------------------------- +// CImageLabel() +// --------------------------------------------------------------------------- +// +CImageLabel::CImageLabel() + { + // No implementation required + } +// --------------------------------------------------------------------------- +// ~CImageLabel() +// --------------------------------------------------------------------------- +// +CImageLabel::~CImageLabel() + { + if (iBitmap != NULL) + { + delete iBitmap; + iBitmap = NULL; + } + if (iBitmapMask != NULL) + { + delete iBitmapMask; + iBitmap = NULL; + } + if (iTimeAO != NULL) + { + delete iTimeAO; + iTimeAO = NULL; + } + } +// --------------------------------------------------------------------------- +// NewLC() +// --------------------------------------------------------------------------- +// +CImageLabel* CImageLabel::NewLC(CCoeControl *aParent, const TRect& aRect, + TOOLTIP_LAYOUT aLabelLayout) + { + CImageLabel* self = new (ELeave) CImageLabel(); + CleanupStack::PushL(self); + self->ConstructL(aParent, aRect, aLabelLayout); + return self; + } +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CImageLabel* CImageLabel::NewL(CCoeControl *aParent, const TRect& aRect, + TOOLTIP_LAYOUT aLabelLayout) + { + CImageLabel* self = CImageLabel::NewLC(aParent, aRect, aLabelLayout); + CleanupStack::Pop(); // self; + return self; + } +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CImageLabel::ConstructL(CCoeControl *aParent, const TRect& aRect, + TOOLTIP_LAYOUT aLabelLayout) + { + SetContainerWindowL(*aParent); + SetRect(aRect); + + iState = ENone; + iLabelLayout = aLabelLayout; + iBitmap = NULL; + iBitmapMask = NULL; + + iTooltipStartPoint = TPoint(0, 0); + CalculateImagePoint(); + CalculateBoundingRectStartPoint(); + CalculateZones(); + + iTimeAO = CTimeAO::NewL(); + iTimeAO->SetObserver(this); + + iIsHandlePointerNotifyProcessing = EFalse; + } +// --------------------------------------------------------------------------- +// HandlePointerEventL() +// --------------------------------------------------------------------------- +// +void CImageLabel::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + switch (aPointerEvent.iType) + { + case TPointerEvent::EButton1Down: + { + if(iIsHandlePointerNotifyProcessing) + { + //Ignore button down event when HandlePointerNotify is processing. + break; + } + iState = ESelected; + DrawNow(); + iTimeAO->StartL(); + + break; + } + case TPointerEvent::EButton1Up: + { + iTimeAO->Cancel(); + //If the statte is moveing or selected.change the state to ENone + + if (iState == EMoving || iState == ESelectedWithTooltip) + { + iState = ENone; + DrawNow(); + } + else + { + iState = ENone; + DrawNow(); + //If not on process start it + if(!iIsHandlePointerNotifyProcessing) + { + iIsHandlePointerNotifyProcessing = ETrue; + //To avoid pop up dialog two times by quick double chick + iHandlePointerObserver->HandlePointerNotify(this); + iIsHandlePointerNotifyProcessing = EFalse; + } + } + break; + } + default: + break; + } + } +// --------------------------------------------------------------------------- +// SizeChanged() +// --------------------------------------------------------------------------- +// +void CImageLabel::SizeChanged() + { + DrawNow(); + } +// --------------------------------------------------------------------------- +// Draw() +// --------------------------------------------------------------------------- +// +void CImageLabel::Draw(const TRect& aRect) const + { + // Get the standard graphics context + CWindowGc& gc = SystemGc(); + + TRgb Rgb(KRgbGray); + Rgb.SetAlpha(180); + gc.SetBrushColor(Rgb); + gc.SetBrushStyle(CWindowGc::ESolidBrush); + gc.SetPenStyle(CGraphicsContext::ESolidPen); + gc.SetPenColor(KRgbDarkGray); + gc.SetPenSize(TSize(2,2)); + + switch (iState) + { + case ENone: + { + //do nothing + } + break; + case EMoving: + { + //Draw the bounding rect + TSize cornorSize(8, 8); + gc.DrawRoundRect(TRect(iBoundingRectStartPoint, iBoundingSize), + cornorSize); + break; + } + case ESelected: + { + //Draw the bouding rect + TSize cornorSize(8, 8); + gc.DrawRoundRect(TRect(iBoundingRectStartPoint, iBoundingSize), + cornorSize); + break; + } + case ESelectedWithTooltip: + { + //Draw the bounding rect + TSize cornorSize(8, 8); + gc.DrawRoundRect(TRect(iBoundingRectStartPoint, iBoundingSize), + cornorSize); + + CFont* pFont = NULL; + TFontSpec fontSpec = iEikonEnv->TitleFont()->FontSpecInTwips(); + fontSpec.iHeight *= 0.535; + iCoeEnv->ScreenDevice()->GetNearestFontInTwips(pFont, fontSpec); + + //Draw the tooltips + gc.UseFont(pFont); + gc.SetPenStyle(CGraphicsContext::ESolidPen); + gc.SetPenColor(KRgbGreen); + gc.DrawText(iTooltip, iTooltipStartPoint); + iCoeEnv->ScreenDevice()->ReleaseFont(pFont); + gc.DiscardFont(); + break; + } + default: + break; + } + + //Draw svg picture + if (iBitmap != NULL) + { + gc.BitBltMasked(iImageStartPoint, iBitmap, TRect(TPoint(0, 0), TSize( + iBoundingSize)), iBitmapMask, ETrue); + } + + } +// --------------------------------------------------------------------------- +// Notify() +// --------------------------------------------------------------------------- +// +void CImageLabel::Notify() + { + //if the state is not moving set selected with tooltips + if (iState != EMoving) + iState = ESelectedWithTooltip; + DrawNow(); + } +// --------------------------------------------------------------------------- +// SetImage() +// --------------------------------------------------------------------------- +// +void CImageLabel::SetImage(const TDesC& aMbmPackage, TInt aIndex) + { + //Load pictures + AknIconUtils::CreateIconL(iBitmap, iBitmapMask, aMbmPackage, aIndex, aIndex + + 1); + AknIconUtils::SetSize(iBitmap, iImageSize); + AknIconUtils::SetSize(iBitmapMask, iImageSize); + + ActivateL(); + } +// --------------------------------------------------------------------------- +// SetTooltip() +// --------------------------------------------------------------------------- +// +void CImageLabel::SetTooltip(const TDesC& aTooltip) + { + iTooltip.Copy(aTooltip); + CalculateTooltipPoint(); + } +// --------------------------------------------------------------------------- +// ResetControl() +// --------------------------------------------------------------------------- +// +void CImageLabel::ResetControl() + { + CalculateImagePoint(); + CalculateBoundingRectStartPoint(); + CalculateTooltipPoint(); + CalculateZones(); + } +// --------------------------------------------------------------------------- +// CalculateImagePoint() +// --------------------------------------------------------------------------- +// +void CImageLabel::CalculateImagePoint() + { + // landscape + if (iLabelLayout == ELabelHorizontal) + { + iImageStartPoint.iX = Rect().iTl.iX + 2; + iImageStartPoint.iY = Rect().iBr.iY - (Rect().iBr.iX - Rect().iTl.iX) + + 2; + } + //portrait + else if (iLabelLayout == ELabelVertical) + { + iImageStartPoint.iX = Rect().iBr.iX - (Rect().iBr.iY - Rect().iTl.iY) + + 2; + iImageStartPoint.iY = Rect().iTl.iY + 2; + } + } +// --------------------------------------------------------------------------- +// CalculateBoundingRectStartPoint() +// calcuate related start point +// --------------------------------------------------------------------------- +// +void CImageLabel::CalculateBoundingRectStartPoint() + { + // landscape + if (iLabelLayout == ELabelHorizontal) + { + iBoundingRectStartPoint.iX = Rect().iTl.iX + 1; + iBoundingRectStartPoint.iY = Rect().iBr.iY - (Rect().iBr.iX + - Rect().iTl.iX) + 1; + } + //portrait + else if (iLabelLayout == ELabelVertical) + { + iBoundingRectStartPoint.iX = Rect().iBr.iX - (Rect().iBr.iY + - Rect().iTl.iY) + 1; + iBoundingRectStartPoint.iY = Rect().iTl.iY + 1; + } + + } +// --------------------------------------------------------------------------- +// CalculateTooltipPoint() +// Where show the tooltips. +// --------------------------------------------------------------------------- +// +void CImageLabel::CalculateTooltipPoint() + { + // landscape + if (iLabelLayout == ELabelHorizontal) + { + CFont* pFont = NULL; + TFontSpec fontSpec = iEikonEnv->TitleFont()->FontSpecInTwips(); + fontSpec.iHeight *= 0.535; + iCoeEnv->ScreenDevice()->GetNearestFontInTwips(pFont, fontSpec); + int tooltipLength = pFont->TextWidthInPixels(iTooltip); + iCoeEnv->ScreenDevice()->ReleaseFont(pFont); + + iTooltipStartPoint.iX = Rect().iTl.iX + + (Rect().Width() - tooltipLength) / 2; + iTooltipStartPoint.iY = Rect().iBr.iY - (Rect().iBr.iX - Rect().iTl.iX); + } + //portrait + else if (iLabelLayout == ELabelVertical) + { + CFont* pFont = NULL; + TFontSpec fontSpec = iEikonEnv->TitleFont()->FontSpecInTwips(); + fontSpec.iHeight *= 0.535; + iCoeEnv->ScreenDevice()->GetNearestFontInTwips(pFont, fontSpec); + int tooltipLength = pFont->TextWidthInPixels(iTooltip); + int tooltipHeight = pFont->HeightInPixels(); + iCoeEnv->ScreenDevice()->ReleaseFont(pFont); + + iTooltipStartPoint.iX = Rect().iTl.iX + (iBoundingRectStartPoint.iX + - Rect().iTl.iX - tooltipLength) / 2; + iTooltipStartPoint.iY = Rect().iBr.iY - (Rect().Height() + - tooltipHeight) / 2; + } + } +// --------------------------------------------------------------------------- +// CalculateZones() +// --------------------------------------------------------------------------- +// + +void CImageLabel::CalculateZones() + { + // landscape + if (iLabelLayout == ELabelHorizontal) + { + iBoundingSize.iHeight = Rect().iBr.iX - Rect().iTl.iX - 2; + iBoundingSize.iWidth = iBoundingSize.iHeight - 2; + + iImageSize.iHeight = iBoundingSize.iHeight - 4; + iImageSize.iWidth = iBoundingSize.iWidth - 4; + } + //portrait + else if (iLabelLayout == ELabelVertical) + { + iBoundingSize.iHeight = Rect().iBr.iY - Rect().iTl.iY - 2; + iBoundingSize.iWidth = iBoundingSize.iHeight - 2; + + iImageSize.iHeight = iBoundingSize.iHeight - 4; + iImageSize.iWidth = iBoundingSize.iWidth - 4; + } + } +// --------------------------------------------------------------------------- +// LabelIsMoving() +// --------------------------------------------------------------------------- +// + +void CImageLabel::LabelIsMoving() + { + iState = EMoving; + } +// --------------------------------------------------------------------------- +// SetHandlePointerObserver() +// --------------------------------------------------------------------------- +// +void CImageLabel::SetHandlePointerObserver( + MHandlePointerObserver* aHandlePointerObserver) + { + iHandlePointerObserver = aHandlePointerObserver; + } diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/CustomerComponet.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/CustomerComponet.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,271 @@ +/* + ============================================================================ + Name : CustomerComponet.cpp + Author : henry + Version : 1.0 + Copyright : Your copyright notice + Description : CCustomerComponet implementation + ============================================================================ + */ + +#include "CustomerComponet.h" +#include "gdi.h" +#include +#include "imageditorfilterdraw.mbg" +#include +#include +#include + +// --------------------------------------------------------------------------- +// Default constructer +// --------------------------------------------------------------------------- +// +CCustomerComponet::CCustomerComponet() + { + // No implementation required + } + +CCustomerComponet::~CCustomerComponet() + { + if (iMenu) + { + delete iMenu; + iMenu = NULL; + } + if (iRight) + { + delete iRight; + iRight = NULL; + } + if (iLeft) + { + delete iLeft; + iLeft = NULL; + } + if (iTop) + { + delete iTop; + iTop = NULL; + } + if (iBottom) + { + delete iBottom; + iBottom = NULL; + } + if (iMenuMask) + { + delete iMenuMask; + iMenuMask = NULL; + } + if (iRightMask) + { + delete iRightMask; + iRightMask = NULL; + } + if (iLeftMask) + { + delete iLeftMask; + iLeftMask = NULL; + } + if (iTopMask) + { + delete iTopMask; + iTopMask = NULL; + } + if (iBottomMask) + { + delete iBottomMask; + iBottomMask = NULL; + } + } +// --------------------------------------------------------------------------- +// NewLC +// --------------------------------------------------------------------------- +// +CCustomerComponet* CCustomerComponet::NewLC(TRect & aRect, CCoeControl* aParent) + { + CCustomerComponet* self = new (ELeave) CCustomerComponet(); + CleanupStack::PushL(self); + self->ConstructL(aRect, aParent); + return self; + } +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CCustomerComponet* CCustomerComponet::NewL(TRect & aRect, CCoeControl* aParent) + { + CCustomerComponet* self = CCustomerComponet::NewLC(aRect, aParent); + CleanupStack::Pop(); // self; + return self; + } +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CCustomerComponet::ConstructL(TRect & aRect, CCoeControl* aParent) + { + SetContainerWindowL(*aParent); + EnableDragEvents(); + SetRect(aRect); + TRgb color = KRgbBlue; + //Set transparent effect + if (KErrNone == Window().SetTransparencyAlphaChannel()) + { + color.SetAlpha(0); + } + Window().SetBackgroundColor(color); + + iDrawDirection = EFalse; + + //Load pictures and mask + _LIT(iconFileName, "\\resource\\apps\\imageditorfilterdraw.mbm"); + TFileName iconFile(iconFileName); + //Menu + AknIconUtils::CreateIconL(iMenu, iMenuMask, iconFileName, + EMbmImageditorfilterdraw15a, EMbmImageditorfilterdrawMenumask); + //Right + AknIconUtils::CreateIconL(iRight, iRightMask, iconFileName, + EMbmImageditorfilterdrawRight, EMbmImageditorfilterdrawRightmask); + //Left + AknIconUtils::CreateIconL(iLeft, iLeftMask, iconFileName, + EMbmImageditorfilterdrawLeft, EMbmImageditorfilterdrawLeftmask); + //Top + AknIconUtils::CreateIconL(iTop, iTopMask, iconFileName, + EMbmImageditorfilterdrawTop, EMbmImageditorfilterdrawTopmask); + //Bottom + AknIconUtils::CreateIconL(iBottom, iBottomMask, iconFileName, + EMbmImageditorfilterdrawBottom, EMbmImageditorfilterdrawBottommask); + + ActivateL(); + } +// --------------------------------------------------------------------------- +// Draw +// --------------------------------------------------------------------------- +// +void CCustomerComponet::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + gc.Clear(aRect); + //Create rect for showing pictures. + TRect menuRect, topRect, bottomRect, rightRect, leftRect; + + menuRect = aRect; + //get the width of the rect + TInt wx = aRect.iBr.iX - aRect.iTl.iX; + // get the height of the screen + TInt hy = aRect.iBr.iY - aRect.iTl.iY; + //Set top rect. + topRect.SetRect(TPoint(wx / 3 + aRect.iTl.iX, aRect.iTl.iY), TPoint( + (wx / 3) * 2 + aRect.iTl.iX, hy / 3 + aRect.iTl.iY)); + //Set bottom rect + bottomRect.SetRect(TPoint((wx/3)+aRect.iTl.iX,(hy/3)*2+aRect.iTl.iY), + TPoint((wx/3)*2+aRect.iTl.iX,aRect.iBr.iY)); + //set right rect. + rightRect.SetRect(TPoint(aRect.iTl.iX,hy/3+aRect.iTl.iY), TPoint(wx/3+aRect.iTl.iX,(hy/3)*2+aRect.iTl.iY)); + + //set left rect. + leftRect.SetRect(TPoint((wx/3)*2+aRect.iTl.iX,hy/3+aRect.iTl.iY), + TPoint(aRect.iBr.iX,(hy/3)*2+aRect.iTl.iY)); + //Set set size for pictures + + AknIconUtils::SetSize(iMenu, aRect.Size(), EAspectRatioPreserved); + AknIconUtils::SetSize(iMenuMask, aRect.Size(), EAspectRatioPreserved); + + AknIconUtils::SetSize(iTop, topRect.Size(), EAspectRatioPreserved); + AknIconUtils::SetSize(iTopMask, topRect.Size(), EAspectRatioPreserved); + + AknIconUtils::SetSize(iBottom, bottomRect.Size(), EAspectRatioPreserved); + AknIconUtils::SetSize(iBottomMask, bottomRect.Size(), EAspectRatioPreserved); + + AknIconUtils::SetSize(iRight, rightRect.Size(), EAspectRatioPreserved); + AknIconUtils::SetSize(iRightMask, rightRect.Size(), EAspectRatioPreserved); + + AknIconUtils::SetSize(iLeft, leftRect.Size(), EAspectRatioPreserved); + AknIconUtils::SetSize(iLeftMask, leftRect.Size(), EAspectRatioPreserved); + + //Draw menu + gc.DrawBitmapMasked(menuRect, iMenu, TRect(TPoint(0, 0), + iMenu->SizeInPixels()), iMenuMask, ETrue); + //if the user press the menu bottom show direction rect. + if (iDrawDirection) + { + gc.DrawBitmapMasked(topRect, iTop, TRect(TPoint(0, 0), + iTop->SizeInPixels()), iTopMask, ETrue); + + gc.DrawBitmapMasked(bottomRect, iBottom, TRect(TPoint(0, 0), + iBottom->SizeInPixels()), iBottomMask, ETrue); + gc.DrawBitmapMasked(leftRect, iRight, TRect(TPoint(0, 0), + iRight->SizeInPixels()), iRightMask, ETrue); + gc .DrawBitmapMasked(rightRect, iLeft, TRect(TPoint(0, 0), + iLeft->SizeInPixels()), iLeftMask, ETrue); + } + } +// --------------------------------------------------------------------------- +// SetRect +// --------------------------------------------------------------------------- +// +void CCustomerComponet::SetRect(TRect& aRect) + { + DrawNow(aRect); + } +// --------------------------------------------------------------------------- +// SizeChanged() +// --------------------------------------------------------------------------- +// +void CCustomerComponet::SizeChanged() + { +//Nothing done here. + } +// --------------------------------------------------------------------------- +// HandlePointerEventL() +// --------------------------------------------------------------------------- +// +void CCustomerComponet::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + switch (aPointerEvent.iType) + { + + case TPointerEvent::EButton1Down: + { + iDrawDirection = ETrue; + iButtonFlag = ETrue; + iPointerObserver->HandlePointerNotify(this); + DrawNow(); + } + break; + case TPointerEvent::EButton1Up: + { + iDrawDirection = EFalse; + iButtonFlag = EFalse; + iPointerObserver->HandlePointerNotify(this); + DrawNow(); + } + break; + case TPointerEvent::EDrag: + { + DrawNow(); + } + break; + default: + break; + } + } +// --------------------------------------------------------------------------- +// SetHandlePointerObserver() +// --------------------------------------------------------------------------- +// +void CCustomerComponet::SetHandlePointerObserver( + MHandlePointerObserver* aHandlePointerObserver) + { + iPointerObserver = aHandlePointerObserver; + + } +// --------------------------------------------------------------------------- +// GetButtonType() +// --------------------------------------------------------------------------- +// +TBool CCustomerComponet::GetButtonType() + { + return iButtonFlag; + } diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/RollAO.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/RollAO.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,103 @@ +/* + ============================================================================ + Name : AnimationAO.cpp + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CAnimationAO implementation + ============================================================================ + */ + +#include "RollAO.h" +// --------------------------------------------------------------------------- +// CRollAO() +// --------------------------------------------------------------------------- +// +CRollAO::CRollAO() : + CActive(EPriorityStandard) // Standard priority + { + } +// --------------------------------------------------------------------------- +// NewLC() +// --------------------------------------------------------------------------- +// +CRollAO* CRollAO::NewLC() + { + CRollAO* self = new (ELeave) CRollAO(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CRollAO* CRollAO::NewL() + { + CRollAO* self = CRollAO::NewLC(); + CleanupStack::Pop(); // self; + return self; + } +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CRollAO::ConstructL() + { + User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer + CActiveScheduler::Add(this); // Add to scheduler + } +// --------------------------------------------------------------------------- +// ~CRollAO() +// --------------------------------------------------------------------------- +// +CRollAO::~CRollAO() + { + Cancel(); // Cancel any request, if outstanding + iTimer.Close(); // Destroy the RTimer object + // Delete instance variables if any + } +// --------------------------------------------------------------------------- +// DoCancel() +// --------------------------------------------------------------------------- +// +void CRollAO::DoCancel() + { + iTimer.Cancel(); + } +// --------------------------------------------------------------------------- +// StartL() +// --------------------------------------------------------------------------- +// +void CRollAO::StartL(TTimeIntervalMicroSeconds32 aDelay) + { + Cancel(); // Cancel any request, just to be sure + iTimer.After(iStatus, aDelay); // Set for later + SetActive(); // Tell scheduler a request is active + } +// --------------------------------------------------------------------------- +// RunL() +// --------------------------------------------------------------------------- +// +void CRollAO::RunL() + { + iTimer.After(iStatus, 300); // Set for 1 sec later + SetActive(); + iObserver->Roll(); + } +// --------------------------------------------------------------------------- +// RunError() +// --------------------------------------------------------------------------- +// +TInt CRollAO::RunError(TInt aError) + { + return aError; + } +// --------------------------------------------------------------------------- +// SetObserver() +// --------------------------------------------------------------------------- +// +void CRollAO::SetObserver(MRollObserver *aObserver) + { + iObserver = aObserver; + } diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/TimeAO.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/TimeAO.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -0,0 +1,106 @@ +/* + ============================================================================ + Name : TimeAO.cpp + Author : + Version : 1.0 + Copyright : Your copyright notice + Description : CTimeAO implementation + ============================================================================ + */ + +#include "TimeAO.h" +#include "MCountTime.h" +// --------------------------------------------------------------------------- +// CTimeAO() +// --------------------------------------------------------------------------- +// +CTimeAO::CTimeAO() : + CActive(EPriorityStandard) // Standard priority + { + } +// --------------------------------------------------------------------------- +// NewLC() +// --------------------------------------------------------------------------- +// +CTimeAO* CTimeAO::NewLC() + { + CTimeAO* self = new (ELeave) CTimeAO(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CTimeAO* CTimeAO::NewL() + { + CTimeAO* self = CTimeAO::NewLC(); + CleanupStack::Pop(); // self; + return self; + } +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CTimeAO::ConstructL() + { + User::LeaveIfError(iTimer.CreateLocal()); + CActiveScheduler::Add(this); // Add to scheduler + } +// --------------------------------------------------------------------------- +// ~CTimeAO() +// --------------------------------------------------------------------------- +// +CTimeAO::~CTimeAO() + { + Cancel(); // Cancel any request, if outstanding + iTimer.Close(); // Destroy the RTimer object + // Delete instance variables if any + } +// --------------------------------------------------------------------------- +// DoCancel() +// --------------------------------------------------------------------------- +// +void CTimeAO::DoCancel() + { + iTimer.Cancel(); + } +// --------------------------------------------------------------------------- +// StartL() +// --------------------------------------------------------------------------- +// +void CTimeAO::StartL() + { + Cancel(); // Cancel any request, just to be sure + iTimer.After(iStatus, 1000000); // Set for later + SetActive(); // Tell scheduler a request is active + } +// --------------------------------------------------------------------------- +// SetObserver() +// --------------------------------------------------------------------------- +// +void CTimeAO::SetObserver(MCountTime* aObserver) + { + iObserver = aObserver; + } +// --------------------------------------------------------------------------- +// RunL() +// --------------------------------------------------------------------------- +// +void CTimeAO::RunL() + { + + if (iObserver != NULL) + { + iObserver->Notify(); + } + } +// --------------------------------------------------------------------------- +// RunError() +// --------------------------------------------------------------------------- +// +TInt CTimeAO::RunError(TInt aError) + { + return aError; + } diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/imageeditordrawcontrol.cpp --- a/imageeditor/plugins/DrawPlugin/src/imageeditordrawcontrol.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/src/imageeditordrawcontrol.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -1,30 +1,26 @@ /* -* Copyright (c) 2010 Ixonos Plc. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* Ixonos Plc -* -* Description: -* Image Editor plugin control class. -* -*/ - - + * Copyright (c) 2010 Ixonos Plc. + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - Initial contribution + * + * Contributors: + * Ixonos Plc + * + * Description: + * Image Editor plugin control class. + * + */ // INCLUDES #include "imageeditordrawcontrol.h" #include "draw.hrh" - #include "ImageEditorUI.hrh" #include "ImageEditorPluginBase.hrh" - #include "PluginInfo.h" #include "JpTimer.h" #include "ImageEditorUids.hrh" @@ -32,20 +28,16 @@ #include "SystemParameters.h" #include "drawpath.h" #include "selectionpopup.h" - #include "iepb.h" // debug log #include "imageeditordebugutils.h" - #include #include #include #include #include - #include #include - #include #include #include @@ -53,622 +45,809 @@ #include #include #include - +#include +#include "CImageLabel.h" +#include // Log file _LIT(KDrawPluginLogFile,"drawplugin.log"); // CONSTANTS -const TInt KWait = 1; -const TInt KMainTextIndex = 0; - +const TInt KWait = 1; +const TInt KMainTextIndex = 0; +//#define HORIZ TPoint(0,72),TPoint(502,360) +//#define VERTICAL TPoint(0,92),TPoint(360,579) // --------------------------------------------------------------------------- // NewL // --------------------------------------------------------------------------- // -CImageEditorDrawControl* CImageEditorDrawControl::NewL( - const TRect& aRect, - CCoeControl* aParent ) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NewL()"); +CImageEditorDrawControl* CImageEditorDrawControl::NewL(const TRect& aRect, + CCoeControl* aParent, RPointerArray& aPaths, TRgb& aRgb, + TSize& aSize, TBool &aDisplayTool) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NewL()"); - CImageEditorDrawControl * self = new (ELeave) CImageEditorDrawControl; - CleanupStack::PushL (self); - self->ConstructL (aRect, aParent); - CleanupStack::Pop (); // self - return self; - } + CImageEditorDrawControl * self = new (ELeave) CImageEditorDrawControl( + aPaths, aRgb, aSize, aDisplayTool); + CleanupStack::PushL(self); + self->ConstructL(aRect, aParent); + CleanupStack::Pop(); // self + return self; + } // --------------------------------------------------------------------------- // CImageEditorDrawControl // --------------------------------------------------------------------------- // -CImageEditorDrawControl::CImageEditorDrawControl() : -iTickCount(0), -iNaviStepMultiplier(KDefaultSmallNavigationStepMultiplier), -iDisplayingOkOptionsMenu(EFalse), -iReadyToRender(EFalse), -iResLoader( *ControlEnv() ) -{} +CImageEditorDrawControl::CImageEditorDrawControl( + RPointerArray& aPaths, TRgb& aRgb, TSize& aSize, + TBool& aDisplayTool) : + iTickCount(0), iX(0), iY(0), iNaviStepMultiplier( + KDefaultSmallNavigationStepMultiplier), iDisplayingOkOptionsMenu( + EFalse), iReadyToRender(EFalse), iResLoader(*ControlEnv()), iPaths( + aPaths), iRgb(aRgb), iSize(aSize), iDisplayTool(aDisplayTool) + + { + } // --------------------------------------------------------------------------- // ~CImageEditorDrawControl() // --------------------------------------------------------------------------- // CImageEditorDrawControl::~CImageEditorDrawControl() - { - LOG(KDrawPluginLogFile, - "CImageEditorDrawControl::~CImageEditorDrawControl()"); - delete iTimer; - delete iIndicator; - delete iIndicatorMask; + { + LOG(KDrawPluginLogFile, + "CImageEditorDrawControl::~CImageEditorDrawControl()"); + delete iCustomComponet; + delete iTimer; + delete iIndicator; + delete iIndicatorMask; delete iPopupController; delete iTooltipResize; - iPaths.ResetAndDestroy(); - delete iNaviPaneText; + delete iRollAo; + delete iNaviPaneText; + delete iGc; + delete iBitmapDev; + delete iAnimationAO; + + iUndoPaths.ResetAndDestroy(); iResLoader.Close(); - } + + for (int i = 0; i < iTotalComponent; i++) + { + CImageLabel* &temp = iLabels[i]; + if (temp != NULL) + { + delete temp; + temp = NULL; + } + } + iLabels.ResetAndDestroy(); + + + } // --------------------------------------------------------------------------- // ConstructL // --------------------------------------------------------------------------- // -void CImageEditorDrawControl::ConstructL( - const TRect& /*aRect*/, CCoeControl* aParent ) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::ConstructL()"); - // Set parent window - SetContainerWindowL(*aParent); - - // Create resource utility +void CImageEditorDrawControl::ConstructL(const TRect& aRect, + CCoeControl* aParent) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::ConstructL()"); + + CreateWindowL(); + EnableDragEvents(); + //iRollDirection = EFalse; + iStatuspaneHeight = aRect.iTl.iY; + iUndo = EFalse; + iRedo = EFalse; + iCanRedo = EFalse; + //iRollDirection = ETrue; + // Create resource utility TFileName resFile; // resource file name - _LIT (KResourceFile, "draw.rsc"); + _LIT(KResourceFile, "draw.rsc"); resFile.Append(KPgnResourcePath); resFile.Append(KResourceFile); - User::LeaveIfError( CompleteWithAppPath( resFile ) ); - // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile - // to search for a localised resource in proper search order - iResLoader.OpenL( resFile ); - + User::LeaveIfError(CompleteWithAppPath(resFile)); + // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile + // to search for a localised resource in proper search order + iResLoader.OpenL(resFile); + // Create timer for fast key repeat - iTimer = CJPTimer::NewL( this ); + iTimer = CJPTimer::NewL(this); + + iPopupController = CAknInfoPopupNoteController::NewL(); + iTooltipResize = ControlEnv()->AllocReadResourceL(R_TOOLTIP_TEXT_RESIZE); + + SetExtentToWholeScreen(); + // TRect a(HORIZ); + // iClientRectH = a; + // TRect b(VERTICAL); + // iClientRectV = b; + iCustomComponetClick = EFalse; + TRect rect = Rect(); + //iDisplayTool=ETrue; + if (rect.Width() < rect.Height()) + { + InitializeMainMenu(EMainMenuHorizontal); + } + else if (rect.Width() > rect.Height()) + { + InitializeMainMenu(EMainMenuVertical); + } + + TRect Trect(TPoint(0, 0), TPoint(50, 50)); + iCustomComponet = CCustomerComponet::NewL(Trect, this); + iCustomComponet->SetExtent(TPoint(40, 100), TSize(50, 50)); + iCustomComponet->SetHandlePointerObserver(this); + iLastPointEventType = EFalse; + // Activate control + ActivateL(); + + } + +void CImageEditorDrawControl::InitializeMainMenu( + TMainMenuLayout aMainMenuLayout) + { + iMainMenuLayout = aMainMenuLayout; + _LIT(KSvgPath, "\\resource\\apps\\icons_doodle.mif"); + TFileName svgFile(KSvgPath); + User::LeaveIfError(CompleteWithAppPath(svgFile)); + iTotalComponent = 7; + TRect clipRect; + if (iMainMenuLayout == EMainMenuHorizontal) + { + iLoopMenuRect = TRect(TPoint(0, Rect().iBr.iY - 87), TSize(360, 87)); + + for (int i = 0; i < iTotalComponent; i++) + { + if (iDisplayTool) + { + TRect + Rect1(TPoint(i * 72, iLoopMenuRect.iTl.iY), TSize(72, + 87)); + clipRect = Rect1; + } + + else + { + TRect Rect2(TPoint(i * 72 - iLoopMenuRect.Width() - 72 * 2, + iLoopMenuRect.iTl.iY), TSize(72, 87)); + clipRect = Rect2; + } - iPopupController = CAknInfoPopupNoteController::NewL(); - iTooltipResize = ControlEnv()->AllocReadResourceL(R_TOOLTIP_TEXT_RESIZE); - - EnableDragEvents(); - - // Activate control - ActivateL(); - } + CImageLabel* label = CImageLabel::NewL(this, clipRect, + CImageLabel::ELabelHorizontal); + label->SetHandlePointerObserver(this); + iLabels.Append(label); + } + } + else if (iMainMenuLayout == EMainMenuVertical) + { + iLoopMenuRect = TRect(TPoint(Rect().iBr.iX - 87, 0), TSize(87, 360)); + + for (int i = 0; i < iTotalComponent; i++) + { + if (iDisplayTool) + { + TRect + Rect1(TPoint(iLoopMenuRect.iTl.iX, i * 72), TSize(87, + 72)); + clipRect = Rect1; + } + else + { + TRect Rect2(TPoint(iLoopMenuRect.iTl.iX, i * 72 + - iLoopMenuRect.Height() - 72 * 2), TSize(87, 72)); + clipRect = Rect2; + } + + CImageLabel* label = CImageLabel::NewL(this, clipRect, + CImageLabel::ELabelVertical); + label->SetHandlePointerObserver(this); + iLabels.Append(label); + } + } + + iLabels[0]->SetImage(svgFile, EMbmIcons_doodlePensize); + iLabels[0]->SetTooltip(_L("Pensize")); + + iLabels[1]->SetImage(svgFile, EMbmIcons_doodlePalette); + iLabels[1]->SetTooltip(_L("Palette")); + + iLabels[2]->SetImage(svgFile, EMbmIcons_doodleUndo); + iLabels[2]->SetTooltip(_L("Undo")); + + iLabels[3]->SetImage(svgFile, EMbmIcons_doodleSave); + iLabels[3]->SetTooltip(_L("Save")); + + iLabels[4]->SetImage(svgFile, EMbmIcons_doodleMenu); + iLabels[4]->SetTooltip(_L("About")); + + iLabels[5]->SetImage(svgFile, EMbmIcons_doodlePalette); + iLabels[5]->SetTooltip(_L("Redo")); + + iLabels[6]->SetImage(svgFile, EMbmIcons_doodlePensize); + iLabels[6]->SetTooltip(_L("Null")); + + iAnimationAO = CAnimationAO::NewL(); + iAnimationAO->SetObserver(this); + iRollAo = CRollAO::NewL(); + iRollAo->SetObserver(this); + + iButtonDownPoint = TPoint(0, 0); + iDragStartPoint = TPoint(0, 0); + iDragPrePoint = TPoint(0, 0); + iDragUpPoint = TPoint(0, 0); + + iPointStartInLoopRect = EFalse; + iDragIsStart = EFalse; + iEnableAnimationEffect = EFalse; + iDragOffset = 0; + + } // --------------------------------------------------------------------------- // SetView // --------------------------------------------------------------------------- // void CImageEditorDrawControl::SetView(CAknView* aView) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetView()"); - ASSERT( aView ); - iEditorView = aView; - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetView()"); + ASSERT(aView); + iEditorView = aView; + } // --------------------------------------------------------------------------- // SetSelectedUiItemL // --------------------------------------------------------------------------- // void CImageEditorDrawControl::SetSelectedUiItemL(CPluginInfo* aItem) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSelectedUiItemL()"); - ASSERT( aItem ); - iItem = aItem; - delete iNaviPaneText; - iNaviPaneText = NULL; - iNaviPaneText = (iItem->Parameters()[KMainTextIndex]).AllocL(); - iEditorView->HandleCommandL(EImageEditorCmdRender); - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSelectedUiItemL()"); + ASSERT(aItem); + iItem = aItem; + delete iNaviPaneText; + iNaviPaneText = NULL; + iNaviPaneText = (iItem->Parameters()[KMainTextIndex]).AllocL(); + iEditorView->HandleCommandL(EImageEditorCmdRender); + } // --------------------------------------------------------------------------- // OfferKeyEventL // --------------------------------------------------------------------------- // TKeyResponse CImageEditorDrawControl::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::OfferKeyEventL()"); + const TKeyEvent& aKeyEvent, TEventCode aType) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::OfferKeyEventL()"); + + TKeyResponse response = EKeyWasNotConsumed; - TKeyResponse response = EKeyWasNotConsumed; + // If busy, do not handle anything + if (Busy()) + { + response = EKeyWasConsumed; + } - // If busy, do not handle anything - if ( Busy() ) - { - response = EKeyWasConsumed; - } + // In main state handle the OK Options menu + else if (aKeyEvent.iCode == EKeyOK) + { + iDisplayingOkOptionsMenu = ETrue; + iEditorView->HandleCommandL(EImageEditorTryDisplayMenuBar); + response = EKeyWasConsumed; + } - // In main state handle the OK Options menu - else if ( aKeyEvent.iCode == EKeyOK ) - { - iDisplayingOkOptionsMenu = ETrue; - iEditorView->HandleCommandL (EImageEditorTryDisplayMenuBar); - response = EKeyWasConsumed; - } - - // We handle only event keys - else if (EEventKey == aType) - { + // We handle only event keys + else if (EEventKey == aType) + { switch (aKeyEvent.iCode) - { - + { + case EKeyDownArrow: case EKeyUpArrow: case EKeyRightArrow: - case EKeyLeftArrow: - { - SetPositionOnImage( ComputeIndicatorPosition() ); - StoreParameters( EFalse, EFalse ); + case EKeyLeftArrow: + { + SetPositionOnImage(ComputeIndicatorPosition()); + StoreParameters(EFalse, EFalse); response = EKeyWasConsumed; - break; - } - - case EKeyOK: - { - break; - } + break; + } - case 0x30: // 0 - case 0x32: // 2 - case 0x34: // 4 - case 0x35: // 5 - case 0x36: // 6 - case 0x38: // 8 + case EKeyOK: + { + break; + } + + case 0x30: // 0 + case 0x32: // 2 + case 0x34: // 4 + case 0x35: // 5 + case 0x36: // 6 + case 0x38: // 8 case EStdKeyIncVolume: // zoom in key case EStdKeyDecVolume: // zoom out key - { - StorePosAndScaleRelScreen(); - break; - } + { + StorePosAndScaleRelScreen(); + break; + } default: - { + { break; + } } } - } // Key pressed down, mark pressed key else if (aType == EEventKeyDown) - { + { switch (aKeyEvent.iScanCode) - { + { case EStdKeyUpArrow: - { + { iKeyCode = 1; - response = EKeyWasConsumed; + response = EKeyWasConsumed; break; - } + } case EStdKeyDownArrow: - { + { iKeyCode = 2; - response = EKeyWasConsumed; + response = EKeyWasConsumed; break; - } + } case EStdKeyLeftArrow: - { + { iKeyCode = 3; - response = EKeyWasConsumed; + response = EKeyWasConsumed; break; - } + } case EStdKeyRightArrow: - { + { iKeyCode = 4; - response = EKeyWasConsumed; + response = EKeyWasConsumed; break; + } + } + + if (iKeyCode != 0) + { + iNaviStepMultiplier = KDefaultSmallNavigationStepMultiplier; + iTickCount = 0; + iTimer->Call(KWait); } } - if ( iKeyCode != 0 ) - { - iNaviStepMultiplier = KDefaultSmallNavigationStepMultiplier; - iTickCount = 0; - iTimer->Call( KWait ); - } - } - // Key released, mark all keys to zero else if (aType == EEventKeyUp) - { + { switch (aKeyEvent.iScanCode) - { + { case EStdKeyUpArrow: case EStdKeyDownArrow: case EStdKeyLeftArrow: case EStdKeyRightArrow: - { + { iKeyCode = 0; - response = EKeyWasConsumed; - ShowTooltip(); + response = EKeyWasConsumed; + ShowTooltip(); break; + } } } + + return response; } - return response; - } - // --------------------------------------------------------------------------- // SizeChanged // --------------------------------------------------------------------------- // void CImageEditorDrawControl::SizeChanged() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SizeChanged()"); - } + { + if (iSizeChangeFlag) + { + SetToolBarStatus(); + } + else + { + iSizeChangeFlag = ETrue; + } + if (iDragIsStart) + { + if (iMainMenuLayout == EMainMenuHorizontal) + { + for (TInt i = 0; i < iTotalComponent; i++) + { + if (iLabels[0]->Rect().iTl.iX <= 0) + { + TInt x = iLabels[i]->Rect().iTl.iX; + iLabels[i]->SetPosition(TPoint(x + iDragOffset, + iLoopMenuRect.iTl.iY)); + iLabels[i]->ResetControl(); + } + } + } + else if (iMainMenuLayout == EMainMenuVertical) + { + for (TInt i = 0; i < iTotalComponent; i++) + { + if (iLabels[0]->Rect().iTl.iY <= 0) + { + TInt y = iLabels[i]->Rect().iTl.iY; + iLabels[i]->SetPosition(TPoint(iLoopMenuRect.iTl.iX, y + + iDragOffset)); + iLabels[i]->ResetControl(); + } + } + } + DrawNow(); + } + } +void CImageEditorDrawControl::SetToolBarStatus() + { + + if (iMainMenuLayout == EMainMenuHorizontal) + { + TInt leftX = iLabels[0]->Rect().iTl.iX; + TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; + if (leftX == 0) + iDisplayTool = ETrue; + else if (rightX == 0) + iDisplayTool = EFalse; + } + else if (iMainMenuLayout == EMainMenuVertical) + { + TInt topY = iLabels[0]->Rect().iTl.iY; + TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; + if (topY == 0) + iDisplayTool = ETrue; + else if (bottomY == 0) + iDisplayTool = EFalse; + + } + + } // --------------------------------------------------------------------------- // GetParam // --------------------------------------------------------------------------- // TDesC& CImageEditorDrawControl::GetParam() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetParam()"); - LOGDES(KDrawPluginLogFile, iParam); + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetParam()"); + LOGDES(KDrawPluginLogFile, iParam); return iParam; - } + } // --------------------------------------------------------------------------- // SetSystemParameters // --------------------------------------------------------------------------- // -void CImageEditorDrawControl::SetSystemParameters(const CSystemParameters* aPars) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSystemParameters()"); - ASSERT( aPars ); - iSysPars = aPars; - } +void CImageEditorDrawControl::SetSystemParameters( + const CSystemParameters* aPars) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSystemParameters()"); + ASSERT(aPars); + iSysPars = aPars; + } // --------------------------------------------------------------------------- // HandlePluginCommandL // --------------------------------------------------------------------------- // void CImageEditorDrawControl::HandlePluginCommandL(const TInt aCommand) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::HandlePluginCommandL()"); + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::HandlePluginCommandL()"); - switch (aCommand) - { - case EImageEditorFocusLost: - { - if (iTimer) - { - iTimer->Cancel(); - } - break; - } - case EPgnSoftkeyIdOk: - { - iPopupController->HideInfoPopupNote(); - break; - } - case EPgnSoftkeyIdCancel: - { - iPopupController->HideInfoPopupNote(); - iEditorView->HandleCommandL (EImageEditorCancelPlugin); - break; - } - case EPgnSoftkeyIdDone: - // FALLTROUHG - case EDrawPgnMenuCmdDone: - { - iPopupController->HideInfoPopupNote(); - StoreParameters(EFalse, ETrue); - iEditorView->HandleCommandL( EImageEditorCmdRender );//results Draw call - iEditorView->HandleCommandL(EImageEditorApplyPlugin); - break; - } - case EDrawPgnMenuCmdResize: - { - StoreParameters(ETrue, ETrue); - iEditorView->HandleCommandL( EImageEditorCmdRender );//results Draw call - SelectSizeL(); - break; - } - case EDrawPgnMenuCmdColor: - { - StoreParameters(ETrue, ETrue); - iEditorView->HandleCommandL( EImageEditorCmdRender );//results Draw call - SDrawUtils::LaunchColorSelectionPopupL(iPreview, Rect(), iRgb); - break; - } - case EDrawPgnMenuCmdCancel: - { + switch (aCommand) + { + case EImageEditorFocusLost: + { + if (iTimer) + { + iTimer->Cancel(); + } + break; + } + case EPgnSoftkeyIdOk: + { + iPopupController->HideInfoPopupNote(); + break; + } + case EPgnSoftkeyIdCancel: + { + iPopupController->HideInfoPopupNote(); + iEditorView->HandleCommandL(EImageEditorCancelPlugin); + break; + } + case EPgnSoftkeyIdDone: + // FALLTROUHG + case EDrawPgnMenuCmdDone: + { + iPopupController->HideInfoPopupNote(); + StoreParameters(EFalse, ETrue); + iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call + iEditorView->HandleCommandL(EImageEditorApplyPlugin); + break; + } + case EDrawPgnMenuCmdResize: + { + StoreParameters(ETrue, ETrue); + iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call + SelectSizeL(); + break; + } + case EDrawPgnMenuCmdColor: + { + StoreParameters(ETrue, ETrue); + iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call + SDrawUtils::LaunchColorSelectionPopupL(iPreview, Rect(), iRgb); + break; + } + case EDrawPgnMenuCmdCancel: + { iReadyToRender = EFalse; - iEditorView->HandleCommandL(EImageEditorCancelPlugin); - break; - } - - case EImageEditorGlobalZoomChanged: - // FALLTROUGHT - case EImageEditorGlobalPanChanged: - { - RestorePosAndScaleRelScreen(); - //StoreParameters(); - StoreTempParams(); - iEditorView->HandleCommandL (EImageEditorCmdRender); + iEditorView->HandleCommandL(EImageEditorCancelPlugin); + break; + } - //DrawNow(); - break; - } - - case EImageEditorPreScreenModeChange: - { + case EImageEditorGlobalZoomChanged: + // FALLTROUGHT + case EImageEditorGlobalPanChanged: + { + RestorePosAndScaleRelScreen(); + StoreTempParams(); + iEditorView->HandleCommandL(EImageEditorCmdRender); + break; + } + + case EImageEditorPreScreenModeChange: + { StorePosAndScaleRelImage(); - break; - } - - case EImageEditorPostScreenModeChange: - { + break; + } + + case EImageEditorPostScreenModeChange: + { RestorePosAndScaleRelImage(); ClipPosition(); - //StoreParameters(); - StoreTempParams(); - iEditorView->HandleCommandL (EImageEditorCmdRender); - //DrawNow(); - break; - } - - default: - { - break; - } - } - } + StoreTempParams(); + iEditorView->HandleCommandL(EImageEditorCmdRender); + break; + } + default: + { + break; + } + } + } // --------------------------------------------------------------------------- // GetSoftkeyIndexL // --------------------------------------------------------------------------- // TInt CImageEditorDrawControl::GetSoftkeyIndexL() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetSoftkeyIndexL()"); - // : Check needed states - TInt state(2); - return state; - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetSoftkeyIndexL()"); + // : Check needed states + TInt state(2); + return state; + } // --------------------------------------------------------------------------- // GetContextMenuResourceId // --------------------------------------------------------------------------- // TInt CImageEditorDrawControl::GetContextMenuResourceId() - { - return R_TEXT_CONTEXT_MENUBAR; - } + { + return R_TEXT_CONTEXT_MENUBAR; + } // --------------------------------------------------------------------------- // GetDimmedMenuItems // --------------------------------------------------------------------------- // TBitField CImageEditorDrawControl::GetDimmedMenuItems() -{ - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetDimmedMenuItems()"); + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetDimmedMenuItems()"); - TBitField dimmedMenuItems; - TInt count = iItem->MenuItems().Count(); + TBitField dimmedMenuItems; + TInt count = iItem->MenuItems().Count(); - if ( iDisplayingOkOptionsMenu ) - { - // Dim the command EImageEditorCancelPlugin - for ( TInt i = 0; i < count; i++) - { - // get the menu item id - TInt menuItem = iItem->MenuItems().At(i).iCommandId; - if ( menuItem == EDrawPgnMenuCmdCancel ) - { - dimmedMenuItems.SetBit( i ); - } - } - iDisplayingOkOptionsMenu = EFalse; - } - - for ( TInt i = 0; i < count; i++) - { - // get the menu item id - TInt menuItem = iItem->MenuItems().At(i).iCommandId; - if ( menuItem == EDrawPgnMenuCmdMax ) - { - dimmedMenuItems.SetBit( i ); - } - } - return dimmedMenuItems; -} + if (iDisplayingOkOptionsMenu) + { + // Dim the command EImageEditorCancelPlugin + for (TInt i = 0; i < count; i++) + { + // get the menu item id + TInt menuItem = iItem->MenuItems().At(i).iCommandId; + if (menuItem == EDrawPgnMenuCmdCancel) + { + dimmedMenuItems.SetBit(i); + } + } + iDisplayingOkOptionsMenu = EFalse; + } + + for (TInt i = 0; i < count; i++) + { + // get the menu item id + TInt menuItem = iItem->MenuItems().At(i).iCommandId; + if (menuItem == EDrawPgnMenuCmdMax) + { + dimmedMenuItems.SetBit(i); + } + } + return dimmedMenuItems; + } // --------------------------------------------------------------------------- // GetNaviPaneTextL // --------------------------------------------------------------------------- // TPtrC CImageEditorDrawControl::GetNaviPaneTextL( - TBool& aLeftNaviPaneScrollButtonVisibile, - TBool& aRightNaviPaneScrollButtonVisible ) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetNaviPaneTextL()"); + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetNaviPaneTextL()"); - aLeftNaviPaneScrollButtonVisibile = EFalse; - aRightNaviPaneScrollButtonVisible = EFalse; - return *iNaviPaneText; - } + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + return *iNaviPaneText; + } // --------------------------------------------------------------------------- // Draw // --------------------------------------------------------------------------- // void CImageEditorDrawControl::Draw(const TRect& aRect) const - { - CWindowGc & gc = SystemGc(); - if( IsReadyToRender() ) - { - CPreviewControlBase::DrawPreviewImage(aRect); - } + { + CWindowGc & gc = SystemGc(); + gc.SetBrushColor(KRgbBlack); + gc.Clear(aRect); + + TRect ImageRect(iSysPars->VisibleImageRectPrev()); + CPreviewControlBase::DrawPreviewImage(aRect); + gc.SetClippingRect(TRect(TPoint(ImageRect.iTl.iX, ImageRect.iTl.iY + + iStatuspaneHeight), ImageRect.Size())); - if( iPaths.Count() ) - { - ASSERT( iSysPars ); - for( TInt i(0); i* pathPoints = path->ItemArray(); - gc.SetPenStyle( CGraphicsContext::ESolidPen ); - gc.SetPenColor( path->Color() ); - gc.SetPenSize( ScaledLineSize( path->Size() ) ); - gc.DrawPolyLine( pathPoints ); - } - } - - /* - * : Too slow cause we need to redraw preview image everytime - * if( iIndicator && iIndicator->Handle() && - iIndicatorMask && iIndicatorMask->Handle() ) - { - gc.BitBltMasked ( - ComputeIndicatorPosition(), - iIndicator, - TRect (iIndicator->SizeInPixels()), - iIndicatorMask, - EFalse - ); - }*/ - } + if (iPaths.Count() > 0) + { + // ASSERT( iSysPars ); + TInt count = iPaths.Count(); + for (TInt i(0); i < iPaths.Count(); ++i) + { + CDrawPath* path = iPaths[i]; + CArrayFix* pathPoints = path->ItemArray(); + gc.SetPenStyle(CGraphicsContext::ESolidPen); + gc.SetPenColor(path->Color()); + gc.SetPenSize(ScaledLineSize(path->Size())); + gc.DrawPolyLine(pathPoints); + } + } + } // --------------------------------------------------------------------------- // NaviDown // --------------------------------------------------------------------------- // void CImageEditorDrawControl::NaviDown() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviDown()"); - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviDown()"); + } // --------------------------------------------------------------------------- // NaviUp // --------------------------------------------------------------------------- // void CImageEditorDrawControl::NaviUp() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviUp()"); - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviUp()"); + } // --------------------------------------------------------------------------- // NaviRight // --------------------------------------------------------------------------- // void CImageEditorDrawControl::NaviRight() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviRight()"); - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviRight()"); + } // --------------------------------------------------------------------------- // NaviLeft // --------------------------------------------------------------------------- // void CImageEditorDrawControl::NaviLeft() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviLeft()"); - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviLeft()"); + } // --------------------------------------------------------------------------- // SelectSizeL // --------------------------------------------------------------------------- // void CImageEditorDrawControl::SelectSizeL() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SelectSizeL()"); - // Symmetric line width / height - TInt size(iSize.iWidth); - CSelectionDialog::RunDlgLD( iPreview, Rect(), size ); - iSize = TSize(size,size); - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SelectSizeL()"); + // Symmetric line width / height + TInt size(iSize.iWidth); + CSelectionDialog::RunDlgLD(iPreview, Rect(), size, iRgb, + iSysPars->VisibleImageRectPrev()); + iSize = TSize(size, size); + } // --------------------------------------------------------------------------- // StoreTempParams // --------------------------------------------------------------------------- // void CImageEditorDrawControl::StoreTempParams() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreTempParams()"); - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreTempParams(" + "" + ")"); + } // --------------------------------------------------------------------------- // RestoreTempParams // --------------------------------------------------------------------------- // void CImageEditorDrawControl::RestoreTempParams() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::RestoreTempParams()"); - } + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::RestoreTempParams()"); + } // --------------------------------------------------------------------------- // GetHelpContext // --------------------------------------------------------------------------- // void CImageEditorDrawControl::GetHelpContext(TCoeHelpContext& aContext) const -{ - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetHelpContext()"); + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetHelpContext()"); - aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); - aContext.iContext = KSIE_HLP_EDIT_TEXT; -} + aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); + aContext.iContext = KSIE_HLP_EDIT_TEXT; + } // --------------------------------------------------------------------------- // PrepareL // --------------------------------------------------------------------------- // void CImageEditorDrawControl::PrepareL() - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::PrepareL()"); - + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::PrepareL()"); + // Get current view port TRect rect = iSysPars->VisibleImageRectPrev(); - - // Set default position - iX = (rect.iTl.iX + rect.iBr.iX) / 2; - iY = (rect.iTl.iY + rect.iBr.iY) / 2; - - // Set default color to white - iRgb = KRgbWhite; + + iReadyToRender = ETrue; - // Set default size - TInt defaultSize(8); - iSize = TSize(defaultSize, defaultSize); - iReadyToRender = ETrue; - - iEditorView->HandleCommandL( EImageEditorCmdRender ); - } + iEditorView->HandleCommandL(EImageEditorCmdRender); + } // --------------------------------------------------------------------------- // LoadIndicatorL // --------------------------------------------------------------------------- // -void CImageEditorDrawControl::LoadIndicatorL( - TInt aBitmapInd, TInt aMaskInd ) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::LoadIndicatorL()"); +void CImageEditorDrawControl::LoadIndicatorL(TInt aBitmapInd, TInt aMaskInd) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::LoadIndicatorL()"); - // Delete old indicator - delete iIndicator; - iIndicator = 0; - delete iIndicatorMask; - iIndicatorMask = 0; + // Delete old indicator + delete iIndicator; + iIndicator = 0; + delete iIndicatorMask; + iIndicatorMask = 0; - // Load new indicator - SDrawUtils::GetIndicatorBitmapL ( - iIndicator, - iIndicatorMask, - aBitmapInd, - aMaskInd - ); - } + // Load new indicator + SDrawUtils::GetIndicatorBitmapL(iIndicator, iIndicatorMask, aBitmapInd, + aMaskInd); + } // --------------------------------------------------------------------------- // ComputeIndicatorPosition @@ -678,24 +857,22 @@ { TRect vprect = iSysPars->VisibleImageRect(); TRect vpprect = iSysPars->VisibleImageRectPrev(); - - TInt x( 0 ); - TInt y( 0 ); + + TInt x(0); + TInt y(0); // check if there is no indicator - if ( !iIndicator ) - { - return TPoint ( x, y ); - } - + if (!iIndicator) + { + return TPoint(x, y); + } + y = ((iY - vprect.iTl.iY) * vpprect.Height()) / vprect.Height(); y += vpprect.iTl.iY; - //y -= iIndicator->SizeInPixels().iHeight; /// 4; - x = ((iX - vprect.iTl.iX) * vpprect.Width()) / vprect.Width(); + x = ((iX - vprect.iTl.iX) * vpprect.Width()) / vprect.Width(); x += vpprect.iTl.iX; - //x -= iIndicator->SizeInPixels().iWidth / 2; - return TPoint (x,y); + return TPoint(x, y); } // --------------------------------------------------------------------------- @@ -703,363 +880,839 @@ // --------------------------------------------------------------------------- // TBool CImageEditorDrawControl::IsReadyToRender() const - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::IsReadyToRender()"); + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::IsReadyToRender()"); return iReadyToRender; - } + } // --------------------------------------------------------------------------- // StoreParameters // --------------------------------------------------------------------------- // void CImageEditorDrawControl::StoreParameters(TBool aLastItem, TBool aDone) - { - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreParameters()"); - RDebug::Print(_L("CImageEditorDrawControl::StoreParameters color[%d]"), - iRgb.Internal()); + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreParameters()"); + RDebug::Print(_L("CImageEditorDrawControl::StoreParameters color[%d]"), + iRgb.Internal()); iParam.Copy(_L("x ")); - iParam.AppendNum (iX); + iParam.AppendNum(iX); iParam.Append(_L(" y ")); - iParam.AppendNum (iY); - - if( aLastItem ) - { - iParam.Append(_L(" size ")); - iParam.AppendNum (iSize.iHeight); - iParam.Append(_L(" color ")); - iParam.AppendNum ( iRgb.Value() ); + iParam.AppendNum(iY); + if (aLastItem) + { + iParam.Append(_L(" size ")); + iParam.AppendNum(iSize.iHeight); + iParam.Append(_L(" color ")); + iParam.AppendNum(iRgb.Value()); iParam.Append(_L(" lastItem ")); - } - if( aDone ) - { - iParam.Append(_L("done")); - } - } + } + + if (aDone) + { + iParam.Zero(); + iParam.Append(_L("done")); + } + if (iUndo) + { + iParam.Zero(); + iParam.Append(_L("Undo")); + } + if (iRedo) + { + iParam.Zero(); + iParam.Append(_L("redone")); + } + } // --------------------------------------------------------------------------- // TimerCallBack // --------------------------------------------------------------------------- // void CImageEditorDrawControl::TimerCallBack() -{ - LOG(KDrawPluginLogFile, "CImageEditorDrawControl::TimerCallBack()"); + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::TimerCallBack()"); - if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) - { - iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; - } - else - { - iTickCount++; - } + if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) + { + iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; + } + else + { + iTickCount++; + } if (iKeyCode) - { + { switch (iKeyCode) - { + { case 1: - { - NaviUp(); + { + NaviUp(); + break; + } + case 2: + { + NaviDown(); + break; + } + case 3: + { + NaviLeft(); + break; + } + case 4: + { + NaviRight(); + break; + } + default: break; } - case 2: - { - NaviDown(); - break; - } - case 3: - { - NaviLeft(); - break; - } - case 4: - { - NaviRight(); - break; - } - default: - break; + //StoreParameters(); + TRAP_IGNORE(iEditorView->HandleCommandL(EImageEditorCmdRender)); + iTimer->Call(KWait); } - //StoreParameters(); - TRAP_IGNORE( iEditorView->HandleCommandL(EImageEditorCmdRender) ); - iTimer->Call (KWait); } -} // --------------------------------------------------------------------------- // StorePosAndScaleRelScreen // --------------------------------------------------------------------------- // void CImageEditorDrawControl::StorePosAndScaleRelScreen() - { - LOG(KDrawPluginLogFile, - "CImageEditorClipartControl::StorePosAndScaleRelScreen()"); - iParam.Copy(_L("nop")); - } + { + LOG(KDrawPluginLogFile, + "CImageEditorClipartControl::StorePosAndScaleRelScreen()"); + iParam.Copy(_L("nop")); + } // --------------------------------------------------------------------------- // ?description_if_needed // --------------------------------------------------------------------------- // void CImageEditorDrawControl::RestorePosAndScaleRelScreen() - { - LOG(KDrawPluginLogFile, - "CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); - } - + { + LOG(KDrawPluginLogFile, + "CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); + } // --------------------------------------------------------------------------- // StorePosAndScaleRelImage // --------------------------------------------------------------------------- // void CImageEditorDrawControl::StorePosAndScaleRelImage() - { - TReal relscale = iSysPars->RelScale(); - LOGFMT(KDrawPluginLogFile, - "CImageEditorClipartControl::StorePosAndScaleRelImage():%g", - relscale); - } + { + TReal relscale = iSysPars->RelScale(); + LOGFMT(KDrawPluginLogFile, + "CImageEditorClipartControl::StorePosAndScaleRelImage():%g", + relscale); + } // --------------------------------------------------------------------------- // RestorePosAndScaleRelImage // --------------------------------------------------------------------------- // void CImageEditorDrawControl::RestorePosAndScaleRelImage() - { - TReal relscale = iSysPars->RelScale(); - LOGFMT(KDrawPluginLogFile, - "CImageEditorClipartControl::RestorePosAndScaleRelImage():%g", - relscale); - } + { + TReal relscale = iSysPars->RelScale(); + LOGFMT(KDrawPluginLogFile, + "CImageEditorClipartControl::RestorePosAndScaleRelImage():%g", + relscale); + } // --------------------------------------------------------------------------- // ClipPosition // --------------------------------------------------------------------------- // void CImageEditorDrawControl::ClipPosition() -{ - if ( iX < iSysPars->VisibleImageRect().iTl.iX ) - { - iX = iSysPars->VisibleImageRect().iTl.iX; - } - else if ( iX > iSysPars->VisibleImageRect().iBr.iX ) - { - iX = iSysPars->VisibleImageRect().iBr.iX; - } - - if ( iY < iSysPars->VisibleImageRect().iTl.iY ) - { - iY = iSysPars->VisibleImageRect().iTl.iY; - } - else if ( iY > iSysPars->VisibleImageRect().iBr.iY ) - { - iY = iSysPars->VisibleImageRect().iBr.iY; - } -} + { + if (iX < iSysPars->VisibleImageRect().iTl.iX) + { + iX = iSysPars->VisibleImageRect().iTl.iX; + } + else if (iX > iSysPars->VisibleImageRect().iBr.iX) + { + iX = iSysPars->VisibleImageRect().iBr.iX; + } + + if (iY < iSysPars->VisibleImageRect().iTl.iY) + { + iY = iSysPars->VisibleImageRect().iTl.iY; + } + else if (iY > iSysPars->VisibleImageRect().iBr.iY) + { + iY = iSysPars->VisibleImageRect().iBr.iY; + } + } // --------------------------------------------------------------------------- // HandlePointerEventL // --------------------------------------------------------------------------- // void CImageEditorDrawControl::HandlePointerEventL( - const TPointerEvent &aPointerEvent) - { - RDebug::Print(_L("CImageEditorDrawControl::HandlePointerEventL pen[%d]"), - AknLayoutUtils::PenEnabled()); - if( AknLayoutUtils::PenEnabled() && !Busy()) + const TPointerEvent &aPointerEvent) + { + SetToolBarStatus(); + RDebug::Print(_L("CImageEditorDrawControl::HandlePointerEventL pen[%d]"), + AknLayoutUtils::PenEnabled()); + if (iRollflag) + return; + if (AknLayoutUtils::PenEnabled() && !Busy()) { - RDebug::Print(_L("CImageEditorDrawControl::iType [%d]"), - aPointerEvent.iType); - TBool lastItem( EFalse ); - switch( aPointerEvent.iType ) + RDebug::Print(_L("CImageEditorDrawControl::iType [%d]"), + aPointerEvent.iType); + TBool lastItem(EFalse); + TPoint point = aPointerEvent.iPosition; + + switch (aPointerEvent.iType) { case TPointerEvent::EButton1Down: { - iReadyToRender = EFalse; + + iButtonDownPoint = point; + iLastPointEventType = EFalse; + CCoeControl::HandlePointerEventL(aPointerEvent); + + if (iLoopMenuRect.Contains(point) && !iCustomComponetClick + && iDisplayTool) + + { + iPointStartInLoopRect = ETrue; + if (iDragIsStart) + { + iAnimationAO->Cancel(); + iDragIsStart = EFalse; + } - CDrawPath* lastPath = CDrawPath::NewL(); - CleanupStack::PushL( lastPath ); - lastPath->SetColor( iRgb ); - lastPath->SetSize( iSize ); - SetPositionOnImage( aPointerEvent.iPosition ); - lastPath->AddItemL( aPointerEvent.iPosition ); - iPaths.AppendL( lastPath ); - CleanupStack::Pop( lastPath ); - break; + } + else if ((!iLoopMenuRect.Contains(point) + && !iCustomComponetClick && iDisplayTool) + || (!iDisplayTool && !iCustomComponetClick)) + { + iPointStartInLoopRect = EFalse; + //System dispose + iReadyToRender = EFalse; + CDrawPath* lastPath = CDrawPath::NewL(); + CleanupStack::PushL(lastPath); + lastPath->SetColor(iRgb); + lastPath->SetSize(iSize); + SetPositionOnImage(aPointerEvent.iPosition); + lastPath->AddItemL(aPointerEvent.iPosition); + iPaths.AppendL(lastPath); + CleanupStack::Pop(lastPath); + iCanRedo = EFalse; + iUndoPaths.ResetAndDestroy(); + } } - case TPointerEvent::EDrag: - { - if( iPaths.Count() ) - { - CDrawPath* path = iPaths[iPaths.Count()-1]; - // store current position for next round - iPointerPosition = aPointerEvent.iPosition; - SetPositionOnImage( aPointerEvent.iPosition ); - path->AddItemL( aPointerEvent.iPosition ); - } - break; - } + break; case TPointerEvent::EButton1Up: { + // System dispose iReadyToRender = ETrue; - ShowTooltip(); + iCustomComponetClick = EFalse; lastItem = ETrue; + HandleMainMenuButtonUp(point); + CCoeControl::HandlePointerEventL(aPointerEvent); + DrawNow(); + + } + break; + case TPointerEvent::EDrag: + { + CCoeControl::HandlePointerEventL(aPointerEvent); + //System dispose + iLastPointEventType = ETrue; + + if ((iDisplayTool && iPaths.Count() && !iCustomComponetClick + && !iPointStartInLoopRect) || (!iDisplayTool + && iPaths.Count() && !iCustomComponetClick)) + { + iCanRedo = EFalse; + iUndoPaths.ResetAndDestroy(); + CDrawPath* path = iPaths[iPaths.Count() - 1]; + // store current position for next round + iPointerPosition = aPointerEvent.iPosition; + SetPositionOnImage(aPointerEvent.iPosition); + path->AddItemL(aPointerEvent.iPosition); + } + //Self dispose + if (iCustomComponetClick) + { + TPoint con(aPointerEvent.iPosition.iX - 25, + aPointerEvent.iPosition.iY - 25); + iCustomComponet->SetExtent(con, TSize(50, 50)); + DrawNow(); + } + + if (iDisplayTool && iPointStartInLoopRect) + + { + HandleMainMenuButtonDrag(point); + } + } + break; + default: + break; + + } + + //System dispose + if ((!iPointStartInLoopRect && iDisplayTool) || !iDisplayTool) + { + if (!(iCustomComponet->Rect().Contains(aPointerEvent.iPosition))) + { + StoreParameters(lastItem, EFalse); + iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call } - - default: + } + } + + } + +// --------------------------------------------------------------------------- +// HandleMainMenuButtonUp +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::HandleMainMenuButtonUp(TPoint aPoint) + { + if (iMainMenuLayout == EMainMenuHorizontal) + { + if (iDragIsStart) + { + //Drag event is end (Except activating animation effect). + iDragIsStart = EFalse; + + if (Abs(iDragPrePoint.iX - aPoint.iX) > 1) + { + //Animation effect is activated + iDragIsStart = ETrue; + iStartSpeed = aPoint.iX - iDragPrePoint.iX; + iAnimationAO->StartL(0); + } + } + } + else if (iMainMenuLayout == EMainMenuVertical) + { + if (iDragIsStart) + { + //Drag event is end (Except activating animation effect). + iDragIsStart = EFalse; + + if (Abs(iDragPrePoint.iY - aPoint.iY) > 1) + { + //Animation effect is activated + iDragIsStart = ETrue; + iStartSpeed = aPoint.iY - iDragPrePoint.iY; + iAnimationAO->StartL(0); + } + } + } + } + +// --------------------------------------------------------------------------- +// HandleMainMenuButtonDrag +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::HandleMainMenuButtonDrag(TPoint aPoint) + { + if (iMainMenuLayout == EMainMenuHorizontal) + { + if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iX + - iButtonDownPoint.iX) >= DRAG_LENGTH) + { + iDragIsStart = ETrue; + iDragStartPoint = aPoint; + + for (TInt i = 0; i < iTotalComponent; i++) { - break; - } + if (iLabels[i]->Rect().Contains(iButtonDownPoint)) + { + iLabels[i]->LabelIsMoving(); + } + } + } + + if (iDragIsStart) + { + iDragPrePoint = iDragUpPoint; + iDragUpPoint = aPoint; + iDragOffset = aPoint.iX - iDragStartPoint.iX; + iDragStartPoint = aPoint; + + CalculateEffectiveOffset(); + SizeChanged(); } + } + else if (iMainMenuLayout == EMainMenuVertical) + { + if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iY + - iButtonDownPoint.iY) >= DRAG_LENGTH) + { + iDragIsStart = ETrue; + iDragStartPoint = aPoint; + + for (TInt i = 0; i < iTotalComponent; i++) + { + if (iLabels[i]->Rect().Contains(iButtonDownPoint)) + { + iLabels[i]->LabelIsMoving(); + } + } + } + + if (iDragIsStart) + { + iDragPrePoint = iDragUpPoint; + iDragUpPoint = aPoint; + iDragOffset = aPoint.iY - iDragStartPoint.iY; + iDragStartPoint = aPoint; - StoreParameters( lastItem, EFalse ); - iEditorView->HandleCommandL( EImageEditorCmdRender );//results Draw call - CCoeControl::HandlePointerEventL( aPointerEvent ); + CalculateEffectiveOffset(); + SizeChanged(); + } + } + } + +// --------------------------------------------------------------------------- +// UndoDrawPath +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::UndoDrawPath() + { + if (iPaths.Count()) + { + iUndoPaths.Append(iPaths[iPaths.Count() - 1]); + iPaths.Remove(iPaths.Count() - 1); + iCanRedo = ETrue; + } + } + +// --------------------------------------------------------------------------- +// RedoDrawPath +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::RedoDrawPath() + { + if (iUndoPaths.Count()) + { + iPaths.Append(iUndoPaths[iUndoPaths.Count() - 1]); + iUndoPaths.Remove(iUndoPaths.Count() - 1); + } + } + +// --------------------------------------------------------------------------- +// HandlePointerNotify +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::HandlePointerNotify(CCoeControl* aComponent) + { + //pen size + if (iLabels[0] == dynamic_cast (aComponent)) + { + MakeVisibleLable(EFalse); + SelectSizeL(); + MakeVisibleLable(ETrue); } - } + //pen color + else if (iLabels[1] == dynamic_cast (aComponent)) + { + MakeVisibleLable(EFalse); + SDrawUtils::LaunchColorSelectionPopupL(iPreview, Rect(), iRgb); + MakeVisibleLable(ETrue); + } + //undo + else if (iLabels[2] == dynamic_cast (aComponent)) + { + UndoDrawPath(); + iUndo = ETrue; + StoreParameters(EFalse, EFalse); + iEditorView->HandleCommandL(EImageEditorCmdRender); + iUndo = EFalse; + } + //save and quit + else if (iLabels[3] == dynamic_cast (aComponent)) + { + iPopupController->HideInfoPopupNote(); + StoreParameters(EFalse, ETrue); + iEditorView->HandleCommandL(EImageEditorApplyPlugin); + } + else if (iLabels[4] == dynamic_cast (aComponent)) + { + + } + else if (iLabels[5] == dynamic_cast (aComponent)) + { + iRedo = ETrue; + RedoDrawPath(); + StoreParameters(EFalse, EFalse); + iEditorView->HandleCommandL(EImageEditorCmdRender); + iRedo = EFalse; + } + else if (iLabels[6] == dynamic_cast (aComponent)) + { + + } + else if (iCustomComponet == dynamic_cast (aComponent)) + { + if (iCustomComponet->GetButtonType()) + { + iCustomComponetClick = ETrue; + } + + if ((!iCustomComponet->GetButtonType()) && (!iLastPointEventType)) + { + StartTheAnimation(); + + } + } + + } // --------------------------------------------------------------------------- // SetPositionOnImage // --------------------------------------------------------------------------- // -void CImageEditorDrawControl::SetPositionOnImage( TPoint aPointedPosition ) - { - ASSERT( iSysPars ); - // Get system parameters - TRect visibleImageRect( iSysPars->VisibleImageRect() ); - TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); +void CImageEditorDrawControl::SetPositionOnImage(TPoint aPointedPosition) + { + ASSERT(iSysPars); + // Get system parameters + TRect visibleImageRect(iSysPars->VisibleImageRect()); + TRect visibleImageRectPrev(iSysPars->VisibleImageRectPrev()); + + TInt xPosFactorDivider(visibleImageRectPrev.Width()); + TInt yPosFactorDivider(visibleImageRectPrev.Height()); + + LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::vir w:%d h:%d", + visibleImageRect.Width(), visibleImageRect.Height()); + LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::virp w:%d h:%d", + visibleImageRectPrev.Width(), visibleImageRectPrev.Height()); - TInt xPosFactorDivider( visibleImageRectPrev.Width() ); - TInt yPosFactorDivider( visibleImageRectPrev.Height() ); - - LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::vir w:%d h:%d", - visibleImageRect.Width(), visibleImageRect.Height()); - LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::virp w:%d h:%d", - visibleImageRectPrev.Width(), visibleImageRectPrev.Height()); - - // Dividing by zero will cause panic -> check - if ( xPosFactorDivider == 0 || yPosFactorDivider == 0 ) - { - // Set default position - iX = (visibleImageRect.iTl.iX + visibleImageRect.iBr.iX) / 2; - iY = (visibleImageRect.iTl.iY + visibleImageRect.iBr.iY) / 2; - } - else - { - // Calculate relative position on the screen - TReal xPositionFactor - ( TReal( aPointedPosition.iX - visibleImageRectPrev.iTl.iX ) / - xPosFactorDivider ); - - TReal yPositionFactor - ( TReal( aPointedPosition.iY - visibleImageRectPrev.iTl.iY ) / - yPosFactorDivider ); - LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::pfx:%g pfy:%g", - xPositionFactor, yPositionFactor); + // Dividing by zero will cause panic -> check + if (xPosFactorDivider == 0 || yPosFactorDivider == 0) + { + // Set default position + iX = (visibleImageRect.iTl.iX + visibleImageRect.iBr.iX) / 2; + iY = (visibleImageRect.iTl.iY + visibleImageRect.iBr.iY) / 2; + } + else + { + // Calculate relative position on the screen + TReal xPositionFactor(TReal(aPointedPosition.iX + - visibleImageRectPrev.iTl.iX) / xPosFactorDivider); + // + // TReal yPositionFactor(TReal(aPointedPosition.iY - iStatuspaneHeight + // - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); + TReal yPositionFactor(TReal(aPointedPosition.iY + - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); + LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::pfx:%g pfy:%g", + xPositionFactor, yPositionFactor); // Calculate position on visible image - iX = visibleImageRect.iTl.iX + - visibleImageRect.Width() * xPositionFactor + 0.5; - - iY = visibleImageRect.iTl.iY + - visibleImageRect.Height() * yPositionFactor + 0.5; - } + iX = visibleImageRect.iTl.iX + visibleImageRect.Width() + * xPositionFactor + 0.5; + + iY = visibleImageRect.iTl.iY + visibleImageRect.Height() + * yPositionFactor + 0.5; + } - LOGFMT4(KDrawPluginLogFile, "CImageEditorDrawControl::Draw x:%d iX:%d y:%d iY:%d", - aPointedPosition.iX, iX, aPointedPosition.iY, iY); + LOGFMT4(KDrawPluginLogFile, + "CImageEditorDrawControl::Draw x:%d iX:%d y:%d iY:%d", + aPointedPosition.iX, iX, aPointedPosition.iY, iY); // Check that not out of bounds - //ClipPosition(); - } - + //ClipPosition(); + } + // --------------------------------------------------------------------------- // GetPositionOnView // --------------------------------------------------------------------------- // TPoint CImageEditorDrawControl::GetPositionOnView() - { - ASSERT( iSysPars ); - // Get system parameters - TRect visibleImageRect( iSysPars->VisibleImageRect() ); - TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + { + ASSERT(iSysPars); + // Get system parameters + TRect visibleImageRect(iSysPars->VisibleImageRect()); + TRect visibleImageRectPrev(iSysPars->VisibleImageRectPrev()); - TInt xPosFactorDivider( visibleImageRectPrev.Width() ); - TInt yPosFactorDivider( visibleImageRectPrev.Height() ); - - // Calculate relative position on the screen - TReal xPositionFactor( TReal( iX + visibleImageRectPrev.iTl.iX ) / - xPosFactorDivider ); - - TReal yPositionFactor( TReal( iY + visibleImageRectPrev.iTl.iY ) / - yPosFactorDivider ); + TInt xPosFactorDivider(visibleImageRectPrev.Width()); + TInt yPosFactorDivider(visibleImageRectPrev.Height()); + + // Calculate relative position on the screen + TReal xPositionFactor(TReal(iX + visibleImageRectPrev.iTl.iX) + / xPosFactorDivider); + + TReal yPositionFactor(TReal(iY + visibleImageRectPrev.iTl.iY) + / yPosFactorDivider); - LOGFMT2(KDrawPluginLogFile, - "CImageEditorDrawControl::GetPositionOnView xf:%g yf:%g", - xPositionFactor , yPositionFactor ); - - LOGFMT2(KDrawPluginLogFile, - "CImageEditorDrawControl::GetPositionOnView xf:%d yf:%d", - xPosFactorDivider , yPosFactorDivider ); - - LOGFMT2(KDrawPluginLogFile, - "CImageEditorDrawControl::GetPositionOnView w:%d h:%d", - iX , iY ); - - TInt xPosition(iX + visibleImageRectPrev.iTl.iX); - TInt yPosition(iY + visibleImageRectPrev.iTl.iY); - - LOGFMT3(KDrawPluginLogFile, - "CImageEditorDrawControl::GetPositionOnView w:%d h:%d S:%g", - xPosition, yPosition, iSysPars->RelScale()); - - return TPoint(xPosition, yPosition); - } + LOGFMT2(KDrawPluginLogFile, + "CImageEditorDrawControl::GetPositionOnView xf:%g yf:%g", + xPositionFactor, yPositionFactor); + + LOGFMT2(KDrawPluginLogFile, + "CImageEditorDrawControl::GetPositionOnView xf:%d yf:%d", + xPosFactorDivider, yPosFactorDivider); + + LOGFMT2(KDrawPluginLogFile, + "CImageEditorDrawControl::GetPositionOnView w:%d h:%d", iX, iY); + + TInt xPosition(iX + visibleImageRectPrev.iTl.iX); + TInt yPosition(iY + visibleImageRectPrev.iTl.iY); + + LOGFMT3(KDrawPluginLogFile, + "CImageEditorDrawControl::GetPositionOnView w:%d h:%d S:%g", + xPosition, yPosition, iSysPars->RelScale()); + + return TPoint(xPosition, yPosition); + } // --------------------------------------------------------------------------- // ShowTooltip // --------------------------------------------------------------------------- // void CImageEditorDrawControl::ShowTooltip() - { - iPopupController->HideInfoPopupNote(); + { + iPopupController->HideInfoPopupNote(); - TPoint iconPosition = ComputeIndicatorPosition(); - TRect iconRect( iconPosition.iX, iconPosition.iY, - iconPosition.iX, iconPosition.iY ); + TPoint iconPosition = ComputeIndicatorPosition(); + TRect iconRect(iconPosition.iX, iconPosition.iY, iconPosition.iX, + iconPosition.iY); - - /*SDrawUtils::ShowToolTip( iPopupController, - this, - iconPosition, - EHRightVTop, - *iTooltipResize ); - */ - - } + /*SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVTop, + *iTooltipResize ); + */ + + } // --------------------------------------------------------------------------- // ScaledLineSize // --------------------------------------------------------------------------- // -TSize CImageEditorDrawControl::ScaledLineSize( TSize aOriginalSize ) const - { - TInt sizew(aOriginalSize.iWidth * iSysPars->RelScale() + 0.5); - TInt sizeh(aOriginalSize.iHeight * iSysPars->RelScale() + 0.5); - if( sizew < 1 ) - { - sizew++; - } - if( sizeh < 1 ) - { - sizeh++; - } +TSize CImageEditorDrawControl::ScaledLineSize(TSize aOriginalSize) const + { + TInt sizew(aOriginalSize.iWidth * iSysPars->RelScale() + 0.5); + TInt sizeh(aOriginalSize.iHeight * iSysPars->RelScale() + 0.5); + if (sizew < 1) + { + sizew++; + } + if (sizeh < 1) + { + sizeh++; + } + + LOGFMT3(KDrawPluginLogFile, + "CImageEditorDrawControl::ScaledLineSize w:%d h:%d S:%g", sizew, + sizeh, iSysPars->RelScale()); + return TSize(sizew, sizeh); + } + +// --------------------------------------------------------------------------- +// CountComponentControls +// --------------------------------------------------------------------------- +// +TInt CImageEditorDrawControl::CountComponentControls() const + { + return iTotalComponent + 1; + } + +// --------------------------------------------------------------------------- +// ComponentControl +// --------------------------------------------------------------------------- +// +CCoeControl* CImageEditorDrawControl::ComponentControl(TInt aIndex) const + { + switch (aIndex) + { + case 7: + return iCustomComponet; + case 0: + return iLabels[0]; + case 1: + return iLabels[1]; + case 2: + return iLabels[2]; + case 3: + return iLabels[3]; + case 4: + return iLabels[4]; + case 5: + return iLabels[5]; + case 6: + return iLabels[6]; + default: + return NULL; + } + return NULL; + } + +// --------------------------------------------------------------------------- +// Notify +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::Notify() + { + if (iStartSpeed > 0) + { + iStartSpeed -= 2; + if (iStartSpeed <= 0) + { + iStartSpeed = 0; + iDragIsStart = EFalse; + iAnimationAO->Cancel(); + } + } + else if (iStartSpeed < 0) + { + iStartSpeed += 2; + if (iStartSpeed >= 0) + { + iStartSpeed = 0; + iDragIsStart = EFalse; + iAnimationAO->Cancel(); + } + } + else + { + iDragIsStart = EFalse; + iAnimationAO->Cancel(); + } + + iDragOffset += iStartSpeed; + CalculateEffectiveOffset(); + SizeChanged(); + } + +// --------------------------------------------------------------------------- +// Roll +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::Roll() + { + SetToolBarStatus(); + //TInt leftX = iLabels[0]->Rect().iTl.iX; + //TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; + TInt offset = 0; + iRollflag = ETrue; + if (iDisplayTool) + iRollDirection = EFalse; + else + iRollDirection = ETrue; + - LOGFMT3(KDrawPluginLogFile, - "CImageEditorDrawControl::ScaledLineSize w:%d h:%d S:%g", - sizew, sizeh, iSysPars->RelScale()); - return TSize(sizew , sizeh); - } - + if (iRollDirection) + { + offset = 4; + } + else + { + offset = -4; + } + + if (iMainMenuLayout == EMainMenuHorizontal) + { + for (TInt i = 0; i < iLabels.Count(); i++) + { + TInt x = iLabels[i]->Rect().iTl.iX; + iLabels[i]->SetPosition(TPoint(x + offset, iLoopMenuRect.iTl.iY)); + iLabels[i]->ResetControl(); + } + if (iLabels[0]->Rect().iTl.iX == 0 + || iLabels[iLabels.Count() - 1]->Rect().iBr.iX == 0) + iRollflag = EFalse; + } + else if (iMainMenuLayout == EMainMenuVertical) + { + for (TInt i = 0; i < iLabels.Count(); i++) + { + TInt y = iLabels[i]->Rect().iTl.iY; + iLabels[i]->SetPosition(TPoint(iLoopMenuRect.iTl.iX, y + offset)); + iLabels[i]->ResetControl(); + } + if (iLabels[0]->Rect().iTl.iY == 0 + || iLabels[iLabels.Count() - 1]->Rect().iBr.iY == 0) + iRollflag = EFalse; + } + + DrawNow(); + + if (!iRollflag) + { + //iRollDirection = !iRollDirection; + iRollAo->Cancel(); + } + } + +// --------------------------------------------------------------------------- +// CalculateEffectiveOffset +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::CalculateEffectiveOffset() + { + if (iMainMenuLayout == EMainMenuHorizontal) + { + TInt leftX = iLabels[0]->Rect().iTl.iX; + TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; + TInt offset = iDragOffset; + if (leftX + offset > 0) + { + iDragOffset = Abs(leftX); + } + + if (rightX + offset < 360) + { + iDragOffset = -(rightX - 360); + } + } + else if (iMainMenuLayout == EMainMenuVertical) + { + TInt topY = iLabels[0]->Rect().iTl.iY; + TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; + TInt offset = iDragOffset; + if (topY + offset > 0) + { + iDragOffset = Abs(topY); + } + + if (bottomY + offset < 360) + { + iDragOffset = -(bottomY - 360); + } + } + } + +// --------------------------------------------------------------------------- +// MakeVisibleLable +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::MakeVisibleLable(TBool aFlag) + { + if (aFlag) + { + for (int i = 0; i < iTotalComponent; i++) + { + iLabels[i]->MakeVisible(ETrue); + } + } + else + { + for (int i = 0; i < iTotalComponent; i++) + { + iLabels[i]->MakeVisible(EFalse); + } + } + } + +// --------------------------------------------------------------------------- +// StartTheAnimation +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::StartTheAnimation() + { + iRollAo->StartL(0); + } + // End of File diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/imageeditordrawplugin.cpp --- a/imageeditor/plugins/DrawPlugin/src/imageeditordrawplugin.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/src/imageeditordrawplugin.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -1,39 +1,35 @@ /* -* Copyright (c) 2010 Ixonos Plc. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* Ixonos Plc -* -* Description: -* Freehand draw UI plugin that sends UI commands to -* corresponding filter plugin. (filterdraw.dll). -* -*/ - - + * Copyright (c) 2010 Ixonos Plc. + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - Initial contribution + * + * Contributors: + * Ixonos Plc + * + * Description: + * Freehand draw UI plugin that sends UI commands to + * corresponding filter plugin. (filterdraw.dll). + * + */ #include "ImageEditordrawPlugin.h" #include "ImageEditordrawControl.h" #include "ImageEditorPluginBaseDefs.h" #include "DrawUtils.h" #include "SystemParameters.h" - +#include "drawpath.h" #ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY #include #endif #include - // CONSTANTS _LIT (KPgnResourceFile, "draw.rsc"); - // --------------------------------------------------------------------------- // CreateImageEditorPlugin // --------------------------------------------------------------------------- @@ -44,15 +40,17 @@ CleanupStack::PushL(plugin); plugin->ConstructL(); CleanupStack::Pop(); // plugin - return plugin; + return plugin; } // --------------------------------------------------------------------------- // CImageEditorDrawPlugin // --------------------------------------------------------------------------- // -CImageEditorDrawPlugin::CImageEditorDrawPlugin() : iLandscapeEnabled(EFalse) - {} +CImageEditorDrawPlugin::CImageEditorDrawPlugin() : + iLandscapeEnabled(EFalse) + { + } // --------------------------------------------------------------------------- // ConstructL @@ -60,7 +58,9 @@ // inline void CImageEditorDrawPlugin::ConstructL() { - CImageEditorPluginBase::ConstructL(KPgnResourcePath, KPgnResourceFile); + CImageEditorPluginBase::ConstructL(KPgnResourcePath, KPgnResourceFile); + iRgb = KRgbWhite; + iSize = TSize(8, 8); } // --------------------------------------------------------------------------- @@ -69,62 +69,62 @@ // CImageEditorDrawPlugin::~CImageEditorDrawPlugin() { - ReleasePlugin(); - iSysPars = NULL; + ReleasePlugin(); + iSysPars = NULL; + iPaths.ResetAndDestroy(); } // --------------------------------------------------------------------------- // SetProperty // --------------------------------------------------------------------------- // -TInt CImageEditorDrawPlugin::SetProperty( - TInt aPropertyId, TDesC& aPropertyValue) +TInt CImageEditorDrawPlugin::SetProperty(TInt aPropertyId, + TDesC& aPropertyValue) { - TInt err(KErrNone); - TLex parser; + TInt err(KErrNone); + TLex parser; // Copy data - switch (aPropertyId) + switch (aPropertyId) { case KCapSystemParameters: { - parser.Assign (aPropertyValue); - TInt tempval = 0; - parser.Val (tempval); - iSysPars = (const CSystemParameters *)tempval; + parser.Assign(aPropertyValue); + TInt tempval = 0; + parser.Val(tempval); + iSysPars = (const CSystemParameters *) tempval; err = KErrNone; - break; + break; } default: { - err = CImageEditorPluginBase::SetProperty( - aPropertyId, aPropertyValue); - break; + err = CImageEditorPluginBase::SetProperty(aPropertyId, + aPropertyValue); + break; } } - return err; + return err; } // --------------------------------------------------------------------------- // GetProperty // --------------------------------------------------------------------------- // -TInt CImageEditorDrawPlugin::GetProperty( - TInt aPropertyId, TDes& aPropertyValue) +TInt CImageEditorDrawPlugin::GetProperty(TInt aPropertyId, TDes& aPropertyValue) { // Clean buffer aPropertyValue.Zero(); // Copy data - switch (aPropertyId) + switch (aPropertyId) { case KCapParamStruct: { // Control found if (iControl) { - aPropertyValue.Copy( - ((CImageEditorDrawControl *)iControl)->GetParam() ); + aPropertyValue.Copy( + ((CImageEditorDrawControl *) iControl)->GetParam()); return KErrNone; } @@ -134,31 +134,31 @@ return KErrNotReady; } } - case KCapReadyToRender: + case KCapReadyToRender: { - TBool readytorender = ETrue; - if (iControl) - { - readytorender = - ((CImageEditorDrawControl *)iControl)->IsReadyToRender(); - } - aPropertyValue.AppendNum ((TInt)readytorender); + TBool readytorender = ETrue; + if (iControl) + { + readytorender + = ((CImageEditorDrawControl *) iControl)->IsReadyToRender(); + } + aPropertyValue.AppendNum((TInt) readytorender); return KErrNone; } - case KCapIsLandscapeEnabled: + case KCapIsLandscapeEnabled: { - aPropertyValue.AppendNum ((TInt)iLandscapeEnabled); + aPropertyValue.AppendNum((TInt) iLandscapeEnabled); return KErrNone; } - case KCapIsSlowPlugin: + case KCapIsSlowPlugin: { - aPropertyValue.AppendNum ((TInt)ETrue); + aPropertyValue.AppendNum((TInt) ETrue); return KErrNone; } default: { - return CImageEditorPluginBase::GetProperty( - aPropertyId, aPropertyValue); + return CImageEditorPluginBase::GetProperty(aPropertyId, + aPropertyValue); } } } @@ -167,45 +167,46 @@ // InitPluginL // --------------------------------------------------------------------------- // -TInt CImageEditorDrawPlugin::InitPluginL( - const TRect& aRect, - CCoeControl* aParent, - CCoeControl*& aPluginControl) +TInt CImageEditorDrawPlugin::InitPluginL(const TRect& aRect, + CCoeControl* aParent, CCoeControl*& aPluginControl) { - // Delete previous control + // Delete previous control ReleasePlugin(); // Get pointer to the parameter descriptor array - TBuf<256> readbuf; - TLex parser; - User::LeaveIfError( CImageEditorPluginBase::GetProperty( - KCapPluginParamNames, readbuf) ); - parser.Assign (readbuf); + TBuf<256> readbuf; + TLex parser; + User::LeaveIfError(CImageEditorPluginBase::GetProperty( + KCapPluginParamNames, readbuf)); + parser.Assign(readbuf); TInt tempval = 0; - parser.Val( tempval ); + parser.Val(tempval); //CDesCArray * pars = (CDesCArray *)tempval; #ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY - // Text input is always insterted in portrait mode. + // Text input is always insterted in portrait mode. // Store the original orientation before forcing to portrait. - CAknAppUiBase* appUi = static_cast( - CEikonEnv::Static()->EikAppUi() ); - CAknAppUiBase::TAppUiOrientation originalOrientation = - appUi->Orientation(); - appUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait); + CAknAppUiBase* appUi = static_cast( + CEikonEnv::Static()->EikAppUi() ); + CAknAppUiBase::TAppUiOrientation originalOrientation = + appUi->Orientation(); + appUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait); #endif - iControl = CImageEditorDrawControl::NewL (aRect, aParent); - aPluginControl = iControl; - - // Set system parameters - ((CImageEditorDrawControl*)iControl)->SetSystemParameters (iSysPars); + CalculatePositionOnView(); + + iControl = CImageEditorDrawControl::NewL(aRect, aParent, iPaths, iRgb, iSize,iDiplayToolPluginParam); + aPluginControl = iControl; - iLandscapeEnabled = ETrue; - + // Set system parameters + ((CImageEditorDrawControl*) iControl)->SetSystemParameters(iSysPars); + + iVisibleImageRectPrevFirst = iSysPars->VisibleImageRectPrev(); + + iLandscapeEnabled = ETrue; #ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY - // Set always back to original orientation, even if leaves + // Set always back to original orientation, even if leaves CAknAppUiBase::TAppUiOrientation orientation = appUi->Orientation(); if (orientation != originalOrientation) @@ -217,8 +218,8 @@ RWsSession& rws = CEikonEnv::Static()->WsSession(); event.SetType( EEventScreenDeviceChanged ); - event.SetTimeNow(); - event.SetHandle( rws.WsHandle() ); + event.SetTimeNow(); + event.SetHandle( rws.WsHandle() ); User::LeaveIfError( rws.SendEventToAllWindowGroups(event) ); } @@ -232,22 +233,22 @@ RWsSession& rws = CEikonEnv::Static()->WsSession(); event.SetType( EEventScreenDeviceChanged ); - event.SetTimeNow(); - event.SetHandle( rws.WsHandle() ); + event.SetTimeNow(); + event.SetHandle( rws.WsHandle() ); User::LeaveIfError( rws.SendEventToAllWindowGroups(event) ); - + #endif #endif - return KErrNone; + return KErrNone; } // --------------------------------------------------------------------------- // ProcessImageL // --------------------------------------------------------------------------- // -void CImageEditorDrawPlugin::ProcessImageL(CEditorImage * /*aImage*/ ) +void CImageEditorDrawPlugin::ProcessImageL(CEditorImage * /*aImage*/) { } @@ -260,5 +261,55 @@ delete iControl; iControl = NULL; } +// --------------------------------------------------------------------------- +// CalculatePositionOnView +// --------------------------------------------------------------------------- +// +void CImageEditorDrawPlugin::CalculatePositionOnView() + { + if (iPaths.Count() > 0) + { + // new image rect on preview + TRect rectPrevLast = iSysPars->VisibleImageRectPrev(); + //real image rect + TRect rectReal = iSysPars->VisibleImageRect(); + //the old position of old image rect + TInt xPositionPrevFirst = iVisibleImageRectPrevFirst.iTl.iX; + TInt yPositionPrevFirst = iVisibleImageRectPrevFirst.iTl.iY; + //the old width and height of old image rect + TInt xPosFactorDivider = iVisibleImageRectPrevFirst.Width(); + TInt yPosFactorDivider = iVisibleImageRectPrevFirst.Height(); + + for (TInt i(0); i < iPaths.Count(); ++i) + { + CDrawPath* path = iPaths[i]; + CArrayFix* pathPoints = path->ItemArray(); + if (pathPoints && (pathPoints->Count() > 0)) + { + for (TInt i(0); i < pathPoints->Count(); ++i) + { + //the old absolute point on screen + TPoint & point = (*pathPoints)[i]; + //the relative position on old image rect + TInt xPositionCompareFirst = point.iX - xPositionPrevFirst; + TInt yPositionCompareFirst = point.iY - yPositionPrevFirst; + //the relative position on new image rect + TReal xPositionCompareLast = TReal(rectPrevLast.Width() + * xPositionCompareFirst) + / iVisibleImageRectPrevFirst.Width(); + TReal yPositionCompareLast = TReal(rectPrevLast.Height() + * yPositionCompareFirst) + / iVisibleImageRectPrevFirst.Height(); + //the new absolute position on screen + TInt xPositionOnView = rectPrevLast.iTl.iX + + xPositionCompareLast; + TInt yPositionOnView = rectPrevLast.iTl.iY + + yPositionCompareLast; + point.SetXY(xPositionOnView, yPositionOnView); + } + } + } + } + } // End of File diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/src/selectionpopup.cpp --- a/imageeditor/plugins/DrawPlugin/src/selectionpopup.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/src/selectionpopup.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -1,792 +1,799 @@ -/* -* Copyright (c) 2010 Ixonos Plc. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* Ixonos Plc -* -* Description: -* Selection popup dialog. -* -*/ - - -// INCLUDES - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include "ResolutionUtil.h" -#include "selectionpopup.h" -#include "ImageEditorUiDefs.h" - -// CONSTANTS -const TInt KGridColumnCount = 5; -const TInt KGridRowCount = 1; - - -//============================================================================= -CSelectionPopup::CSelectionPopup() - { - // Set values into an array - iItemArray.Append( 4 ); - iItemArray.Append( 8 ); - iItemArray.Append( 16 ); - iItemArray.Append( 32 ); - iItemArray.Append( 64 ); - } - -//============================================================================= -CSelectionPopup::~CSelectionPopup() - { - delete iPopupCenter; - delete iPopupCenterMask; - delete iPopupCornerTL; - delete iPopupCornerTLMask; - delete iPopupCornerTR; - delete iPopupCornerTRMask; - delete iPopupCornerBL; - delete iPopupCornerBLMask; - delete iPopupCornerBR; - delete iPopupCornerBRMask; - delete iPopupSideL; - delete iPopupSideLMask; - delete iPopupSideR; - delete iPopupSideRMask; - delete iPopupSideT; - delete iPopupSideTMask; - delete iPopupSideB; - delete iPopupSideBMask; - - iHighlightRectsArray.Close(); - iGridRectsArray.Close(); - iColorBitmapsArray.ResetAndDestroy(); - iItemArray.Close(); - } - -//============================================================================= -void CSelectionPopup::ConstructL ( CCoeControl* aParent ) - { - // Set parent - SetContainerWindowL( *aParent ); - TFileName iconFile( KImageEditorUiMifFile ); - - // Create trans popup window graphics - // Center - AknIconUtils::CreateIconL( iPopupCenter, iPopupCenterMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_center, - EMbmImageeditoruiQgn_graf_popup_trans_center_mask ); - - // Top-left corner - AknIconUtils::CreateIconL( iPopupCornerTL, iPopupCornerTLMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_corner_tl, - EMbmImageeditoruiQgn_graf_popup_trans_corner_tl_mask ); - - // Top-right corner - AknIconUtils::CreateIconL( iPopupCornerTR, iPopupCornerTRMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_corner_tr, - EMbmImageeditoruiQgn_graf_popup_trans_corner_tr_mask ); - - // Bottom-left corner - AknIconUtils::CreateIconL( iPopupCornerBL, iPopupCornerBLMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_corner_bl, - EMbmImageeditoruiQgn_graf_popup_trans_corner_bl_mask ); - - // Bottom-right corner - AknIconUtils::CreateIconL( iPopupCornerBR, iPopupCornerBRMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_corner_br, - EMbmImageeditoruiQgn_graf_popup_trans_corner_br_mask ); - - // left side - AknIconUtils::CreateIconL( iPopupSideL, iPopupSideLMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_side_l, - EMbmImageeditoruiQgn_graf_popup_trans_side_l_mask ); - - // left side - AknIconUtils::CreateIconL( iPopupSideR, iPopupSideRMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_side_r, - EMbmImageeditoruiQgn_graf_popup_trans_side_r_mask ); - - // top side - AknIconUtils::CreateIconL( iPopupSideT, iPopupSideTMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_side_t, - EMbmImageeditoruiQgn_graf_popup_trans_side_t_mask ); - - // bottom side - AknIconUtils::CreateIconL( iPopupSideB, iPopupSideBMask, iconFile, - EMbmImageeditoruiQgn_graf_popup_trans_side_b, - EMbmImageeditoruiQgn_graf_popup_trans_side_b_mask ); - - // Activate control - ActivateL(); - - } - -//============================================================================= -void CSelectionPopup::CreateColorBitmapsL( TSize aSize ) - { - // Generate color bitmaps - iColorBitmapsArray.Reset(); - for( TInt i = 0; i < iItemArray.Count(); i++ ) - { - CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap; - CleanupStack::PushL( bitmap ); - User::LeaveIfError ( bitmap->Create ( aSize, EColor64K ) ); - - // Compute color for bitmap - TRgb color( KRgbBlack );//iRGBArray[i] ); - - // Fill the bitmap with the correct color - TUint16 color_64k = ( TUint16 ) - (0 | - ((( TUint8 )color.Red() >> 3) << 11) | - ((( TUint8 )color.Green() >> 2) << 5) | - (( TUint8 )color.Blue() >> 3)); - - bitmap->LockHeapLC(); - TUint16 * pd = (TUint16 *)bitmap->DataAddress(); - TSize size = bitmap->SizeInPixels(); - TInt w = (bitmap->ScanLineLength(size.iWidth, EColor64K) >> 1) - * size.iHeight; - for( TInt k = w; k != 0; --k) - { - *pd++ = color_64k; - } - - iColorBitmapsArray.Append( bitmap ); - - CleanupStack::PopAndDestroy(); // LockHeapLC() - CleanupStack::Pop(); // bitmap - - } - - } - -//============================================================================= -void CSelectionPopup::Draw( const TRect& /*aRect*/ ) const - { - const TRgb KHighlightCenterColor (229, 229, 229); - - CWindowGc& gc = SystemGc(); - - CPreviewControlBase::DrawPreviewImage (Rect()); - - // Change brush to null to enable transparent drawing - gc.SetBrushStyle (CGraphicsContext::ENullBrush); - - // draw center of the borders - gc.BitBltMasked( iPopupCenterRect.iTl, iPopupCenter, - iPopupCenterRect.Size(), iPopupCenterMask, EFalse ); - // draw Top left corner - gc.BitBltMasked( iPopupCornerTLRect.iTl, iPopupCornerTL, - iPopupCornerTLRect.Size(), iPopupCornerTLMask, EFalse ); - // draw Top right corner - gc.BitBltMasked( iPopupCornerTRRect.iTl, iPopupCornerTR, - iPopupCornerTRRect.Size(), iPopupCornerTRMask, EFalse ); - // draw Bottom left corner - gc.BitBltMasked( iPopupCornerBLRect.iTl, iPopupCornerBL, - iPopupCornerBLRect.Size(), iPopupCornerBLMask, EFalse ); - // draw Bottom right corner - gc.BitBltMasked( iPopupCornerBRRect.iTl, iPopupCornerBR, - iPopupCornerBRRect.Size(), iPopupCornerBRMask, EFalse ); - // draw Left side - gc.BitBltMasked( iPopupSideLRect.iTl, iPopupSideL, - iPopupSideLRect.Size(), iPopupSideLMask, EFalse ); - // draw Right side - gc.BitBltMasked( iPopupSideRRect.iTl, iPopupSideR, - iPopupSideRRect.Size(), iPopupSideRMask, EFalse ); - // draw Top side - gc.BitBltMasked( iPopupSideTRect.iTl, iPopupSideT, - iPopupSideTRect.Size(), iPopupSideTMask, EFalse ); - // draw Bottom side - gc.BitBltMasked( iPopupSideBRect.iTl, iPopupSideB, - iPopupSideBRect.Size(), iPopupSideBMask, EFalse ); - - // Draw color items and selection indicator - for( TInt index = 0; index < iGridRectsArray.Count(); index++ ) - { - // Draw selection indicator for current item - if( index == iCurrentItem ) - { - gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - gc.SetBrushColor( KHighlightCenterColor ); - gc.SetPenColor( KRgbBlack ); - gc.SetPenSize( TSize(2,2) ); - gc.DrawRect( iHighlightRectsArray[ iCurrentItem ] ); - - gc.SetBrushStyle (CGraphicsContext::ENullBrush); - } - - // draw color bitmap - TRect currentRect = iGridRectsArray[index]; - gc.BitBlt(currentRect.iTl, iColorBitmapsArray[index]); - } - - // Draw heading - // Convert the plug-in name to visual representation - // (in case would be right-to-left) - const CFont* font = NULL; - font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimaryFont ); - TBuf<256> visual; - // Text to be converted - HBufC * heading = ControlEnv()->AllocReadResourceLC ( R_TITLE_LINE_WEIGHT ); - - AknBidiTextUtils::ConvertToVisualAndClip( - heading->Des(), - visual, - *font, - iHeadingRect.Width(), - iHeadingRect.Width() - ); - - CleanupStack::PopAndDestroy( heading ); - - gc.UseFont( font ); - gc.SetBrushStyle ( CGraphicsContext::ENullBrush ); - - TInt baseline = iHeadingRect.Height() / 2 + font->AscentInPixels() / 2; - - // Check the directionality of the current language and set the alignment - // according the directionality - TBidiText::TDirectionality dir = TBidiText::ScriptDirectionality(User::Language()); - CGraphicsContext::TTextAlign align = CGraphicsContext::ELeft; - - if( dir == TBidiText::ERightToLeft ) - { - align = CGraphicsContext::ERight; - } - gc.SetPenColor(KRgbWhite); - gc.DrawText( - visual, - iHeadingRect, - baseline, - align, - 0); - } - -//============================================================================= -void CSelectionPopup::SizeChanged() - { - - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( Rect(), AknLayoutScalable_Apps::popup_imed_trans_window(0) ); - TRect parentRect = layoutRect.Rect(); - - TAknLayoutRect iconLayout; - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g1()); - iPopupCenterRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2()); - iPopupCornerTLRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3()); - iPopupCornerTRRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4()); - iPopupCornerBLRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5()); - iPopupCornerBRRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6()); - iPopupSideLRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7()); - iPopupSideRRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g8()); - iPopupSideTRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g9()); - iPopupSideBRect = iconLayout.Rect(); - - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Apps::listscroll_imed_pane()); - TRect listscrollPaneRect = iconLayout.Rect(); - - iconLayout.LayoutRect( listscrollPaneRect, AknLayoutScalable_Apps::grid_imed_colour_35_pane( 1 )); - TRect gridPaneRect = iconLayout.Rect(); - - // Calculate grid's cell rects - iHighlightRectsArray.Reset(); - iGridRectsArray.Reset(); - for( TInt row = 0; row < KGridRowCount; row++ ) - { - for( TInt column = 0; column < KGridColumnCount; column++ ) - { - iconLayout.LayoutRect( gridPaneRect, - AknLayoutScalable_Apps::cell_imed_colour_pane(0 , column, row )); - TRect highlightRect = iconLayout.Rect(); - iHighlightRectsArray.Append( highlightRect ); - - iconLayout.LayoutRect( highlightRect, - AknLayoutScalable_Apps::cell_imed_colour_pane_g1(0) ); - - iGridRectsArray.Append( iconLayout.Rect() ); - - } - } - - CreateColorBitmapsL( iconLayout.Rect().Size() ); - - //Heading rect - iconLayout.LayoutRect( parentRect, AknLayoutScalable_Apps::heading_imed_pane()); - TRect heading = iconLayout.Rect(); - - TAknLayoutText layoutText; - layoutText.LayoutText( heading, AknLayoutScalable_Apps::heading_imed_pane_t1() ); - iHeadingRect = layoutText.TextRect(); - iLayoutTextHeading = layoutText; - - // Resize graphics to correct size - AknIconUtils::SetSize( iPopupCenter, iPopupCenterRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize( iPopupCornerTL, iPopupCornerTLRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize( iPopupCornerTR, iPopupCornerTRRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize( iPopupCornerBL, iPopupCornerBLRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize( iPopupCornerBR, iPopupCornerBRRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize( iPopupSideL, iPopupSideLRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize( iPopupSideR, iPopupSideRRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize( iPopupSideT, iPopupSideTRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize( iPopupSideB, iPopupSideBRect.Size(), EAspectRatioNotPreserved); - - } - -//============================================================================= -TKeyResponse CSelectionPopup::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - TKeyResponse res = EKeyWasNotConsumed; - - if (aType == EEventKey) - { - // If in landscape mode, do different mapping for the number keys. - TUint keyCode = aKeyEvent.iCode; - TBool landscape = CResolutionUtil::Self()->GetLandscape(); - if (landscape) - { - switch (keyCode) - { - case 49: // numeric keypad '1' - keyCode = 55; - break; - case 50: // numeric keypad '2' - keyCode = 52; - break; - case 51: // numeric keypad '3' - keyCode = 49; - break; - case 52: // numeric keypad '4' - keyCode = 56; - break; - case 54: // numeric keypad '6' - keyCode = 50; - break; - case 55: // numeric keypad '7' - keyCode = 57; - break; - case 56: // numeric keypad '8' - keyCode = 54; - break; - case 57: // numeric keypad '9' - keyCode = 51; - break; - default: - break; - } - } - - switch (keyCode) - { - case EKeyLeftArrow: - case 52: // numeric keypad '4' - { - if (iCurrentItem == 0) - { - iCurrentItem = iGridRectsArray.Count() - 1; - } - else - { - iCurrentItem--; - } - - res = EKeyWasConsumed; - break; - } - - case EKeyRightArrow: - case 54: // numeric keypad '6' - { - iCurrentItem++; - if (iCurrentItem >= iGridRectsArray.Count()) - { - iCurrentItem = 0; - } - - res = EKeyWasConsumed; - break; - } - - case EKeyDownArrow: - case 56: // numeric keypad '8' - { - iCurrentItem += KGridColumnCount; - if (iCurrentItem >= iGridRectsArray.Count()) - { - iCurrentItem = iCurrentItem - iGridRectsArray.Count(); - } - - res = EKeyWasConsumed; - break; - } - - case EKeyUpArrow: - case 50: // numeric keypad '2' - { - iCurrentItem -= KGridColumnCount; - if (iCurrentItem < 0) - { - iCurrentItem = iGridRectsArray.Count() + iCurrentItem; - } - - res = EKeyWasConsumed; - break; - } - - case 49: // numeric keypad '1' - { - // Move up and left - iCurrentItem -= KGridColumnCount; - iCurrentItem --; - if (iCurrentItem < 0) - { - iCurrentItem = iGridRectsArray.Count() + iCurrentItem; - } - res = EKeyWasConsumed; - break; - } - - case 51: // numeric keypad '3' - { - // Move up and right - iCurrentItem -= KGridColumnCount; - iCurrentItem ++; - if (iCurrentItem < 0) - { - iCurrentItem = iGridRectsArray.Count() + iCurrentItem; - } - res = EKeyWasConsumed; - break; - } - - case 55: // numeric keypad '7' - { - // Move down and left - iCurrentItem += KGridColumnCount; - iCurrentItem--; - if (iCurrentItem >= iGridRectsArray.Count()) - { - iCurrentItem = iCurrentItem - iGridRectsArray.Count(); - } - res = EKeyWasConsumed; - break; - } - - case 57: // numeric keypad '9' - { - // Move down and left - iCurrentItem += KGridColumnCount; - iCurrentItem++; - if (iCurrentItem >= iGridRectsArray.Count()) - { - iCurrentItem = iCurrentItem - iGridRectsArray.Count(); - } - res = EKeyWasConsumed; - break; - } - - default: - { - break; - } - } - } - - return res; - - } - -//============================================================================= -void CSelectionPopup::HandlePointerEventL( const TPointerEvent &aPointerEvent ) - { - if( AknLayoutUtils::PenEnabled() ) - { - switch( aPointerEvent.iType ) - { - case TPointerEvent::EButton1Down: - case TPointerEvent::EDrag: - { - // calculate which one of the grid items was pressed by - // by comparing item rects and pressed position - for (TInt i = 0; i < iHighlightRectsArray.Count(); ++i) - { - TRect iconRect( iHighlightRectsArray[i] ); - - if( iconRect.Contains( aPointerEvent.iPosition ) ) - { - // set new highlighted item - iCurrentItem = i; - break; - } - } - break; - } - case TPointerEvent::EButton1Up: - { - break; - } - default: - { - break; - } - } - } - } - -//============================================================================= -TRect CSelectionPopup::GridRect() const - { - return iPopupCenterRect; - } - -//============================================================================= -TBool CSelectionPopup::HighlightedItemPressed( TPoint aPosition ) const - { - TRect iconRect = iHighlightRectsArray[ iCurrentItem ]; - - if (iconRect.Contains( aPosition )) - { - return ETrue; - } - else - { - return EFalse; - } - } - -//============================================================================= -void CSelectionPopup::SetSelectedValue( TInt aSelected ) - { - ASSERT( aSelected >= 0 ); - iCurrentItem = iItemArray.Find( aSelected ); - } - -//============================================================================= -TInt CSelectionPopup::GetSelectedValue() const - { - ASSERT( iCurrentItem >= 0 && iCurrentItem < iItemArray.Count() ); - return iItemArray[iCurrentItem]; - } - - -//============================================================================= -// DIALOG -//============================================================================= -TInt CSelectionDialog::RunDlgLD( const CFbsBitmap* aBitmap, - const TRect& aRect, - TInt& aSelection ) - { - CSelectionDialog* dialog = - new (ELeave) CSelectionDialog ( aSelection ); - dialog->ConstructL( aBitmap, aRect); - return dialog->ExecuteLD( R_IMAGE_EDITOR_COLOR_DIALOG ); - } - -//============================================================================= -CSelectionDialog::CSelectionDialog( TInt& aSelection ) -: iCurrentValue( aSelection ) - { - } - -//============================================================================= -CSelectionDialog::~CSelectionDialog() - { - delete iPopup; - } - -//============================================================================= - -void CSelectionDialog::ConstructL( const CFbsBitmap* aBitmap, - const TRect& aRect ) - { - iPopup = new ( ELeave ) CSelectionPopup(); - iPopup->SetSelectedValue( iCurrentValue); - iPopup->ConstructL( this ); - - SetRect(aRect); - - // Not drawn correctly if calling SetRect() - iPopup->SetSize(aRect.Size()); - iPopup->SetPosition(TPoint(0,0)); - iPopup->SetImageL( aBitmap ); - } - -//============================================================================= -TBool CSelectionDialog::OkToExitL( TInt aButtonId ) - { - if ( aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect) - { - iCurrentValue = iPopup->GetSelectedValue(); - return ETrue; - } - else - { - return EFalse; - } - } - -//============================================================================= -void CSelectionDialog::Draw(const TRect& /*aRect*/) const - { - } - -//============================================================================= -void CSelectionDialog::SizeChanged() - { - } - -//============================================================================= -void CSelectionDialog::PreLayoutDynInitL() - { - } - - -//============================================================================= -TInt CSelectionDialog::CountComponentControls() const - { - return 1; - } - -//============================================================================= -CCoeControl* CSelectionDialog::ComponentControl(TInt /*aIndex*/) const - { - return iPopup; - } - -//============================================================================= -TKeyResponse CSelectionDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) - { - // Selection key or numeric keypad '5' close the dialog - TKeyResponse res = EKeyWasNotConsumed; - if (aType == EEventKey && - (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == 53 || aKeyEvent.iScanCode == EStdKeyEnter) ) - { - TryExitL (EAknSoftkeyOk); - res = EKeyWasConsumed; - } - else if (aType == EEventKey && aKeyEvent.iCode == EKeyNo || aKeyEvent.iCode == EKeyEscape) // Do not exit if dialog active - { - TryExitL (EAknSoftkeyCancel); - res = EKeyWasNotConsumed; - } -#ifdef FULLSCREEN_AVAILABLE - else if (aType == EEventKey && aKeyEvent.iCode == 48 ) // 0 - { - // Switch normal screen / full screen - if (CResolutionUtil::Self()->GetFullScreen()) - { - iEikonEnv->EikAppUi()->HandleCommandL(EImageEditorMenuCmdNormalScreen); - SetRect(iEikonEnv->EikAppUi()->ClientRect()); - SizeChanged(); - DrawNow(); - } - else - { - iEikonEnv->EikAppUi()->HandleCommandL(EImageEditorMenuCmdFullScreen); - SetExtentToWholeScreen(); - SizeChanged(); - DrawNow(); - } - res = EKeyWasConsumed; - } -#endif // FULLSCREEN_AVAILABLE - else - { - res = iPopup->OfferKeyEventL(aKeyEvent, aType); - if (res == EKeyWasConsumed) - { - DrawDeferred(); - } - } - - return res; - } - -//============================================================================= -void CSelectionDialog::HandlePointerEventL( - const TPointerEvent &aPointerEvent ) - { - if( AknLayoutUtils::PenEnabled() ) - { - TBool draw( EFalse ); - switch( aPointerEvent.iType ) - { - case TPointerEvent::EButton1Down: - { - // forward event only if grid area was pressed - if ( iPopup->GridRect().Contains( aPointerEvent.iPosition ) ) - { - iPopup->HandlePointerEventL( aPointerEvent ); - draw = ETrue; - } - break; - } - case TPointerEvent::EDrag: - { - if ( iPopup->GridRect().Contains( aPointerEvent.iPosition ) ) - { - iPopup->HandlePointerEventL( aPointerEvent ); - draw = ETrue; - } - break; - } - case TPointerEvent::EButton1Up: - { - // already highlighted item is pressed - if ( iPopup->HighlightedItemPressed( aPointerEvent.iPosition ) ) - { - TryExitL (EAknSoftkeyOk); - } - break; - } - default: - { - break; - } - } - - if ( draw ) - { - DrawDeferred(); - } - } - } - -// End of file - +/* +* Copyright (c) 2010 Ixonos Plc. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - Initial contribution +* +* Contributors: +* Ixonos Plc +* +* Description: +* Selection popup dialog. +* +*/ + + +// INCLUDES + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "ResolutionUtil.h" +#include "selectionpopup.h" +#include "ImageEditorUiDefs.h" + +// CONSTANTS +const TInt KGridColumnCount = 5; +const TInt KGridRowCount = 1; +const TInt KPenSizeOffset = 153; + + +//============================================================================= +CSelectionPopup::CSelectionPopup(TRgb& aCurrentColor, const TRect& aImageRect) + { + // Set values into an array + iItemArray.Append( 2 ); //default: 4 + iItemArray.Append( 4 ); + iItemArray.Append( 8 ); + iItemArray.Append( 16 ); + iItemArray.Append( 32 ); + + //set defalut color + iCurrentColor = aCurrentColor; + + iImageRect = aImageRect; + } + +//============================================================================= +CSelectionPopup::~CSelectionPopup() + { + delete iPopupCenter; + delete iPopupCenterMask; + delete iPopupCornerTL; + delete iPopupCornerTLMask; + delete iPopupCornerTR; + delete iPopupCornerTRMask; + delete iPopupCornerBL; + delete iPopupCornerBLMask; + delete iPopupCornerBR; + delete iPopupCornerBRMask; + delete iPopupSideL; + delete iPopupSideLMask; + delete iPopupSideR; + delete iPopupSideRMask; + delete iPopupSideT; + delete iPopupSideTMask; + delete iPopupSideB; + delete iPopupSideBMask; + + iHighlightRectsArray.Close(); + iGridRectsArray.Close(); + iColorBitmapsArray.ResetAndDestroy(); + iItemArray.Close(); + } + +//============================================================================= +void CSelectionPopup::ConstructL ( CCoeControl* aParent ) + { + // Set parent + SetContainerWindowL( *aParent ); + + TFileName iconFile( KImageEditorUiMifFile ); + + // Create trans popup window graphics + // Center + AknIconUtils::CreateIconL( iPopupCenter, iPopupCenterMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_center, + EMbmImageeditoruiQgn_graf_popup_trans_center_mask ); + + // Top-left corner + AknIconUtils::CreateIconL( iPopupCornerTL, iPopupCornerTLMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_corner_tl, + EMbmImageeditoruiQgn_graf_popup_trans_corner_tl_mask ); + + // Top-right corner + AknIconUtils::CreateIconL( iPopupCornerTR, iPopupCornerTRMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_corner_tr, + EMbmImageeditoruiQgn_graf_popup_trans_corner_tr_mask ); + + // Bottom-left corner + AknIconUtils::CreateIconL( iPopupCornerBL, iPopupCornerBLMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_corner_bl, + EMbmImageeditoruiQgn_graf_popup_trans_corner_bl_mask ); + + // Bottom-right corner + AknIconUtils::CreateIconL( iPopupCornerBR, iPopupCornerBRMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_corner_br, + EMbmImageeditoruiQgn_graf_popup_trans_corner_br_mask ); + + // left side + AknIconUtils::CreateIconL( iPopupSideL, iPopupSideLMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_side_l, + EMbmImageeditoruiQgn_graf_popup_trans_side_l_mask ); + + // left side + AknIconUtils::CreateIconL( iPopupSideR, iPopupSideRMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_side_r, + EMbmImageeditoruiQgn_graf_popup_trans_side_r_mask ); + + // top side + AknIconUtils::CreateIconL( iPopupSideT, iPopupSideTMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_side_t, + EMbmImageeditoruiQgn_graf_popup_trans_side_t_mask ); + + // bottom side + AknIconUtils::CreateIconL( iPopupSideB, iPopupSideBMask, iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_side_b, + EMbmImageeditoruiQgn_graf_popup_trans_side_b_mask ); + + // Activate control + ActivateL(); + + } + +//============================================================================= +void CSelectionPopup::CreateColorBitmapsL( TSize /* aSize */ ) + { + //TODO: to set icon here + // Generate color bitmaps + iColorBitmapsArray.Reset(); + + TSize size(2,2); + for( TInt i = iItemArray.Count(); i > 0 ; i-- ) + { + CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap; + CleanupStack::PushL( bitmap ); + User::LeaveIfError ( bitmap->Create ( size, EColor64K ) ); + size.iHeight*=2; + size.iWidth*=2; + // Compute color for bitmap + TRgb color( iCurrentColor );//iRGBArray[i] ); + + // Fill the bitmap with the correct color + TUint16 color_64k = ( TUint16 ) + (0 | + ((( TUint8 )color.Red() >> 3) << 11) | + ((( TUint8 )color.Green() >> 2) << 5) | + (( TUint8 )color.Blue() >> 3)); + + bitmap->LockHeapLC(); + TUint16 * pd = (TUint16 *)bitmap->DataAddress(); + TSize size = bitmap->SizeInPixels(); + TInt w = (bitmap->ScanLineLength(size.iWidth, EColor64K) >> 1) + * size.iHeight; + for( TInt k = w; k != 0; --k) + { + *pd++ = color_64k; + } + + iColorBitmapsArray.Append( bitmap ); + + CleanupStack::PopAndDestroy(); // LockHeapLC() + CleanupStack::Pop(); // bitmap + + } + + } + +//============================================================================= +void CSelectionPopup::Draw( const TRect& aRect ) const + { + const TRgb KHighlightCenterColor (229, 229, 229); + + CWindowGc& gc = SystemGc(); + + // Change brush to null to enable transparent drawing + gc.SetBrushStyle (CGraphicsContext::ENullBrush); + + // draw center of the borders + gc.BitBltMasked( iPopupCenterRect.iTl, iPopupCenter, + iPopupCenterRect.Size(), iPopupCenterMask, EFalse ); + // draw Top left corner + gc.BitBltMasked( iPopupCornerTLRect.iTl, iPopupCornerTL, + iPopupCornerTLRect.Size(), iPopupCornerTLMask, EFalse ); + // draw Top right corner + gc.BitBltMasked( iPopupCornerTRRect.iTl, iPopupCornerTR, + iPopupCornerTRRect.Size(), iPopupCornerTRMask, EFalse ); + // draw Bottom left corner + gc.BitBltMasked( iPopupCornerBLRect.iTl, iPopupCornerBL, + iPopupCornerBLRect.Size(), iPopupCornerBLMask, EFalse ); + // draw Bottom right corner + gc.BitBltMasked( iPopupCornerBRRect.iTl, iPopupCornerBR, + iPopupCornerBRRect.Size(), iPopupCornerBRMask, EFalse ); + // draw Left side + gc.BitBltMasked( iPopupSideLRect.iTl, iPopupSideL, + iPopupSideLRect.Size(), iPopupSideLMask, EFalse ); + // draw Right side + gc.BitBltMasked( iPopupSideRRect.iTl, iPopupSideR, + iPopupSideRRect.Size(), iPopupSideRMask, EFalse ); + // draw Top side + gc.BitBltMasked( iPopupSideTRect.iTl, iPopupSideT, + iPopupSideTRect.Size(), iPopupSideTMask, EFalse ); + // draw Bottom side + gc.BitBltMasked( iPopupSideBRect.iTl, iPopupSideB, + iPopupSideBRect.Size(), iPopupSideBMask, EFalse ); + + // Draw color items and selection indicator + for( TInt index = 0; index < iGridRectsArray.Count(); index++ ) + { + // Draw selection indicator for current item + if( index == iCurrentItem ) + { + gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); + gc.SetBrushColor( KHighlightCenterColor ); + gc.SetPenColor( KRgbBlack ); + gc.SetPenSize( TSize(2,2) ); + gc.DrawRect( iHighlightRectsArray[ iCurrentItem ] ); + + gc.SetBrushStyle (CGraphicsContext::ENullBrush); + } + + // draw color bitmap + TRect currentRect = iGridRectsArray[index]; + currentRect.iTl.iX = currentRect.iTl.iX + (currentRect.iBr.iX - currentRect.iTl.iX)/2 - iItemArray[index]/2; + currentRect.iTl.iY = currentRect.iTl.iY + (currentRect.iBr.iY - currentRect.iTl.iY)/2 - iItemArray[index]/2; + gc.BitBlt(currentRect.iTl, iColorBitmapsArray[index]); + } + + // Draw heading + // Convert the plug-in name to visual representation + // (in case would be right-to-left) + const CFont* font = NULL; + font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimaryFont ); + TBuf<256> visual; + // Text to be converted + HBufC * heading = ControlEnv()->AllocReadResourceLC ( R_TITLE_LINE_WEIGHT ); + + AknBidiTextUtils::ConvertToVisualAndClip( + heading->Des(), + visual, + *font, + iHeadingRect.Width(), + iHeadingRect.Width() + ); + + CleanupStack::PopAndDestroy( heading ); + + gc.UseFont( font ); + gc.SetBrushStyle ( CGraphicsContext::ENullBrush ); + + TInt baseline = iHeadingRect.Height() / 2 + font->AscentInPixels() / 2; + + // Check the directionality of the current language and set the alignment + // according the directionality + TBidiText::TDirectionality dir = TBidiText::ScriptDirectionality(User::Language()); + CGraphicsContext::TTextAlign align = CGraphicsContext::ELeft; + + if (dir == TBidiText::ERightToLeft) + { + align = CGraphicsContext::ERight; + } + gc.SetPenColor(KRgbWhite); + gc.DrawText(visual, iHeadingRect, baseline, align, 0); + + } + +//============================================================================= +void CSelectionPopup::SizeChanged() + { + + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( Rect(), AknLayoutScalable_Apps::popup_imed_trans_window(0) ); + TRect parentRect = layoutRect.Rect(); + + if(parentRect.iTl.iX > parentRect.iTl.iY) + { + parentRect.SetRect(parentRect.iTl.iX-KPenSizeOffset,parentRect.iTl.iY,parentRect.iBr.iX-KPenSizeOffset,parentRect.iBr.iY); + } + + TAknLayoutRect iconLayout; + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g1()); + iPopupCenterRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2()); + iPopupCornerTLRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3()); + iPopupCornerTRRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4()); + iPopupCornerBLRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5()); + iPopupCornerBRRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6()); + iPopupSideLRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7()); + iPopupSideRRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g8()); + iPopupSideTRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g9()); + iPopupSideBRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Apps::listscroll_imed_pane()); + TRect listscrollPaneRect = iconLayout.Rect(); + + iconLayout.LayoutRect( listscrollPaneRect, AknLayoutScalable_Apps::grid_imed_colour_35_pane( 1 )); + TRect gridPaneRect = iconLayout.Rect(); + + iHighlightRectsArray.Reset(); + iGridRectsArray.Reset(); + for( TInt row = 0; row < KGridRowCount; row++ ) + { + for( TInt column = 0; column < KGridColumnCount; column++ ) + { + iconLayout.LayoutRect( gridPaneRect, + AknLayoutScalable_Apps::cell_imed_colour_pane(0 , column, row )); + TRect highlightRect = iconLayout.Rect(); + iHighlightRectsArray.Append( highlightRect ); + + iconLayout.LayoutRect( highlightRect, + AknLayoutScalable_Apps::cell_imed_colour_pane_g1(0) ); + + iGridRectsArray.Append(iconLayout.Rect()); + } + } + + CreateColorBitmapsL( iconLayout.Rect().Size() ); + + //Heading rect + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Apps::heading_imed_pane()); + TRect heading = iconLayout.Rect(); + + TAknLayoutText layoutText; + layoutText.LayoutText( heading, AknLayoutScalable_Apps::heading_imed_pane_t1() ); + iHeadingRect = layoutText.TextRect(); + iLayoutTextHeading = layoutText; + + // Resize graphics to correct size + AknIconUtils::SetSize( iPopupCenter, iPopupCenterRect.Size(), EAspectRatioNotPreserved); + AknIconUtils::SetSize( iPopupCornerTL, iPopupCornerTLRect.Size(), EAspectRatioNotPreserved); + AknIconUtils::SetSize( iPopupCornerTR, iPopupCornerTRRect.Size(), EAspectRatioNotPreserved); + AknIconUtils::SetSize( iPopupCornerBL, iPopupCornerBLRect.Size(), EAspectRatioNotPreserved); + AknIconUtils::SetSize( iPopupCornerBR, iPopupCornerBRRect.Size(), EAspectRatioNotPreserved); + AknIconUtils::SetSize( iPopupSideL, iPopupSideLRect.Size(), EAspectRatioNotPreserved); + AknIconUtils::SetSize( iPopupSideR, iPopupSideRRect.Size(), EAspectRatioNotPreserved); + AknIconUtils::SetSize( iPopupSideT, iPopupSideTRect.Size(), EAspectRatioNotPreserved); + AknIconUtils::SetSize( iPopupSideB, iPopupSideBRect.Size(), EAspectRatioNotPreserved); + + } + +//============================================================================= +TKeyResponse CSelectionPopup::OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + TKeyResponse res = EKeyWasNotConsumed; + + if (aType == EEventKey) + { + // If in landscape mode, do different mapping for the number keys. + TUint keyCode = aKeyEvent.iCode; + TBool landscape = CResolutionUtil::Self()->GetLandscape(); + if (landscape) + { + switch (keyCode) + { + case 49: // numeric keypad '1' + keyCode = 55; + break; + case 50: // numeric keypad '2' + keyCode = 52; + break; + case 51: // numeric keypad '3' + keyCode = 49; + break; + case 52: // numeric keypad '4' + keyCode = 56; + break; + case 54: // numeric keypad '6' + keyCode = 50; + break; + case 55: // numeric keypad '7' + keyCode = 57; + break; + case 56: // numeric keypad '8' + keyCode = 54; + break; + case 57: // numeric keypad '9' + keyCode = 51; + break; + default: + break; + } + } + + switch (keyCode) + { + case EKeyLeftArrow: + case 52: // numeric keypad '4' + { + if (iCurrentItem == 0) + { + iCurrentItem = iGridRectsArray.Count() - 1; + } + else + { + iCurrentItem--; + } + + res = EKeyWasConsumed; + break; + } + + case EKeyRightArrow: + case 54: // numeric keypad '6' + { + iCurrentItem++; + if (iCurrentItem >= iGridRectsArray.Count()) + { + iCurrentItem = 0; + } + + res = EKeyWasConsumed; + break; + } + + case EKeyDownArrow: + case 56: // numeric keypad '8' + { + iCurrentItem += KGridColumnCount; + if (iCurrentItem >= iGridRectsArray.Count()) + { + iCurrentItem = iCurrentItem - iGridRectsArray.Count(); + } + + res = EKeyWasConsumed; + break; + } + + case EKeyUpArrow: + case 50: // numeric keypad '2' + { + iCurrentItem -= KGridColumnCount; + if (iCurrentItem < 0) + { + iCurrentItem = iGridRectsArray.Count() + iCurrentItem; + } + + res = EKeyWasConsumed; + break; + } + + case 49: // numeric keypad '1' + { + // Move up and left + iCurrentItem -= KGridColumnCount; + iCurrentItem --; + if (iCurrentItem < 0) + { + iCurrentItem = iGridRectsArray.Count() + iCurrentItem; + } + res = EKeyWasConsumed; + break; + } + + case 51: // numeric keypad '3' + { + // Move up and right + iCurrentItem -= KGridColumnCount; + iCurrentItem ++; + if (iCurrentItem < 0) + { + iCurrentItem = iGridRectsArray.Count() + iCurrentItem; + } + res = EKeyWasConsumed; + break; + } + + case 55: // numeric keypad '7' + { + // Move down and left + iCurrentItem += KGridColumnCount; + iCurrentItem--; + if (iCurrentItem >= iGridRectsArray.Count()) + { + iCurrentItem = iCurrentItem - iGridRectsArray.Count(); + } + res = EKeyWasConsumed; + break; + } + + case 57: // numeric keypad '9' + { + // Move down and left + iCurrentItem += KGridColumnCount; + iCurrentItem++; + if (iCurrentItem >= iGridRectsArray.Count()) + { + iCurrentItem = iCurrentItem - iGridRectsArray.Count(); + } + res = EKeyWasConsumed; + break; + } + + default: + { + break; + } + } + } + + return res; + + } + +//============================================================================= +void CSelectionPopup::HandlePointerEventL( const TPointerEvent &aPointerEvent ) + { + if( AknLayoutUtils::PenEnabled() ) + { + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + case TPointerEvent::EDrag: + { + // calculate which one of the grid items was pressed by + // by comparing item rects and pressed position + for (TInt i = 0; i < iHighlightRectsArray.Count(); ++i) + { + TRect iconRect( iHighlightRectsArray[i] ); + + if( iconRect.Contains( aPointerEvent.iPosition ) ) + { + // set new highlighted item + iCurrentItem = i; + break; + } + } + break; + } + case TPointerEvent::EButton1Up: + { + break; + } + default: + { + break; + } + } + } + } + +//============================================================================= +TRect CSelectionPopup::GridRect() const + { + return iPopupCenterRect; + } + +//============================================================================= +TBool CSelectionPopup::HighlightedItemPressed( TPoint aPosition ) const + { + TRect iconRect = iHighlightRectsArray[ iCurrentItem ]; + + if (iconRect.Contains( aPosition )) + { + return ETrue; + } + else + { + return EFalse; + } + } + +//============================================================================= +void CSelectionPopup::SetSelectedValue( TInt aSelected ) + { + ASSERT( aSelected >= 0 ); + iCurrentItem = iItemArray.Find( aSelected ); + } + +//============================================================================= +TInt CSelectionPopup::GetSelectedValue() const + { + ASSERT( iCurrentItem >= 0 && iCurrentItem < iItemArray.Count() ); + return iItemArray[iCurrentItem]; + } + + +//============================================================================= +// DIALOG +//============================================================================= +TInt CSelectionDialog::RunDlgLD( const CFbsBitmap* aBitmap, + const TRect& aRect, + TInt& aSelection, + TRgb& aCurrentColor, + const TRect& aImageRect) + { + CSelectionDialog* dialog = + new (ELeave) CSelectionDialog ( aSelection); + dialog->ConstructL( aBitmap, aRect, aCurrentColor, aImageRect); + return dialog->ExecuteLD( R_IMAGE_EDITOR_COLOR_DIALOG ); + } + +//============================================================================= +CSelectionDialog::CSelectionDialog( TInt& aSelection) +: iCurrentValue( aSelection ) + { + } + +//============================================================================= +CSelectionDialog::~CSelectionDialog() + { + delete iPopup; + } + +//============================================================================= + +void CSelectionDialog::ConstructL( const CFbsBitmap* aBitmap, + const TRect& aRect, + TRgb& aCurrentColor, + const TRect& aImageRect) + { + iPopup = new ( ELeave ) CSelectionPopup(aCurrentColor, aImageRect); + iPopup->SetSelectedValue(iCurrentValue); + iPopup->ConstructL(this); + + SetRect(aRect); + + // Not drawn correctly if calling SetRect() + iPopup->SetSize(aRect.Size()); + iPopup->SetPosition(TPoint(0,0)); + iPopup->SetImageL( aBitmap ); // set the image which we are editing + } + +//============================================================================= +TBool CSelectionDialog::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect) + { + iCurrentValue = iPopup->GetSelectedValue(); + return ETrue; + } + else + { + return EFalse; + } + } + +//============================================================================= +void CSelectionDialog::Draw(const TRect& /*aRect*/) const + { + } + +//============================================================================= +void CSelectionDialog::SizeChanged() + { + } + +//============================================================================= +void CSelectionDialog::PreLayoutDynInitL() + { + } + + +//============================================================================= +TInt CSelectionDialog::CountComponentControls() const + { + return 1; + } + +//============================================================================= +CCoeControl* CSelectionDialog::ComponentControl(TInt /*aIndex*/) const + { + return iPopup; + } + +//============================================================================= +TKeyResponse CSelectionDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) + { + // Selection key or numeric keypad '5' close the dialog + TKeyResponse res = EKeyWasNotConsumed; + if (aType == EEventKey && + (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == 53 || aKeyEvent.iScanCode == EStdKeyEnter) ) + { + TryExitL (EAknSoftkeyOk); + res = EKeyWasConsumed; + } + else if (aType == EEventKey && aKeyEvent.iCode == EKeyNo || aKeyEvent.iCode == EKeyEscape) // Do not exit if dialog active + { + TryExitL (EAknSoftkeyCancel); + res = EKeyWasNotConsumed; + } +#ifdef FULLSCREEN_AVAILABLE + else if (aType == EEventKey && aKeyEvent.iCode == 48 ) // 0 + { + // Switch normal screen / full screen + if (CResolutionUtil::Self()->GetFullScreen()) + { + iEikonEnv->EikAppUi()->HandleCommandL(EImageEditorMenuCmdNormalScreen); + SetRect(iEikonEnv->EikAppUi()->ClientRect()); + SizeChanged(); + DrawNow(); + } + else + { + iEikonEnv->EikAppUi()->HandleCommandL(EImageEditorMenuCmdFullScreen); + SetExtentToWholeScreen(); + SizeChanged(); + DrawNow(); + } + res = EKeyWasConsumed; + } +#endif // FULLSCREEN_AVAILABLE + else + { + res = iPopup->OfferKeyEventL(aKeyEvent, aType); + if (res == EKeyWasConsumed) + { + DrawDeferred(); + } + } + + return res; + } + +//============================================================================= +void CSelectionDialog::HandlePointerEventL( + const TPointerEvent &aPointerEvent ) + { + if( AknLayoutUtils::PenEnabled() ) + { + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + // forward event only if grid area was pressed + if ( iPopup->GridRect().Contains( aPointerEvent.iPosition ) ) + { + iPopup->HandlePointerEventL( aPointerEvent ); + } + break; + } + case TPointerEvent::EDrag: + { + if ( iPopup->GridRect().Contains( aPointerEvent.iPosition ) ) + { + iPopup->HandlePointerEventL( aPointerEvent ); + } + break; + } + case TPointerEvent::EButton1Up: + { + // already highlighted item is pressed + if ( iPopup->HighlightedItemPressed( aPointerEvent.iPosition ) ) + { + TryExitL (EAknSoftkeyOk); + } + break; + } + default: + { + break; + } + } + } + } + +// End of file + diff -r edfc90759b9f -r 18b321db4884 imageeditorengine/EngineWrapper/src/ImageEditorEngineWrapper.cpp --- a/imageeditorengine/EngineWrapper/src/ImageEditorEngineWrapper.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditorengine/EngineWrapper/src/ImageEditorEngineWrapper.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -1359,7 +1359,7 @@ { LOG( KEngineWrapperLogFile, "CEngineWrapper::CopyBufferL" ); - iScreenBitmap->LockHeapLC(); +// iScreenBitmap->LockHeapLC(); TSize size = iScreenBitmap->SizeInPixels(); TDisplayMode dmode = iScreenBitmap->DisplayMode(); @@ -1385,7 +1385,7 @@ } } - CleanupStack::PopAndDestroy(); // iScreenBitmap->LockHeapLC +// CleanupStack::PopAndDestroy(); // iScreenBitmap->LockHeapLC } //============================================================================= diff -r edfc90759b9f -r 18b321db4884 imageeditorengine/filters/FilterDraw/Inc/cfilterdraw.h --- a/imageeditorengine/filters/FilterDraw/Inc/cfilterdraw.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditorengine/filters/FilterDraw/Inc/cfilterdraw.h Thu Jun 03 18:57:10 2010 +0800 @@ -58,14 +58,20 @@ void RealToViewedFactories(TReal& aWidth, TReal& aHeight); private: // Data - /// Data is ready to be rendered + // Data is ready to be rendered TBool iReadyToRender; + //If it can redo + TBool iCanRedo; /// Data buffer - TUint32* iData; - /// Drawed lines + static TUint32* iData; + // Drawed lines RArray iPaths; - /// Bitmap size - TSize iBitmapSize; + // Bitmap size + TSize iBitmapSize; + //Undo Path + RArray iUndoPaths; + CFbsBitmap* iBitmap; + CFbsBitmap* iMask; }; #endif // __CFILTER_DRAW_H_ diff -r edfc90759b9f -r 18b321db4884 imageeditorengine/filters/FilterDraw/Inc/drawpath.h --- a/imageeditorengine/filters/FilterDraw/Inc/drawpath.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditorengine/filters/FilterDraw/Inc/drawpath.h Thu Jun 03 18:57:10 2010 +0800 @@ -37,7 +37,8 @@ public: RDrawPath(); - + TBuf<20> iBuf; + public: /** * Color. @@ -76,6 +77,7 @@ /** * Path color */ + TRgb iColor; TSize iSize; }; diff -r edfc90759b9f -r 18b321db4884 imageeditorengine/filters/FilterDraw/Src/cfilterdraw.cpp --- a/imageeditorengine/filters/FilterDraw/Src/cfilterdraw.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditorengine/filters/FilterDraw/Src/cfilterdraw.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -1,30 +1,30 @@ /* -* Copyright (c) 2010 Ixonos Plc. -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* Ixonos Plc -* -* Description: -* Draw filter for Draw UI plugin. -* -*/ - + * Copyright (c) 2010 Ixonos Plc. + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - Initial contribution + * + * Contributors: + * Ixonos Plc + * + * Description: + * Draw filter for Draw UI plugin. + * + */ #include #include #include #include "cfilterdraw.h" -const TInt KDrawBitmapWidth(640); -const TInt KDrawBitmapHeight(480); +const TInt KDrawBitmapWidth(480); +const TInt KDrawBitmapHeight(640); +TUint32* CFilterDraw::iData = NULL; // --------------------------------------------------------------------------- // Create // --------------------------------------------------------------------------- @@ -33,7 +33,7 @@ { CFilterDraw* ptr = NULL; TRAP_IGNORE( ptr = NewL() ); - return (TInt)((MImageFilter*)ptr); + return (TInt) ((MImageFilter*) ptr); } // --------------------------------------------------------------------------- @@ -42,7 +42,7 @@ // CFilterDraw* CFilterDraw::NewL() { - return new( ELeave )CFilterDraw(); + return new (ELeave) CFilterDraw(); } // --------------------------------------------------------------------------- @@ -51,22 +51,44 @@ // CFilterDraw::~CFilterDraw() { + if(iData) + { delete[] iData; + iData = NULL; + } iReadyToRender = EFalse; // Close all paths - for( TInt i(0); iViewPortSize(); + return iChild->ViewPortSize(); } // --------------------------------------------------------------------------- // GetBlockL // --------------------------------------------------------------------------- // -TBlock* CFilterDraw::GetBlockL( const TRect& aRect ) +TBlock* CFilterDraw::GetBlockL(const TRect& aRect) { - ASSERT(iChild); - TBlock* pB = iChild->GetBlockL( aRect ); - if( !pB ) return NULL; - TUint32* pD = pB->iData; - - if( iData && iReadyToRender ) - { - // Factor between real and viewed image - TReal realToViewedFactorWidth; - TReal realToViewedFactorHeight; - RealToViewedFactories(realToViewedFactorWidth, realToViewedFactorHeight); - const TInt width( iBitmapSize.iWidth ); // Data bitmap width + ASSERT(iChild); + TBlock* pB = iChild->GetBlockL(aRect); + if (!pB) + return NULL; + TUint32* pD = pB->iData; + + if (iData && iReadyToRender) + { + // Factor between real and viewed image + TReal realToViewedFactorWidth; + TReal realToViewedFactorHeight; + RealToViewedFactories(realToViewedFactorWidth, realToViewedFactorHeight); + const TInt width(iBitmapSize.iWidth); // Data bitmap width - for( TInt y(pB->iRect.iTl.iY); yiRect.iBr.iY; ++y ) - { - TInt realY(y / Scale() + 0.5); - TInt viewY(realY / realToViewedFactorHeight + 0.5); - for( TInt x(pB->iRect.iTl.iX); xiRect.iBr.iX; ++x ) - { - TInt realX(x / Scale() + 0.5); - TInt viewX(realX / realToViewedFactorWidth + 0.5); + for (TInt y(pB->iRect.iTl.iY); y < pB->iRect.iBr.iY; ++y) + { + TInt realY(y / Scale() + 0.5); + TInt viewY(realY / realToViewedFactorHeight + 0.5); + for (TInt x(pB->iRect.iTl.iX); x < pB->iRect.iBr.iX; ++x) + { + TInt realX(x / Scale() + 0.5); + TInt viewX(realX / realToViewedFactorWidth + 0.5); - TUint32 color = iData[ width*viewY + viewX ]; - if( (color & 0xff000000) ) - { - *pD = color; - } - - *pD++; - } - } - } - return pB; + if( viewY >= KDrawBitmapHeight) + { + viewY--; + } + if(iData[width * viewY + viewX]) + { + TUint32 color = iData[width * viewY + viewX]; + if ((color & 0xff000000)) + { + *pD = color; + } + } + *pD++; + } + } + } + + return pB; } // --------------------------------------------------------------------------- // SetParent // --------------------------------------------------------------------------- // -void CFilterDraw::SetParent( MImageFilter* aParent ) +void CFilterDraw::SetParent(MImageFilter* aParent) { ASSERT(aParent); iParent = aParent; @@ -155,7 +185,7 @@ // SetChild // --------------------------------------------------------------------------- // -void CFilterDraw::SetChild( MImageFilter* aChild ) +void CFilterDraw::SetChild(MImageFilter* aChild) { ASSERT(aChild); iChild = aChild; @@ -165,120 +195,163 @@ // CmdL // --------------------------------------------------------------------------- // -TInt CFilterDraw::CmdL( const TDesC16& aCmd ) +TInt CFilterDraw::CmdL(const TDesC16& aCmd) { + TInt bbb(0); + bbb = iPaths.Count(); ASSERT(iChild); - TLex lex (aCmd); - TPoint position(0,0); - // Factor between real and viewed image - TReal realToViewedFactorWidth; - TReal realToViewedFactorHeight; - RealToViewedFactories(realToViewedFactorWidth, realToViewedFactorHeight); - + TLex lex(aCmd); + TPoint position(0, 0); + // Factor between real and viewed image + TReal realToViewedFactorWidth; + TReal realToViewedFactorHeight; + RealToViewedFactories(realToViewedFactorWidth, realToViewedFactorHeight); + // Handle parameters - while( !lex.Eos() ) + while (!lex.Eos()) { + RDebug::RawPrint(aCmd); TPtrC token = lex.NextToken(); - if( token.Compare( _L("x") ) == 0 ) + TInt pathCount(0); + pathCount = iPaths.Count(); + + if (token.Compare(_L("x")) == 0) { + iCanRedo = EFalse; + for (TInt j(0); j < iUndoPaths.Count(); j++) + { + iUndoPaths[j].Close(); + } + iUndoPaths.Close(); iReadyToRender = EFalse; - TReal relscale = Scale(); - TInt param = 0; - lex.Inc (); - lex.Val (param); + TReal relscale = Scale(); + TInt param = 0; + lex.Inc(); + lex.Val(param); // Coordinates on data bitmap - position.iX = (TReal(param) / relscale) / realToViewedFactorWidth + 0.5; + position.iX = (TReal(param) / relscale) / realToViewedFactorWidth + 0.5; } - else if( token.Compare( _L("y") ) == 0 ) + else if (token.Compare(_L("y")) == 0) { - TReal relscale = Scale(); - TInt param = 0; - lex.Inc (); - lex.Val (param); - position.iY = (TReal(param) / relscale) / realToViewedFactorHeight + 0.5; - RDebug::Print(_L("CFilterDraw::CmdL x:%d y:%d Scale:%g Rw:%d Rh:%d Vpw:%d Vph:%d Rtvw:%g Rtvh:%g"), - position.iX, - position.iY, - relscale, - Rect().Size().iWidth, - Rect().Size().iHeight, - ViewPortSize().iWidth, - ViewPortSize().iHeight, - realToViewedFactorWidth, - realToViewedFactorHeight); - - if(!iPaths.Count()) + TReal relscale = Scale(); + TInt param = 0; + lex.Inc(); + lex.Val(param); + position.iY = (TReal(param) / relscale) / realToViewedFactorHeight + 0.5; + RDebug::Print( + _L("CFilterDraw::CmdL x:%d y:%d Scale:%g Rw:%d Rh:%d Vpw:%d Vph:%d Rtvw:%g Rtvh:%g"), + position.iX, position.iY, relscale, Rect().Size().iWidth, + Rect().Size().iHeight, ViewPortSize().iWidth, + ViewPortSize().iHeight, realToViewedFactorWidth, + realToViewedFactorHeight); + + if (!iPaths.Count()) { RDrawPath newPath; - User::LeaveIfError( newPath.Append(position) ); - User::LeaveIfError( iPaths.Append( newPath ) ); + User::LeaveIfError(newPath.Append(position)); + User::LeaveIfError(iPaths.Append(newPath)); } else - { - ASSERT(iPaths.Count()); - RDrawPath& lastPath = iPaths[iPaths.Count()-1]; - User::LeaveIfError( lastPath.Append(position) ); + { + ASSERT(iPaths.Count()); + RDrawPath& lastPath = iPaths[iPaths.Count() - 1]; + User::LeaveIfError(lastPath.Append(position)); } } - else if( token.Compare( _L("color") ) == 0 ) + else if (token.Compare(_L("color")) == 0) { TUint32 color(0); lex.Inc(); - lex.Val( color, EDecimal ); + lex.Val(color, EDecimal); TRgb rgb(color); - TUint32 colorValue = - ( rgb.Red() << 16 ) + ( rgb.Green() << 8 ) + rgb.Blue(); - ASSERT( iPaths.Count() ); - RDrawPath& lastPath = iPaths[iPaths.Count()-1]; - lastPath.SetColor( TRgb(colorValue) ); - } - else if( token.Compare( _L("size") ) == 0 ) + TUint32 colorValue = (rgb.Red() << 16) + (rgb.Green() << 8) + rgb.Blue(); + ASSERT( iPaths.Count() ); + RDrawPath& lastPath = iPaths[iPaths.Count() - 1]; + lastPath.SetColor(TRgb(colorValue)); + } + else if (token.Compare(_L("size")) == 0) { TInt size(0); - lex.Inc (); + lex.Inc(); lex.Val(size); // Scale line size to match bitmap scale TInt sizew( (TReal(size) / realToViewedFactorWidth) + 0.5 ); TInt sizeh( (TReal(size) / realToViewedFactorHeight) + 0.5 ); - - if( !sizew ) - { - sizew++; - } - if( !sizeh ) - { - sizeh++; - } - - if(iPaths.Count()) + + if (!sizew) + { + sizew++; + } + if (!sizeh) { - RDrawPath& lastPath = iPaths[iPaths.Count()-1]; - lastPath.SetSize( TSize(sizew, sizeh) ); + sizeh++; + } + + if (iPaths.Count()) + { + RDrawPath& lastPath = iPaths[iPaths.Count() - 1]; + lastPath.SetSize(TSize(sizew, sizeh)); } } - else if( token.Compare( _L("lastItem") ) == 0 ) - { - ASSERT(iPaths.Count()); - - RDrawPath& lastPath = iPaths[iPaths.Count()-1]; - RDebug::Print(_L("CFilterDraw::CmdL lastItem count:%d size:%d r:%d g:%d b:%d"), - iPaths.Count(), lastPath.Size().iHeight, - lastPath.Color().Red(), - lastPath.Color().Green(), - lastPath.Color().Blue() - ); + else if (token.Compare(_L("lastItem")) == 0) + { + ASSERT(iPaths.Count()); + + RDrawPath& lastPath = iPaths[iPaths.Count() - 1]; + RDebug::Print( + _L("CFilterDraw::CmdL lastItem count:%d size:%d r:%d g:%d b:%d"), + iPaths.Count(), lastPath.Size().iHeight, + lastPath.Color().Red(), lastPath.Color().Green(), + lastPath.Color().Blue()); - RDrawPath newPath; - User::LeaveIfError( iPaths.Append( newPath ) ); - } - else if( token.Compare( _L("done") ) == 0 ) - { - LoadFrameL(); - iReadyToRender = ETrue; - } + RDrawPath newPath; + User::LeaveIfError(iPaths.Append(newPath)); + } + else if (token.Compare(_L("done")) == 0) + { + LoadFrameL(); + iReadyToRender = ETrue; + } + //Undo functionality + else if (token.Compare(_L("Undo")) == 0) + { + TInt count(0); + count = iPaths.Count(); + count = iUndoPaths.Count(); + + if (iPaths.Count() > 1) + { + TInt count = iPaths.Count(); + iUndoPaths.Append(iPaths[iPaths.Count() - 2]); + iPaths.Remove(iPaths.Count() - 2); + iCanRedo = ETrue; + } + count = iPaths.Count(); + count = iUndoPaths.Count(); + } + //Redo functionality + else if (token.Compare(_L("redone")) == 0) + { + TInt count(0); + count = iPaths.Count(); + count = iUndoPaths.Count(); + + if (iCanRedo) + { + if (iUndoPaths.Count()) + { + if (iPaths.Count() >= 1) + { + iPaths.Insert(iUndoPaths[iUndoPaths.Count() - 1],iPaths.Count() - 1); + iUndoPaths.Remove(iUndoPaths.Count() - 1); + } + } + } + count = iPaths.Count(); + count = iUndoPaths.Count(); + } } - - return KErrNone; + return KErrNone; } // --------------------------------------------------------------------------- @@ -295,131 +368,129 @@ // --------------------------------------------------------------------------- // void CFilterDraw::LoadFrameL() - { - RDebug::Print(_L("CFilterDraw::LoadFrameL w:%d h:%d"), - iBitmapSize.iWidth, - iBitmapSize.iHeight); + { + RDebug::Print(_L("CFilterDraw::LoadFrameL w:%d h:%d"), iBitmapSize.iWidth, + iBitmapSize.iHeight); + + TInt xxx(0); + xxx = iPaths.Count(); + // Create a bitmap big enough to hold the drawed lines + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); + CleanupStack::PushL(bitmap); + User::LeaveIfError(bitmap->Create(iBitmapSize, EColor16MA)); - // Create a bitmap big enough to hold the drawed lines - CFbsBitmap* bitmap = new(ELeave) CFbsBitmap(); - CleanupStack::PushL( bitmap ); - User::LeaveIfError( bitmap->Create( iBitmapSize, EColor16MA ) ); - // create mask - CFbsBitmap* mask = new (ELeave) CFbsBitmap(); - CleanupStack::PushL( mask ); - User::LeaveIfError( mask->Create(iBitmapSize,EColor16MA) ); + CFbsBitmap* mask = new (ELeave) CFbsBitmap(); + CleanupStack::PushL(mask); + User::LeaveIfError(mask->Create(iBitmapSize, EColor16MA)); - CFbsBitmapDevice* maskDevice = CFbsBitmapDevice::NewL( mask ); - CleanupStack::PushL( maskDevice ); + CFbsBitmapDevice* maskDevice = CFbsBitmapDevice::NewL(mask); + CleanupStack::PushL(maskDevice); - CFbsBitGc * maskContext(NULL); - User::LeaveIfError( maskDevice->CreateContext(maskContext) ); - CleanupStack::PushL(maskContext); - maskContext->SetPenStyle(CGraphicsContext::ESolidPen); + CFbsBitGc * maskContext(NULL); + User::LeaveIfError(maskDevice->CreateContext(maskContext)); + CleanupStack::PushL(maskContext); + maskContext->SetPenStyle(CGraphicsContext::ESolidPen); maskContext->SetBrushStyle(CGraphicsContext::ESolidBrush); maskContext->SetBrushColor(KRgbBlack); - - // Create bitmap device and context - CFbsBitmapDevice * bitmapDevice = CFbsBitmapDevice::NewL (bitmap); - CleanupStack::PushL (bitmapDevice); + + // Create bitmap device and context + CFbsBitmapDevice * bitmapDevice = CFbsBitmapDevice::NewL(bitmap); + CleanupStack::PushL(bitmapDevice); // Create bitmap graphics context - CFbsBitGc * bitmapContext(NULL); - User::LeaveIfError (bitmapDevice->CreateContext (bitmapContext)); - CleanupStack::PushL (bitmapContext); - + CFbsBitGc * bitmapContext(NULL); + User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); + CleanupStack::PushL(bitmapContext); + TDisplayMode dmode = bitmap->DisplayMode(); - - for(TInt pathNumber(0); pathNumberSetPenStyle (CGraphicsContext::ESolidPen); - bitmapContext->SetBrushStyle (CGraphicsContext::ESolidBrush); + + for (TInt pathNumber(0); pathNumber < iPaths.Count(); pathNumber++) + { + RDrawPath path = iPaths[pathNumber]; + bitmapContext->SetPenStyle(CGraphicsContext::ESolidPen); + bitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush); bitmapContext->SetPenColor(path.Color()); bitmapContext->SetPenSize(path.Size()); - maskContext->SetPenSize(path.Size()); + maskContext->SetPenSize(path.Size()); - RDebug::Print(_L("CFilterDraw::LoadFrameL ps:%dx%d S:%g"), - path.Size().iWidth, - path.Size().iHeight, - Scale()); - + RDebug::Print(_L("CFilterDraw::LoadFrameL ps:%dx%d S:%g"), + path.Size().iWidth, path.Size().iHeight, Scale()); + CArrayFix* pointArray = NULL; RDrawPath2PointArray(path, pointArray); - bitmapContext->DrawPolyLine( pointArray ); - maskContext->DrawPolyLine( pointArray ); + bitmapContext->DrawPolyLine(pointArray); + maskContext->DrawPolyLine(pointArray); delete pointArray; - } - - // Create memory buffer to hold rendered image data - - if( !iData ) - { - iData = new (ELeave) TUint32 [iBitmapSize.iWidth * iBitmapSize.iHeight]; - } - Mem::FillZ(iData, - iBitmapSize.iWidth * iBitmapSize.iHeight * sizeof (TUint32)); + } - TBitmapUtil bm (bitmap); - bm.Begin(TPoint(0,0)); - TBitmapUtil maskbm (mask); - maskbm.Begin(TPoint(0,0)); - TRgb rgb(0); - // Find drawed lines from bitmap - for (TInt y(0); y < iBitmapSize.iHeight - 1; y++ ) - { - for (TInt x(0); x < iBitmapSize.iWidth - 1; x++ ) - { - // Check mask first - maskbm.SetPos(TPoint(x,y)); - if( maskbm.GetPixel() == KRgbBlack.Internal() ) - { - bm.SetPos(TPoint(x,y)); - rgb = bm.GetPixel(); - iData[(iBitmapSize.iWidth*y)+x] = - ( rgb.Red() << 16 ) + ( rgb.Green() << 8 ) + rgb.Blue() | - 0xff000000; - } - } - } + // Create memory buffer to hold rendered image data + + if (!iData) + { + iData = new (ELeave) TUint32[iBitmapSize.iWidth * iBitmapSize.iHeight]; + Mem::FillZ(iData, iBitmapSize.iWidth * iBitmapSize.iHeight + * sizeof(TUint32)); + } + + TBitmapUtil bm(bitmap); + bm.Begin(TPoint(0, 0)); + TBitmapUtil maskbm(mask); + maskbm.Begin(TPoint(0, 0)); + TRgb rgb(0); + + // Find drawed lines from bitmap + for (TInt y(0); y < iBitmapSize.iHeight - 1; y++) + { + for (TInt x(0); x < iBitmapSize.iWidth - 1; x++) + { + // Check mask first + maskbm.SetPos(TPoint(x, y)); + if (maskbm.GetPixel() == KRgbBlack.Internal()) + { + bm.SetPos(TPoint(x, y)); + rgb = bm.GetPixel(); + iData[(iBitmapSize.iWidth * y) + x] = (rgb.Red() << 16) + + (rgb.Green() << 8) + rgb.Blue() | 0xff000000; + } + } + } + bm.End(); maskbm.End(); // bitmapContext, bitmapDevice, maskContext, maskDevice, mask, bitmap - CleanupStack::PopAndDestroy(6, bitmap); - RDebug::Print(_L("CFilterDraw::LoadFrameL - end")); + CleanupStack::PopAndDestroy(6, bitmap); + RDebug::Print(_L("CFilterDraw::LoadFrameL - end")); } - + // --------------------------------------------------------------------------- // RDrawPath2PointArray // --------------------------------------------------------------------------- // -void CFilterDraw::RDrawPath2PointArray( - const RDrawPath& aPath, CArrayFix*& aArrayPtr) const - { - // if allocation fails just do nothing. +1 if count is zero - aArrayPtr = new CArrayFixFlat ( aPath.Count() + 1 ); - if (aArrayPtr) - { - for( TInt i(0); iAppendL( item ) ); - } - } - } +void CFilterDraw::RDrawPath2PointArray(const RDrawPath& aPath, + CArrayFix*& aArrayPtr) const + { + // if allocation fails just do nothing. +1 if count is zero + aArrayPtr = new CArrayFixFlat (aPath.Count() + 1); + if (aArrayPtr) + { + for (TInt i(0); i < aPath.Count(); i++) + { + TPoint item = aPath[i]; + TRAP_IGNORE( aArrayPtr->AppendL( item ) ); + } + } + } // --------------------------------------------------------------------------- // RealToViewedFactories // --------------------------------------------------------------------------- // void CFilterDraw::RealToViewedFactories(TReal& aWidth, TReal& aHeight) - { - // Factor between real and viewed image - aWidth = TReal(ViewPortSize().iWidth) / - TReal(iBitmapSize.iWidth); - aHeight = TReal(ViewPortSize().iHeight) / - TReal(iBitmapSize.iHeight); - } + { + // Factor between real and viewed image + aWidth = TReal(ViewPortSize().iWidth) / TReal(iBitmapSize.iWidth); + aHeight = TReal(ViewPortSize().iHeight) / TReal(iBitmapSize.iHeight); + } diff -r edfc90759b9f -r 18b321db4884 imageeditorengine/filters/FilterDraw/Src/drawpath.cpp --- a/imageeditorengine/filters/FilterDraw/Src/drawpath.cpp Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditorengine/filters/FilterDraw/Src/drawpath.cpp Thu Jun 03 18:57:10 2010 +0800 @@ -27,5 +27,6 @@ // RDrawPath::RDrawPath():iColor(KRgbWhite) { + iBuf.Append(_L("UnInitialize")); } diff -r edfc90759b9f -r 18b321db4884 imageeditorengine/group/bld.inf --- a/imageeditorengine/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditorengine/group/bld.inf Thu Jun 03 18:57:10 2010 +0800 @@ -40,9 +40,7 @@ #include "../filters/FilterSepia/group/bld.inf" #include "../filters/FilterSharpness/group/bld.inf" #include "../filters/FilterText/group/bld.inf" -#ifdef RD_IE_DRAW_PLUGIN #include "../filters/FilterDraw/group/bld.inf" -#endif // RD_IE_DRAW_PLUGIN // Image Editor Utilitties #include "../ImageEditorUtils/group/bld.inf"